A safe development workflow: local, staging, live

workflow, staging, git, deploy, local, backups, best practice · 0 found this helpful

Changing a live site directly is risky. A simple three-stage routine keeps mistakes away from customers.

The three stages

Stage Where Who sees it Purpose
Local Your computer You Write and break things
Staging staging.example.ca on Barbrick You and reviewers Test on the real server setup
Live example.ca Customers The real site

Staging comes with Business and Pro. On Essential, use a subdomain and copy files by hand. See Staging sites.

1. Local

  1. Run the site on your computer with Docker, Local, MAMP, or your language's dev server.
  2. Put the code in Git. Add .gitignore for secrets and large folders.
  3. Match PHP, Node, or Python versions to the server. See Change PHP version and extensions.
  4. Keep secrets in .env, not in code. See Set environment variables for apps.

2. Staging

  1. Create a subdomain. See Create a subdomain.
  2. Protect it. See Password-protect a folder.
  3. Deploy the Git branch staging here. See Deploy with Git.
  4. For WordPress, use the staging copy in the WordPress section instead. See Stage or clone a WordPress site.
  5. Turn off real payments and emails.
  6. Test the changes. Send the staging address to your reviewer.

3. Live

  1. Take a backup. Daily backups run, but take a fresh one before a release. See Back up and restore WordPress and Export a database.
  2. Merge to main.
  3. Deploy. See Automatic deployment from Git.
  4. Clear caches.
  5. Check the site and error log. See Read your site's error log.

Database changes

Code goes forward through Git. Data usually doesn't. Don't copy a staging database over live if customers have placed orders. Instead:

Release checklist

[ ] Tested on staging
[ ] Backup taken, and I know how to restore
[ ] Deploy at a quiet time
[ ] Key pages and forms checked after deploy
[ ] Error log clear
[ ] Cache purged
[ ] Rollback plan: git revert, or restore backup

Roll back

git revert HEAD            # undo the last commit, then redeploy

Or restore from Backups in your account. We keep 30 daily restore points.

Was this helpful?

Still stuck? Ask us and we'll walk you through it.