These scripts can be used to set up automic deployments in runcloud for laravel applications
Last active
October 12, 2024 17:49
-
-
Save mindfullsilence/5df7592ea4422f9a5724f4de3fdd19b3 to your computer and use it in GitHub Desktop.
Deployment scripts for atomic deployment of laravel applications in runcloud
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
################################################################## | |
# == CLEAR CACHE == | |
# | |
# Clears all laravel caches | |
# | |
# Action: Activate New Release | |
# Location: Before Activate New Release | |
################################################################## | |
cd {RELEASEPATH} | |
# Run database migrations | |
php artisan migrate --force | |
php artisan cache:clear | |
# Clear expired password reset tokens | |
php artisan auth:clear-resets | |
# Clear and cache routes | |
php artisan route:clear | |
php artisan route:cache | |
# Clear and cache config | |
php artisan config:clear | |
php artisan config:cache |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
################################################################## | |
# == NPM == | |
# | |
# Install and compile npm sources, regenerate composer classmap | |
# | |
# Action: Install Composer Dependencies | |
# Location: After Install Composer Dependencies | |
################################################################## | |
cd {RELEASEPATH} | |
# regenerate classmap | |
composer dump-autoload | |
# install and compile npm packages | |
npm install | |
npm run prod |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
################################################################## | |
# == END == | |
# | |
# Brings laravel out of maintenance mode. | |
# | |
# Action: Activate Latest Release | |
# Location: After Activate Latest Release | |
################################################################## | |
cd {RELEASEPATH} | |
php artisan up |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
################################################################## | |
# == FIRST DEPLOYMENT == | |
# | |
# NOTE: Run the below only for the first deployment to migrate and seed, | |
# then remove this script | |
# | |
# Action: Install Composer Dependencies | |
# Location: After Install Composer Dependencies | |
################################################################## | |
cd {RELEASEPATH} | |
php artisan migrate-fresh | |
php artisan db:seed |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
################################################################## | |
# == MAINTENANCE == | |
# | |
# Puts laravel into maintenance mode. | |
# | |
# Action: Clone New Release | |
# Location: Before Clone New Release | |
################################################################## | |
cd {ROOTPATH}/live | |
php artisan down |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
################################################################## | |
# == NOVA == | |
# | |
# OPTIONAL: Only run if you are using the laravel/nova package | |
# | |
# Action: Activate New Release | |
# Location: Before Activate New Release | |
################################################################## | |
cd {RELEASEPATH} | |
php artisan vendor:publish --provider=YourCustomNovaThemeNamespace\\YourCustomNovaTheme\\ThemeServiceProvider --force |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
################################################################## | |
# == LARAVEL SCOUT == | |
# | |
# OPTIONAL: This script is meant to be run for sites that use the | |
# laravel/scout package. | |
# | |
# NOTE: Repeat the below command for every model you wish to be | |
# searchable via laravel scout | |
# | |
# Action: Activate New Release | |
# Location: Before Activate New Release | |
################################################################## | |
cd {RELEASEPATH} | |
php artisan tenants:run scout:import --argument="model=App\\Models\\Tenant\\User" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
################################################################## | |
# == TENANCY FOR LARAVEL == | |
# | |
# OPTIONAL: This script is meant to be run for sites that use the | |
# stancl/tenancyforlaravel package. | |
# | |
# Action: Activate New Release | |
# Location: Before Activate New Release | |
################################################################## | |
cd {RELEASEPATH} | |
php artisan tenants:migrate |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi, are you using this scripts with last Runcloud.io UI ?