From a032ea9bdfc2fe5f53306341a491180ca3875426 Mon Sep 17 00:00:00 2001 From: Sebastian D <31686237+sebathefox@users.noreply.github.com> Date: Wed, 5 Aug 2020 14:01:48 +0200 Subject: [PATCH] Create server_deploy.sh --- server_deploy.sh | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 server_deploy.sh diff --git a/server_deploy.sh b/server_deploy.sh new file mode 100644 index 0000000..7eaf290 --- /dev/null +++ b/server_deploy.sh @@ -0,0 +1,29 @@ +#!/bin/sh +set -e + +echo "Deploying application ..." + +# Enter maintenance mode +(php artisan down --message 'The app is being (quickly!) updated. Please try again in a minute.') || true + # Update codebase + git fetch origin deploy + git reset --hard origin/deploy + + # Install dependencies based on lock file + composer install --no-interaction --prefer-dist --optimize-autoloader + + # Migrate database + php artisan migrate --force + + # Note: If you're using queue workers, this is the place to restart them. + # ... + + # Clear cache + php artisan optimize + + # Reload PHP to update opcache + echo "" | sudo -S service php7.4-fpm reload +# Exit maintenance mode +php artisan up + +echo "Application deployed!"