Skip to main content

Manual Odoo Migration from One Server to Another



Today, we will go through a step-by-step process to move running odoo from one server to another server

Note: I assume odoo is already installed and working fine with demo/test DB.




Before migrating your Odoo application from one server to another server, it's important to take all the precautionary measures and backup all the data - Database, Code, and Files. Let's start:


I - Backup

Step-1. Database Backup 

You can use Odoo Database Manager - /web/database/manager link to perform this activity. But if the database is too big, please use pg_dump command from PostgreSQL. Here is the example:

pg_dump -W -F t odoo13 > ~/odoo13_28062021.tar

Note: Make sure that you are logged in as postgres or odoo user to perform this activity.


Step-2. Backup of custom modules

The next step is to take a backup of all of your custom code. Mostly, It will be in your /odoo/custom/ and /odoo/enterprise/ directories.

You can use scp command to directly copy your directories from one server to another server. Let's say both of your machines are Linux ones, then these commands can help you.

scp -r(for recursive directories) <source> <destination>

scp -r /odoo/custom/ odoo@x.x.x.x.com:/odoo/


Step-3. Backup of your attachments/images

The last step is to take a backup of your application attachments - order attachments, images attached to tickets, website and product images, etc. You can find the filestore at this location: 

/odoo/.local/share/Odoo/filestore/

You can copy these files also directly to the new server.


II - Restore

Step-1. Restore Database 

You can use Odoo Database Manager - /web/database/manager link to perform this activity. But if the database is too big, please use pg_restore command from PostgreSQL. Here is the command:

pg_restore -v --dbname=odoo13 odoo13_28062021.tar

Note: Make sure that you are logged in as postgres or odoo user to perform this activity and database is already created with name.


Step-2. Restoring custom modules

We have already copied these files in step-2 of the Backup section activity. If not done, please use the scp command to copy files at the new server location.

Note: Make sure that odoo is the owner of all these files. You can use this command to change ownership of the directory and subdirectory.

chown -R odoo:odoo /odoo/custom/


Step-3. Restore filestore

We have already copied these files in step-3 of the Backup section activity. If not done, please use the scp command to copy files at the new server location.


III - Reload Odoo

Once all data - Database, custom modules, and filestore is restored on the new server, the next step is to start odoo with the latest data. I would suggest doing it using the shell/command line if you are a developer.

Step-1. Stop all odoo services

ps ax | grep odoo-bin | awk '{print $1}' | xargs kill -9 $1

Step-2. Start odoo services.

python3 /odoo/odoo-server/odoo-bin -c /etc/odoo-server.conf -d odoo13 -u all

Once all the modules are updated successfully, you can just stop the odoo services using step-1 command and start it using.

sudo service odoo-server start

Step-3. Reload assets - log in as admin and reload assets

I hope everything went well as expected. If your UI is distorted, there is a possibility that fingerprints generated for js and css files are not the same as in filestore. To fix it we have to reload assets.

HTTP://x.x.x.x:8069/web?debug=assets



I hope this POST will help someone, someday and save his/her day!


Thanks!! Enjoy Programming :)

Comments

Popular posts from this blog

How to draw Dynamic Line or Timeseries Chart in Java using jfreechart library?

Today we are going to write a code to draw a dynamic timeseries-cum-line chart in java.   The only difference between simple and dynamic chart is that a dynamic event is used to create a new series and update the graph. In out example we are using timer which automatically calls a funtion after every 1/4 th second and graph is updated with random data. Let's try with the code : Note : I had tried my best to provide complete documentation along with code. If at any time anyone have any doubt or question please post in comments section. DynamicLineAndTimeSeriesChart.java import java.awt.BorderLayout; import java.awt.Color; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.Timer; import javax.swing.JPanel; import org.jfree.chart.ChartFactory; import org.jfree.chart.ChartPanel; import org.jfree.chart.JFreeChart; import org.jfree.chart.axis.ValueAxis; import org.jfree.chart.plot.XYPlot; import...

Flickr and OAuth

What is Flickr? I think you landed on this page because you know what Flickr is, so let’s come to the point and discuss about the API. Why am explaining? Although each and everything, about API, is well documented on Flickr website here , I'm just trying to explain the whole process by dividing it into small parts. Old Authentication API The current Flickr authorization scheme is not the first one it used. In the early days of Flickr, users granted the power to an app to act on their behalf by giving  the apps their Flickr username and password. Doing so meant that in order to revoke  an app’s permission, users would have to change their Flickr password. Of course, doing that would also instantly revoke permissions of other third-­party apps with knowledge of the user’s password. The new authorization scheme is meant to correct obvious problems with the old scheme. Why should you as a user have to use your Flickr password for anything other than your dealings with Fli...

phpExcelReader uses and problems?

If you will search over internet about excel reader in PHP at the end you would be redirected to the following this link only. It’s well written code but there are also some problems in that. Some documentation is missing. In this post we are going to discuss how to use phpExcelReader and which type of problems you could face. Download :  1) You can download the original library from here . 2) Mine one(with bug fixes) is available here . Go there, Click on File menu then download it. How to use : 1)  In the package itself example2.php is a very good example of using excel reader. 2)  Beginners can have a look at following example <?php             ini_set("display_errors",1);             error_reporting(E_ALL ^ E_NOTICE);             require_once 'phpExcelReader/...