This question has been flagged
1 Reply
10465 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?

Avatar
Discard
Best Answer

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.
Avatar
Discard
Author

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

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.