Moving pod to a different server

(David Thiery) #1

We’re wanting to move our pod to a different server for a number of reasons (get it out of the US, get rid of anything bitnami related, and move from centos to ubuntu). I think it should be pretty simple to do but wanted to check with someone with more diaspora experience than me :slight_smile:

I was planning on getting a new installation of diaspora up and running on the new server and testing that first to make sure it works. What I’m not sure about are the ssl certs. I’d like to test that they work too. I have another domain I can use to test and can get new certs for that from let’s encrypt but once I’m ready to move the pod can I just copy over the existing certs from the pod? Also, I’d like to do a test run of copying over the pod db and making sure that works but am worried I’ll break something by doing so, especially since I won’t update the dns until I make the actual move. Oh, and I was thinking of using rsync to copy over the uploads and keep them updated until the move unless someone has a better suggestion for that. We have over 25gb there and that’ll take a while to copy.

Pods ignoring other pods
(goob) #2

It’s definitely possible to do this without major problem, even with large pods. But a very good idea to get support first. I can’t help, but others will. Good luck!

(Flaburgan) #3

Rsync to copy data looks like a good idea to me :wink: do you want to switch from mysql to pgsql in the same time? I guess the easiest way to migrate the db will be a dump so it’s look like the good occasion to do so.

(Benjamin Neff) #4

You can test the new installation, but keep in mind, the domain is coupled to the database, so don’t run your existing domain on a empty database (don’t create any users) and don’t run your existing database with a new domain (for the domain, the url in the diaspora.yml is relevant).

So my suggestion is (what I did every time I moved my pod to a new server), copy everything to the new server:

  • database
  • public/uploads
  • configs:
    • config/diaspora.yml
    • config/database.yml (or create that new with the new database config)
    • config/initializers/secret_token.rb
    • config/oidc_key.pem
  • certs from the old server

Setup a new pod with the guide in the wiki, but skip the db:create db:migrate part use your existing database instead, then start everything and test if it runs. You can access the new server by adding an entry to your local /etc/hosts with your domain and the new IP address. You should be able to login (or already be logged in, because you copied the secret_token.rb), and see all posts.

Don’t let your new pod running, because if sidekiq is running at 0:00 UTC it will send birthday notification mails, and your users will receive them twice, from old and new pod. So just stop your new pod, until you do the final move, then shut down your old pod, do a final sync of database and uploads, start new pod, change DNS (lower your TTL before the move), and everything should be fine :slight_smile:

(David Thiery) #5

do you want to switch from mysql to pgsql in the same time? I guess the easiest way to migrate the db will be a dump so it’s look like the good occasion to do so.

I thought about doing that at the same time but I think I’d rather keep that separate. I want to keep this server move as simple as possible so there’s less chance of me screwing something up :wink:

supertux88, that almost sounds too easy :slight_smile: I didn’t even think of changing my local host to test it all!

I seem to remember seeing how to get diaspora to run as a service on Ubuntu/Debian somewhere. What’s involved in doing that?

(Benjamin Neff) #6

You can find the guide for ubuntu here.

(David Thiery) #7

Ok, I’m moving from apache to nginx. Where do I put the certs for nginx? Also, I saw the script. Since I didn’t use that to create the certs, is it possible to use that to automatically renew them?

(David Thiery) #8

I finished getting everything setup but when I try to test I just get the generic welcome to nginx screen (without ssl so something wrong with certs too). I setup my nginx.conf like shown here but I’m guessing I missed something.