Craft CMS production settings

Published

Updated

Reviewedbyfl

The Craft CMS software template turns off dev mode, updates and admin changes on fortrabbit. Local development stays the single source for code and structure.

Dev mode

CRAFT_DEV_MODE=false hides error details from visitors. To see them while debugging, set it to true on an environment that is not public, and back to false afterwards. See what dev mode does.

Updates

CRAFT_ALLOW_UPDATES=false removes updates from the control panel. An update on the environment would change files that git does not track, and the next deployment would undo it. Update locally and deploy, see updating Craft CMS.

Admin changes

CRAFT_ALLOW_ADMIN_CHANGES=false blocks changes to sections, fields and settings on fortrabbit. These changes live in the project config, and the next deployment applies the project config from the repository over them. Editors still create and edit content. See allowAdminChanges.

Control panel URL

The control panel answers on /admin by default. Change it with the cpTrigger setting in config/general.php:

return [
  'cpTrigger' => 'backend',
];
php

Craft CLI on fortrabbit

Run Craft commands over SSH with php craft. Not every command belongs on a production environment:

CommandOn fortrabbit
setup/*Never, local only
update/*Never, update locally
migrate/all, project-config/apply, upOnly when the post-deploy commands do not run them
clear-caches/*Runs with every deployment; manually only with a reason
resave/*When a migration or plugin asks for it
db/backup, db/restorePossible, the dump slows the site down while it runs

Written by humans and AI in collaboration.

AI use & editorial processEdit on GitHub ↗