Backup Prod -> Snap -> Build Test -> Change Address

AI-generated summary

In a discussion titled “Backup Prod → Snap → Build Test → Change Address” within the Self-hosting category, user elRicharde sought advice on running a 1:1 copy of their Discourse instance on a new server with a different hostname. They had successfully created a snapshot from production and rebuilt a test instance but found that simply changing the DISCOURSE_HOSTNAME in app.yml was insufficient to get the system running without a full restore or rebuild elRicharde. NateDhaliwal suggested following official restoration guides, though elRicharde clarified they wanted to solve the specific problem of modifying an existing rebuild rather than performing a fresh restore. pfaffman explained that changing the hostname requires database updates and recommended either restoring a backup or pushing the Docker image to a private repo to start it manually. Initially, elRicharde marked the attempt as failed. However, they later returned to report that the solution actually worked: taking a production snapshot, rebuilding the dev instance, changing the hostname in app.yml, and running a rebuild elRicharde. They noted that this method is efficient but advised limiting the frequency of rebuilds on the same address to avoid SSL certificate rate limits, recommending a cycle of snapping production, rebuilding dev, and then snapping dev for best practices.

Hello everyone,
I’m currently struggling to implement my goal despite using AI.

Our Discourse is running on Hetzner. The address could be forum.thisIsMyDomain.com.
There I make a backup and then a snapshot from the backup.

I have another Hetzner server for testing purposes, and I’m rebuilding it from the snapshot. The server logically has a different IP and address, e.g., dev.thisIsMyDomain.com.

How can I get the dev/test instance running?
nano /var/discourse/containers/app.yml

DISCOURSE_HOSTNAME: adjust to the new name

This doesn’t seem to be enough.
However, I absolutely do not want to perform a rebuild, but rather get a 1:1 copy running in the first step.

Has anyone gained experience with this and can give me a tip on how to proceed? Thank you all for your time.

Richarde

Hi there, did you follow this guide to restoring from backups?

(Also see Restore a Discourse backup manually for development but I don’t think that’s relevant?)

Thank you for your answer.

No, I tried it my way and am looking for a solution for that way.

You can try changing the hostname and doing a ‘./launcher rebuild app’`.

But since the hostname has changed, a bunch of stuff in the database also needs to be changed. The easiest way is to restore a backup. There once was a topic about how to change the hostname; I don’t see it, but I might not have looked hard enough. Or maybe it wwas deleted because it’s much easier and more reliable to restore the backup.

You might be able to do a `./launcher destroy app;./launcher start app` and then restore the backup from the command line.

What I would recommend is Move a Discourse site to another VPS with rsync and Set up a staging server

Then what you’d do is push your docker image somewhere, and then use ./launcher start-cmd app to see how to start it. So you’ll need to figure out enough about docker to push the image to a private repo and start it up and then restore the backup.

I would like to mark this attempt as officially failed :slight_smile:
I tried a lot, but it seems impossible (for me), so I’m giving up on this approach.

Just to inform everyone who might have the same idea.
If I manage to solve my problem in another way as a beginner, I’ll gladly post my working solution here.

actually this works.

don´t know why it didn´t before, but right now that´s how i do it.

  • Snap of Prod.
  • Rebuild Dev from Prod Snap
  • change app.ylm “DISCOURSE_HOSTNAME” to new DevAdr
  • Rebuild App

you should not do this to often in a week, as there is a rate limit for ssl trusted certificates. Best practise:
snap Prod, rebuild Dev, Snap Dev

Every Rebuild on same Address, dosn´t lead to new creation of ssl certificate.

This is the easy way for me to create a test server, just a few clicks.