Forked from tonioriol/laravel-forge-deploy.sh
Last active
April 22, 2021 18:29
Star
You must be signed in to star a gist
Laravel Forge zero downtime deployment script
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
# stop script on error signal | |
set -e | |
SITE="example.com" | |
DEPL="/home/forge/deployments/${SITE}" | |
# create directory and any intermediate directories if don't exist | |
mkdir -p ${DEPL} | |
CUR="/home/forge/${SITE}" | |
NEW="${DEPL}/new" | |
BKP="${DEPL}/backup" | |
# Remove previous deployment folders | |
if [ -d ${NEW} ]; then | |
rm -R ${NEW} | |
fi | |
if [ -d ${BKP} ]; then | |
rm -R ${BKP} | |
fi | |
cp -R ${CUR} ${NEW} | |
cd ${NEW} | |
##################################################################### | |
# Insert the rest of your standard Forge deployment script below here | |
##################################################################### | |
##################################################################### | |
# Your standard Forge deployment should end above, or at least before | |
# the switch, seriously. You're entering a world of pain, otherwise. | |
##################################################################### | |
# Switch (this will cause microseconds of downtime) | |
mv ${CUR} ${BKP} | |
mv ${NEW} ${CUR} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment