Deploy Craft CMS to fortrabbit
Reviewedbyfl
Markdown ↓Set up automatic git code deployment for your Craft CMS application hosted on fortrabbit.
Install and deploy run down
- Install Craft CMS locally
- Setup an app at fortrabbit
- Deploy code via Git ← you are here
- Database syncing
- Assets syncing
Git deployment
Git deployment automatically updates your fortrabbit app when you push code to GitHub. If you've followed the Craft CMS guides so far, your local project is connected to a GitHub repo, and you've created an app on fortrabbit linked to that repo.
Trigger a deployment by running git push locally or clicking the deploy button in the dashboard. This pushes your latest commit to fortrabbit. See the Git deployment intro for how this works. The fortrabbit platform also supports other Git providers.
Deployment configuration
Craft CMS deployment is usually pre-configured automatically. fortrabbit's stack detection scans your repo and applies sensible defaults via software templates, so build commands and post-deploy commands are already set up in most cases.
Deployment strategy
By default, Craft CMS apps use the merge deployment strategy with replace patterns for config files. This protects local Craft asset volumes since they can be stored anywhere in your file structure.
Consider using the replace strategy with exclude patterns for each asset volume. It works either way.
Build commands
Build commands are usually pre-configured and run automatically during deployment:
composer install # Always
npm run prod # If detected
Post deploy commands
Post-deploy commands run after your code is live on fortrabbit. These are usually pre-configured and run database migrations to apply schema changes and project config updates:
php craft project-config/apply
php craft migrate/all