-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathserver_deploy.sh
executable file
·37 lines (28 loc) · 1022 Bytes
/
server_deploy.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#!/bin/sh
set -e
echo "Deploying application ..."
# Check if --dev argument is passed
if [ "$1" = "--dev" ]; then
branch="dev"
else
branch="master"
fi
# Enter maintenance mode
(/opt/alt/php82/usr/bin/php artisan down) || true
# Update codebase
# git fetch origin production
# git reset --hard origin/production
git pull origin $branch --force
# Install dependencies based on lock file
/opt/alt/php82/usr/bin/php /opt/cpanel/composer/bin/composer install --no-interaction --prefer-dist --optimize-autoloader --no-progress $(if [ branch != "dev" ]; then echo "--no-dev"; fi)
# Migrate database
/opt/alt/php82/usr/bin/php artisan migrate --force
# Note: If you're using queue workers, this is the place to restart them.
# ...
# Clear cache
/opt/alt/php82/usr/bin/php artisan optimize
# Reload PHP to update opcache
# echo "" | sudo -S service php7.4-fpm reload
# Exit maintenance mode
/opt/alt/php82/usr/bin/php artisan up
echo "Application deployed!"