Habits that reduce the number of bad afternoons.
VERSION CONTROL EVERYTHING
Code, configuration templates, deployment scripts, documentation. Not credentials.
NEVER EDIT ON PRODUCTION
Changes made on the server exist nowhere else and are lost at the next deployment.
BACK UP BEFORE CHANGES
Files and database, before anything substantial. It takes two minutes.
TEST ON STAGING
Particularly updates, migrations and anything touching payment.
KEEP CONFIGURATION OUT OF CODE
Environment variables or a config file per environment, excluded from the repository.
LOG ERRORS, DO NOT DISPLAY THEM
Displayed errors expose file paths and query fragments to anyone who triggers them.
UPDATE DEPENDENCIES DELIBERATELY
Locally, then test, then deploy. Not on production.
DOCUMENT AS YOU GO
You will not remember why in six months.
AUTOMATE THE REPETITIVE
Deployment, backups, testing. Anything done by hand is eventually done wrong.
MONITOR
Know the site is down before a client tells you.