generated from Innovix-Matrix-Systems/ims-laravel-api-starter
-
Notifications
You must be signed in to change notification settings - Fork 3
/
deploy.sh
29 lines (21 loc) · 800 Bytes
/
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
#!/bin/bash
# Go to the project directory
cd /var/www/your-project-path
# Pull the latest changes from the Git repository
echo Pulling latest changes ....
sudo git pull # currently deploying develop branch
# Install/update Composer dependencies
echo Installing composer ....
sudo composer install --no-interaction --prefer-dist --optimize-autoloader
# Run database migrations (if necessary)
echo Running Database Migration ....
sudo php artisan migrate --force
# Clear caches and optimize
echo Optimizing the app ...
sudo php artisan optimize:clear
# Reload your web server (e.g., Nginx or Apache) if necessary
echo Reloading nginx ....
sudo systemctl reload nginx
# sudo systemctl reload apache2
# Optionally, you can trigger any other post-deployment tasks here
echo "Deployment completed"