I migrated to a new VPS today and thought I’d share my experiences as it looks like quite a few people are running in to the old-version operating system blocker on their updates lately
I’m on Digital Ocean, so I created a new droplet.
Old vps = Ubuntu Server 18.04.6 LTS
New vps = Ubuntu Server 23.10
I did the usual housekeeping on the new vps - please edit to suit yourself:
Apt-get update
Apt-get upgrade
Apt-get install fail2ban
ufw default deny incoming
ufw default allow outgoing
ufw allow ssh
ufw allow http
ufw allow https
ufw enable
I then created a new empty directory for Discourse:
sudo mkdir -p /var/discourse
Then I installed Docker:
wget -qO- https://get.docker.com/ | sh
Then I changed the TTL on my DNS from 30mins to 10mins (the minimum GoDaddy allows).
On my old server, I downloaded a local copy of last nights Discourse database backup (you can never have enough local backups). I also downloaded a copy of app.yml
to my local pc too.
As suggested by a few people above, I did a “root-to-root” rsync. I used the IP address rather than the hostname, so I could avoid any DNS confusion. Also as suggested above, I used -avz
switches:
rsync -avz root@old.ip.address.here:/var/discourse /var
For reference, my discourse folder is 25GB.
It took ~25mins to rsync from the old server to the new server. This was simply between two Digital Ocean droplets in the same LON1 region. Your experiences may differ.
After rsync’ing and trying a rebuild, I hit the same error that @piratdavid hit re postgres database system is shut down
.
So I then stopped the app on the old vps:
./launcher stop app
And did another rsync, for just the changes this time:
rsync -avz --delete root@old.ip.address.here:/var/discourse /var
Then I started the old Discourse app again and very quickly put it in Maintenance Mode - this is so people can still get to it and will see the usual maintenance warning message.
This also now buys me some time to work on the new vps
I updated my HOSTS file on my local pc so I could get to the discourse on the new vps without browser warnings / issues.
On the new vps I then ran:
./discourse-setup
This was so it could update the ram and cpu settings in the app.yml
file automatically.
I then did an app rebuild on the new vps:
./launcher rebuild app
Did some smoke tests, all good.
DNS updated - job done.
Thanks for the detailed topic, everyone