- Odoo 11 Development Cookbook(Second Edition)
- Holger Brunn Alexandre Fayolle
- 215字
- 2021-06-25 22:48:38
Freezing a buildout
To ease deployment, it is possible to use some advanced commands. The freeze-to option can be used to generate a buildout configuration file that freezes the revisions of Odoo and all the addons:
$ bin/buildout -c prod.cfg -o odoo:freeze-to=frozen-prod.cfg
You can then run buildout with the frozen-prod.cfg file to get the exact same versions of the files.
You can also extract the source code to a separate directory, with the extract-downloads-to option:
$ bin/buildout -c frozen-prod.cfg \ -o odoo:extract-downloads-to=../production
The directory production now contains a release.cfg file, and a parts/ directory with the source code (but not the git history). If the target server is running the same version of Linux as the server you are working on, you can deploy the production environment without compiling any dependency by performing the following steps:
- Copy the required file to the production/ directory:
$ cp -r develop-eggs eggs buildout.cfg prod.cfg bootstrap.py \ ../production
- Make an archive of that:
$ cd .. $ tar cjf production-1.0.tar.bz2
- Copy that archive on the production server using a suitable procedure (USB key or rsync, for instance).
- On the production server, unpack the archive and install the version with the following:
$ tar xf production-1.0.tar.bz2 $ cd production $ virtualenv sandbox --no-setuptools $ sandbox/bin/python bootstrap.py $ bin/buildout -c release.cfg