-
-
Save defenestrator/71ab86a058582b8492a6727d3e3f4be2 to your computer and use it in GitHub Desktop.
Laravel Forge zero downtime deployment script
This file contains hidden or 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