Odoo Help

Welcome!

This community is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

1

How do I setup an update script for Odoo?

v8
By
Bruce Letterle
on 11/3/14, 5:15 PM 2,341 views

I am running Odoo v8 on Ubuntu 14.04. Has anyone developed an auto update script that I can run with cron to do regular updates of the software and apps/modules?

1
Daniel Kauffman
On 11/3/14, 6:06 PM

I would not recommend doing automatic updates on a production database.

However, for performing scheduled updates or for spinning up new servers, the following configuration may be useful:

  1. Configure a production server running Debian stable plus nginx-light, odoo, postgresql, and any other dependencies, for example, cups and python-cups for printing.
  2. Configure a build server running Debian stable plus git and bzr.  ($5 server from Digital Ocean works for me.)
  3. On the build server, use git and bzr to download sources for Odoo to an Odoo repository and for various community modules to their respective repositories. See script below.
  4. On the build server, configure ~/.ssh/config to allow easy connections to your production server.  Alternatively, configure this on your production server to allow easy connections to your build server.  In either case, also configure ~/.ssh/authorized_keys on the opposite end of the connection.
  5. On the build server, use a script to rsync the Odoo sources and community module sources to your production server. Alternatively, run rsync from your production server to pull from your build server.
  6. Restart the Odoo server. Either start the server using --update=all or upgrade the modules manually from the web interface.

Here are the scripts:

# Initialize repositories on build server.

git clone https://github.com/odoo/odoo.git
cd odoo
git checkout 7.0
cd ..
bzr checkout lp:~ruchir.shukla/+junk/misc_modules_7.0 BizzAppDev

# Update repositories on build server.
cd odoo
git pull
cd ..
bzr update BizzAppDev

# Synchronize to production server oodo.example.com.
rsync --archive --delete --rsh ssh odoo/openerp root@odoo.example.com:/opt/odoo/odoo-server/
rsync --archive --delete --rsh ssh odoo/openerp-server root@odoo.example.com:/opt/odoo/odoo-server/
rsync --archive --delete --rsh ssh odoo/addons/* root@odoo.example.com:/opt/odoo/odoo-addons/official/
rsync --archive --delete --rsh ssh BizzAppDev/oerp_no_phoning_home root@odoo.example.com:/opt/odoo/odoo-addons/community/
rsync --archive --delete --rsh ssh local/my_local_module root@odoo.example.com:/opt/odoo/odoo-addons/local/

# Restart the Odoo server. Either configure the init script to use --update=all or upgrade the modules manually from the web interface.
ssh root@odoo.example.com service odoo restart

A few additional notes:

  • The scripts are for Odoo 7 so some minor adjustments would be necessary for Odoo 8.
  • The rsync commands require odoo.conf addons_path to be configured accordingly: addons_path = /opt/odoo/odoo-addons/official,/opt/odoo/odoo-addons/community,/opt/odoo/odoo-addons/local
  • Python oerplib can be very helpful for setting up new databases.  This can be scripted and run from your build server.

Besides updating the sources, aren't there other steps to update the database? I saw somewhere in the docs that you also have to restart the odoo server with --update=all

Bruce Letterle
on 11/12/14, 8:39 AM

You are correct, the modules would still need to be upgraded. I use the above process mostly during development, so I typically upgrade my local modules manually using the web interface, so that I can see any errors. But if you were not developing a module, using --update=all when restarting the Odoo server would definitely be easier.

Daniel Kauffman
on 11/12/14, 3:06 PM

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)

Stats

Asked: 11/3/14, 5:15 PM
Seen: 2341 times
Last updated: 3/16/15, 8:10 AM