Skip to content

Instantly share code, notes, and snippets.

@joshuabaker
Created June 20, 2023 15:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save joshuabaker/d4c3ead9f9da175b3a3fc260aaf36853 to your computer and use it in GitHub Desktop.
Save joshuabaker/d4c3ead9f9da175b3a3fc260aaf36853 to your computer and use it in GitHub Desktop.
Craft CMS project config deploy script for Fortrabbit

If, like me, you find issues deploying Craft’s project config on Fortrabbit, you might use this script.

This script…

  • Erases project config files on the remote
  • Then uses rsync to upload your local config files
  • Clears Craft’s caches on the remote (helpful if you’re adding plugins/licenses)
  • Runs any pending migrations
  • Applies the latest project config files

Add the script to your composer.json and update the app name and deploy URL (if needed).

⚠️ Backup your database beforehand!

{
"scripts": {
"deploy-project-config": [
"ssh {app-name}@deploy.eu2.frbit.com rm -rf config/project/*",
"rsync -av ./config/project/* {app-name}@deploy.eu2.frbit.com:~/config/project",
"ssh {app-name}@deploy.eu2.frbit.com php craft clear-caches/all",
"ssh {app-name}@deploy.eu2.frbit.com php craft migrate/all",
"ssh {app-name}@deploy.eu2.frbit.com php craft project-config/apply"
]
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment