# Deploy Craft CMS 6 to fortrabbit

Source: https://docs.fortrabbit.com/guides/craft-cms/craft-6/deployment
Published: 2026-11-27
Updated: 2026-11-27
Reviewed: 2026-11-27

> Git deployment for Craft CMS 6 on fortrabbit: composer install, php artisan migrate and craft:up after each deployment, and the replace strategy.


## Install and deploy run down

1. [Install Craft CMS 6 locally](/guides/craft-cms/craft-6/install)
2. [Set up an app at fortrabbit](/guides/craft-cms/craft-6/setup)
3. **Deploy code via Git** _← you are here_
4. [Database syncing](/guides/craft-cms/craft-6/database)
5. [Assets](/guides/craft-cms/craft-6/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](/platform/deployment/intro) for how it works.

## Settings from the template

Version 6 of the Craft CMS [software template](/platform/concepts/software-templates) sets the deployment:

### Craft CMS 6

| Deployment | Value |
| :--- | :--- |
| Root path | `public` |
| Deploy strategy | `replace` |
| Excluded paths | `/storage`<br/>`/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}`<br/>`php artisan migrate --force`<br/>`php artisan storage:link --force`<br/>`if php artisan craft:install:check; then php artisan craft:up; fi`<br/>`if 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](/platform/deployment/deploy-file). Add `npm install` and `npm run build` to the build commands for front-end assets built with Vite.

## Notes

- `craft:install:check` skips `craft:up` while Craft is not installed, so the first deployment to an empty database passes.
- The [replace strategy](/platform/deployment/strategy#replace-strategy) deletes files that are not in the repository, except in `storage`. `storage:link` creates the `public/storage` link for [assets](/guides/craft-cms/craft-6/assets) again.
- The project config in `config/craft/project/` comes from the repository. Make settings changes locally and commit them.
