1

Has been a pleasure using Craft 3 for a while to build headless JAMstack websites.

The issue we have run into is keeping our staging and production environments as separate as possible.

We would ideally like to have 2 Craft instances running on different URLs, 1 where we can test adding and modifying fields for our headless staging frontend to use.

And then 1 for production, where clients can add content, and where we can then apply the newly tested field updates.

My thoughts on the way to do this would be the following.

  1. Make field updates on staging
  2. Test new field updates
  3. Switch prod into maintenance mode
  4. Push current prod state to staging (database export/import) and file changes. (ideally somehow merge prod's content updates with staging's field updates)
  5. Then push staging updates (merged with prod) back to prod.
  6. Disable maintenance mode

The issues I predict is merging field updates with newly added content using old field types.

I'm hoping that doing this doesn't require duplicate actions of adding fields through the GUI on both staging and prod once the feature has been approved on staging.

Is there a field migratory maybe?

Kindly, and thanks for any responses.

1 Answer 1

1

Craft has the project config feature for moving settings across environments.

Project config saves out database-stored settings as configuration files. Craft reads those in and applies changes.

Ideally, you'd do this via a version control workflow, so you make the changes in your local environment, deploy them to staging, and then to production.

For project config to work properly, you need to adhere to a workflow that flows one-way only. Make changes in one environment (e.g. local) and then move them upstream to staging and then production. You don't want to make changes in production while making them in staging or local. You'll have a mess with project config conflicts.

2
  • Our users won't be doing config changes on prod, but there will be content changes, are content changes independent of config changes?
    – lopu
    Feb 2, 2022 at 0:29
  • Yes, they are different. Content changes are tracked solely in the database and not in project config.
    – CraftQuest
    Feb 4, 2022 at 16:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.