-1

First of all please forgive me if this question is off the topic. I have a developed social networking site where users can upload photos and update status. I thought of hosting in AWS EC2, but to get started it required a credit card which I don't have yet. So I am planning to host my site in a different hosting provider, Digital Ocean, and I am having some doubts. Suppose later if I had to host my site in AWS, what will I have to go through? I am newbie here, this will be my first time hosting in production so a bit curious before I jump to something which I don't know. And if it helps, I am using Django and PostgreSQL for it. Any help or guidance will be greatly appreciated. Thank you!

MadHatter
  • 78,442
  • 20
  • 178
  • 229
Robin
  • 109
  • 3
  • We know NOTHING of how your site is set up. We know NOTHING of your software. There is no way ***WE*** can reasonably tell ***YOU*** what you would "have to go through" when migrating between hosts. ***YOU*** need to do an assessment of your site and determine what would be required to accomplish such a migration... – voretaq7 Jan 15 '14 at 17:45

1 Answers1

1

Migrating a non-interactive site from provider to provider is easy:

  1. Deploy code to new provider.
  2. Sync data to new provder.
  3. Change DNS to point at new provider.

Migrating an interactive site such as a social networking site has to be done differently or else you will end up with some people posting data to the new provider and some still hitting the old provider as DNS caches expire at different times.

I have had success setting up a proxy server (HAProxy in this case) in the old provider and having it proxy all requests to the new provider. There was some necessary downtime while the proxy server was put in place and the final data sync took place but with the appropriate preparation this was limited to a few minutes.

The appropriate preparation was to use rsync for all the static files such as images, mp3, videos, etc and to set up MySQL replication (PostGreSQL can do replication too) between the data centres over an SSH tunnel. When it was time to migrate, we checked that the MySQL replication was up to date (the slave in the new provider was rarely more than a second behind the master in the old provider) and ran rsync again.

The extra latency for the users who were still hitting the proxy server in the old provider was about half a second. This will vary depending on the two providers you choose.

We also lowered the TTL on the DNS records to 900 a day in advance of the change so that people should have only be hitting the proxy server for 15 minutes. In practice, this was true for most people but expect to see some traffic there for several weeks after the DNS change.

Ladadadada
  • 25,847
  • 7
  • 57
  • 90