# How to migrate Discourse from one server to another with the same DNS name

**URL:** <https://meta.discourse.org/t/how-to-migrate-discourse-from-one-server-to-another-with-the-same-dns-name/175572>\
**Category:** Self-hosting\
**Created:** [January 9, 2021, 5:03am UTC](https://meta.discourse.org/t/how-to-migrate-discourse-from-one-server-to-another-with-the-same-dns-name/175572 "2021-01-09T05:03:08Z")\
**Posts on this page:** 1\
**Showing post:** 11

<div class="post-metadata">

**Author:** ![kenkendk](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/kenkendk/32/117947_2.png) [@kenkendk](https://meta.discourse.org/u/kenkendk)\
**Post date:** [April 12, 2024, 10:12am UTC](https://meta.discourse.org/t/how-to-migrate-discourse-from-one-server-to-another-with-the-same-dns-name/175572/11 "2024-04-12T10:12:20Z")

</div>

Thanks for the detailed steps, I just had to do something similar, moving to a new host.  
Since the site was working, I did not like to go through the backups, so I followed the steps here.

It almost worked but the rebuild on the new host failed.  
It turns out the UID/GID mapping was not entirely the same on the two hosts, so when starting Postgres would break due to incorrect ownership of the data folder.

This is something that can happen in other instances as well, [but fortunately a fix is available](https://meta.discourse.org/t/postgresql-13-update-from-postgresql-10-fails/192865/10).

There is one extra detail for the scenario in this post, which is that the container is not built, so `./launcher enter app` does not work at this stage. As the rebuild would go on for quite some time, I was able to use `docker ps` to get the name of the container doing the build, and then entering the container:

```plaintext
docker exec -it <container_name> bash
chown -R postgres:postgres /shared/postgres_*

```

The rebuild then fails (or you cant CTRL+C stop it). After it has stopped, simply run it again, and the permissions are fixed:

```plaintext
./launcher rebuild app

```

And it is running again 😅 .

---

_[View the full topic](https://meta.discourse.org/t/how-to-migrate-discourse-from-one-server-to-another-with-the-same-dns-name/175572)._
