A bash script to deploy Craft CMS on production servers.
A bash script for zero-downtime Craft CMS deployment to run on production servers. Inspired by the Capistrano routine. This script is still beta! Please use it very carefully!
chmod +x deploy.sh setup.sh
to set execution permissions../setup.sh
to create the initial folders and files..env
into shared/
.storage
folder into shared/
.web/.htaccess
into shared/web/
.web/cpresources
folder into shared/web/
.[ASSETS_DIR]
folder and web/cpresources
folder into shared/web/
../deploy.sh
manually.Following files and folders must be added to .gitignore
to make the symlinks work:
This script is still beta. Please use it carefully and not on large and heavy projects. Or do, whatever, your call.
Creates the necessary releases
, shared
and shared/web
folders on the server. Run this script first.
./craft backup/db
to create a database backup first.releases
named by the current timestamp, i.e. 20190623170859
.composer install
to install Craft CMS../craft migrate/all
and ./craft project-config/sync
.current
folder to the newest release.[DEPLOY_KEEP_RELEASES]
releases.[DEPLOY_KEEP_BACKUPS]
backups.Creates a symlink from current/
to the second newest release folder (i.e. the former release), deletes the current release folder afterwards and runs composer install
, ./craft migrate/all
and ./craft project-config/sync
. That's all. No further database actions.
If you run a major update with significant database migrations you do it on your own responsibility!
Optional webhook script to run the bash scripts and creates a logfile. You can use your own scripts of course.
When you don't want to spend money on deployment services and tools like Capistrano are just too much to set up for smaller projects.
.env
for better config handling.update.sh
scripts into deploy.sh
and/or create flags.Itsa MIT!