Statamic tuning
Published
Updated
Statamic on fortrabbit runs with the settings of the software template. This page covers apps set up without it, the control panel on the server, updates, mail and the license.
Adding domains
Every environment starts with its default domain. Add external domains for production. The template sets APP_URL to the main domain.
Software template
The Statamic software template sets the root path, the ENV vars for app and database, the build and post deploy commands, and the exclude patterns for the content:
Statamic 6, 5, 4, 3
| Deployment | Value |
|---|---|
| Root path | public |
| Deploy strategy | replace |
| Excluded paths | /storage/node_modules/content/users/resources/blueprints/resources/fieldsets/resources/forms/resources/users/public/assets |
| Build commands | composer install --no-dev --prefer-dist --no-interaction --no-ansi --no-progressnpm installnpm run build |
| Post-deploy commands | mkdir -p storage/framework/{sessions,views,cache}php artisan migrate --force |
| 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 | ${FORTRABBIT_DB_TYPE} |
| 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} |
For an app created without the template, copy these settings by hand in the ENV vars, the root path and the deployment settings. Use the same APP_KEY locally and on fortrabbit.
Working with the control panel
Editors manage content in the browser with the control panel at /cp, such as {{app-env-id}}.{{region}}.frbit.app/cp. How content moves depends on the deployment option:
- Content in Git: edit locally only. A deployment overwrites edits made in the control panel on the server.
- Content by rsync: sync the edits made on the server down, see Git and rsync.
- Content in MySQL: copy the database down from time to time, see export and import.
Image presets
Statamic generates the image presets of a container on upload, as a Laravel queue job. With QUEUE_CONNECTION=sync, the default of Statamic, that job runs in the upload request. Move it to a worker the way Laravel does, see Laravel queue:
- Set
QUEUE_CONNECTION=databasein the ENV vars and create thejobstable. - Add a worker with
php artisan queue:work --sleep=3 --tries=3 --max-time=3600.
Glide sizes outside the presets still render on the first view of their URL, in a PHP process of the site. Use presets for every size in the templates. To create missing presets, run php please assets:generate-presets over SSH. See image transforms.
Backups
The backup component backs up files and database daily. Git holds the history of the code.
Updating Statamic
Update locally first: run composer update in the project folder, test, then commit composer.lock and git push.
Sending mails
fortrabbit has no sendmail. Statamic sends through Laravel mail: set the SMTP or API settings of a mail account or a transactional mail provider as ENV vars, see Statamic email.
Getting a license
Statamic Core is free. Statamic Pro adds team features such as several users and roles, and needs a license, see Statamic licensing.