Deploy Craft CMS 6 to fortrabbit
Published
Updated
Git deployment for Craft CMS 6 on fortrabbit, with the build and post-deploy commands of the software template.
Install and deploy run down
- Install Craft CMS 6 locally
- Set up an app at fortrabbit
- Deploy code via Git ← you are here
- Database syncing
- Assets
Git deployment
With the repository connected to the app, a git push to the deployment branch starts a deployment. The deploy button in the dashboard deploys the latest commit. See the deployment intro for how it works.
Settings from the template
Version 6 of the Craft CMS software template sets the deployment:
Craft CMS 6
| Deployment | Value |
|---|---|
| Root path | public |
| Deploy strategy | replace |
| Excluded paths | /storage/node_modules |
| Build commands | composer install --no-dev --prefer-dist --no-interaction --no-ansi --no-progress |
| Post-deploy commands | mkdir -p storage/framework/{sessions,views,cache}php artisan migrate --forcephp artisan storage:link --forceif php artisan craft:install:check; then php artisan craft:up; fiif php artisan craft:install:check; then php artisan craft:clear-caches/all; fi |
| Environment variables | Value |
|---|---|
| APP_DEBUG | false |
| APP_ENV | production |
| APP_KEY | !RANDOM_KEY! |
| APP_URL | https://${FORTRABBIT_MAIN_DOMAIN} |
| LOG_CHANNEL | stack |
| LOG_STACK | stderr |
| Database environment variables | Value |
|---|---|
| DB_CONNECTION | mysql |
| DB_DATABASE | ${FORTRABBIT_DB_NAME} |
| DB_HOST | ${FORTRABBIT_DB_HOST} |
| DB_PASSWORD | ${FORTRABBIT_DB_PASSWORD} |
| DB_PORT | ${FORTRABBIT_DB_PORT} |
| DB_USERNAME | ${FORTRABBIT_DB_USER} |
Change them in the deployment settings of the environment or with a deploy file. Add npm install and npm run build to the build commands for front-end assets built with Vite.
Notes
craft:install:checkskipscraft:upwhile Craft is not installed, so the first deployment to an empty database passes.- The replace strategy deletes files that are not in the repository, except in
storage.storage:linkcreates thepublic/storagelink for assets again. - The project config in
config/craft/project/comes from the repository. Make settings changes locally and commit them.