File tree 1 file changed +30
-0
lines changed
1 file changed +30
-0
lines changed Original file line number Diff line number Diff line change
1
+ #! /bin/bash
2
+
3
+ # Make sure this file has executable permissions, run `chmod +x deploy.sh` to ensure it does
4
+
5
+ # Variable name to check maintenance mode
6
+ ENV_VAR_NAME=" MAINTENANCE_MODE"
7
+
8
+ # Check if the environment variable is set to "true"
9
+ if [[ " ${! ENV_VAR_NAME} " = " true" ]]; then
10
+ echo " Entering maintenance mode..."
11
+ php artisan down
12
+ fi
13
+
14
+ # Clear cache
15
+ php artisan optimize:clear
16
+
17
+ # Cache the various components of the Laravel application
18
+ php artisan config:cache
19
+ php artisan event:cache
20
+ php artisan route:cache
21
+ php artisan view:cache
22
+
23
+ # Run any database migrations
24
+ php artisan migrate --force
25
+
26
+ # Check if the environment variable is set to "false" or not set at all
27
+ if [[ " ${! ENV_VAR_NAME} " = " false" ]] || [[ -z " ${! ENV_VAR_NAME} " ]]; then
28
+ echo " Exiting maintenance mode..."
29
+ php artisan up
30
+ fi
You can’t perform that action at this time.
0 commit comments