Moving Odoo to another server

Tutorial for working server migration

There might be many reasons for changing the server - from cost-cutting to legislation (for example GDPR). It is good to plan it well ahead so the possible errors will be minimised.

The following steps might be helpful while proceeding with the operation:

1) Schedule the time of migration. It is important to migrate the server outside of the company's working hours. This will prevent data loss and will give some time for fixing the errors. In most of the businesses, this is planned for Friday afternoon/evening.

2) Set up the new server and install Odoo on it. If you have any difficulties, simply follow Odoo how to install tutorial. If you are using Amazon EC2 and just want to change the country that the server is in follow this tutorial.

3) Create a backup of the Odoo server you want to move. Go to database manager and choose "Backup". Download the backup and upload it to the new server using "Restore Database".



4) Update the DNS on the website of your domain provider. You just need to update an "A" records with the new IP (new server IP).



5) Before you switch off or terminate the old server take into account that DNS record update in some cases might be longer than 24h. You also don't want your users to use the old server as new is working. To make this operation hassle-free simply update your old Apache2/nginx server:

server {
    server_name .yourdomain.com;
    return 301 http://www.newServerAddress.com;
}

Visitors and users entering the server through your domain will be redirected to the new server. Remember that after updating nginx or Apache2 you need to restart it:

sudo /etc/init.d/apache2 restart (for Apache2)
sudo /etc/init.d/nginx restart (for nginx)

To be absolutely sure that no operations take place on the old Odoo server simply switch it off:
sudo service odoo stop

If you got an error here that means your Odoo service has a different name - to check it simply open the Odoo config file or type "ps -Al". This will list all the services running on your system.