Migrate instance from Docker to non-Docker on another server


I have an instance running on a Scaleway server inside Docker.

I would like to move this instance on another (dedicated) server, running standalone (without Docker).

I’ve already managed to setup a fresh instance on this new server (on another domain), and it’s working.

Now, in addition to the database, which files/folders should I import from the original server to the new one?

Can I just import the database and files, modify .env.production with the actual domain and switch the DNS?
Do I miss any steps?


I recommend:

  • Move postgres database using pg_dump and pg_restore (do not simply copy postgres files over, that seems to create issues like broken indices)
  • Move public/system directory over (that’s all the uploads!)
  • After move, run rails mastodon:feeds:build (with appropriate prepends like bundle exec and the env, depends on your setup) to re-create the home feeds inside redis (easier than exporting/importing redis, though if you had any Sidekiq jobs queued up previously those are obviously going to be lost this way)

Thanks, @Gargron

However, I did some test and it is not as easy as it seems.
I did some tests, and in the end, I always end with a “Something went wrong” error.

I did it has something to do with the database. I do not know postgresql very much and I surely did something wrong.
How should I dump the database on the docker instance (the user is postgres, the database is postgres too), and how to restore it on the new server, where the user is mastodon and the database is mastodon_production?

Then, should I run rails db:setup and rails assets:precompile ?

Could you give more details on how to migrate a docker instance to a standalone one?


do you wait for a moment before trying the UI?

I get “Something went wrong” right after startup before all threads get started.

I’m thinking about moving my docker installation to a standalone installation.

Is it right that I first need to follow the normal installation procedure and than follow the same steps as you gave here?

I know how to do a pg_dump, so pg_restore wouldn’t be a problem for me (I know how to do a mysql restore). But I like to lock the instance first, before I do this migration. What is the best way to do that?

What were eventually the end results of your migration?