diff --git a/odoo/content.md b/odoo/content.md index a6874fb3c..573e2eacf 100644 --- a/odoo/content.md +++ b/odoo/content.md @@ -70,6 +70,91 @@ $ docker run -p 8071:8069 --name odoo3 --link db:db -t odoo Please note that for plain use of mails and reports functionalities, when the host and container ports differ (e.g. 8070 and 8069), one has to set, in Odoo, Settings->Parameters->System Parameters (requires technical features), web.base.url to the container port (e.g. 127.0.0.1:8069). +## Environment Variables + +Tweak these environment variables to easily connect to a postgres server: + +- `HOST`: The address of the postgres server. If you used a postgres container, set to the name of the container. Defaults to `db`. +- `PORT`: The port the postgres server is listening to. Defaults to `5432`. +- `USER`: The postgres role with which Odoo will connect. If you used a postgres container, set to the same value as `POSTGRES_USER`. Defaults to `odoo`. +- `PASSWORD`: The password of the postgres role with which Odoo will connect. If you used a postgres container, set to the same value as `POSTGRES_PASSWORD`. Defaults to `odoo`. + +## Docker Compose examples + +The simplest `docker-compose.yml` file would be: + +```yml +version: '2' +services: + web: + image: odoo:10.0 + depends_on: + - db + ports: + - "8069:8069" + db: + image: postgres:9.4 + environment: + - POSTGRES_PASSWORD=odoo + - POSTGRES_USER=odoo +``` + +If the default postgres credentials does not suit you, tweak the environment variables: + +```yml +version: '2' +services: + web: + image: odoo:10.0 + depends_on: + - mydb + ports: + - "8069:8069" + environment: + - HOST=mydb + - USER=odoo + - PASSWORD=myodoo + mydb: + image: postgres:9.4 + environment: + - POSTGRES_USER=odoo + - POSTGRES_PASSWORD=myodoo +``` + +Here's a last example showing you how to mount custom addons, how to use a custom configuration file and how to use volumes for the Odoo and postgres data dir: + +```yml +version: '2' +services: + web: + image: odoo:10.0 + depends_on: + - db + ports: + - "8069:8069" + volumes: + - odoo-web-data:/var/lib/odoo + - ./config:/etc/odoo + - ./addons:/mnt/extra-addons + db: + image: postgres:9.4 + environment: + - POSTGRES_PASSWORD=odoo + - POSTGRES_USER=odoo + - PGDATA=/var/lib/postgresql/data/pgdata + volumes: + - odoo-db-data:/var/lib/postgresql/data/pgdata +volumes: + odoo-web-data: + odoo-db-data: +``` + +To start your Odoo instance, go in the directory of the `docker-compose.yml` file you created from the previous examples and type: + +```console +docker-compose up -d +``` + # How to upgrade this image Odoo images are updated on a regular basis to make them use recent releases (a new release of each version of Odoo is built [every night](http://nightly.odoo.com/)). Please be aware that what follows is about upgrading from an old release to the latest one provided of the same major version, as upgrading from a major version to another is a much more complex process requiring elaborated migration scripts (see [Odoo Enterprise Upgrade page](https://upgrade.odoo.com/database/upload) or this [community project](https://doc.therp.nl/openupgrade/) which aims to write those scripts).