Set up a staging server

That is kind of the point of the setup above; it is super useful to have the staging server pointing at the same bucket as this makes it much easier to keep them in sync.

However, you don’t want it contributing any backups automatically (or deleting any) - hence these is turned off by these settings:

Agree that the CDN needs to be turned off for your staging site. I haven’t messed with that myself, but once you work how to do that please do update / add to the wiki in the OP.

2 Likes

Thanks, Nathan. I saw mention of S3 backups making things easier but a backup is different to the site assets so I wasn’t sure.

I’ve already turned off backups and emails so all good there. I’ll get on with pointing the staging server to the existing bucket and make sure it isn’t using the CDN.

1 Like

Sharing backups is really nice because it makes it easy to copy your production database to staging.

2 Likes

I plan to create a mirror of my production Discourse by using the rsync method.

I have a couple of other web sites which integrate with Discourse, so having the dev/test versions of those sites being able to hit and interact with a dev/test/staging version of Discourse would be ideal.

Therefore I would only power it on when needed, and I would restore a database backup of my PROD on to my STAGING periodically - not daily and maybe as little as once per month.

If I do this, how do I stop it changing some settings back when I do the database restore? :thinking:

These for example, would be invaluable:

Is there a way I could restore a database backup and then maybe manually apply some settings before starting Discourse? Any other ideas, suggestions, gotchas? :thinking:

If you keep backups on S3 and configure that via ENV variables, then you can pretty easily spin up a new site that can restore that backup. Just spin up a new VM, clone discourse, copy the yml, rebuild and restore. You can override settings in the database with ENV variables as in the quote in your post.

2 Likes

Perfect, it sounds almost too easy :smiley:

2 Likes