This is the systems part of welcoming a new organization to a multi-db odoo. For them to have “their own Odoo”, we will add a new database to the Ansible inventory of the multi-db Odoo instance that will host them.
The following sections are adapted from the Merge Request template to add a new DB at processos.org
For each database change, please do:
odoo_role_odoo_dbs
domains
Don’t modify this one, it’s only informative
environment | host_vars file to modify |
domain name | root domain |
---|---|---|---|
trial | inventory/host_vars/proves.processos.org/config.yml |
example.proves.processos.org |
proves.processos.org |
prod | inventory/host_vars/processos.org/config.yml |
example.processos.org |
processos.org |
odoo-provisioning
with this inventory against trial and/or prod servers.There are 2 ways to inform odoo about the multiple dbs/instances. Method 1 only supports one word per subdomain. Method 2 can compound multiple words (i.e. test.erp.example.org).
Every DB needs to be named after the subdomain name in order for odoo to map it correctly.
e.g. prod.example.org (DB name should be prod)
test.example.org (DB name should be test)
In the config file located on odoo-example-inventory/inventory/host_vars/prod.example.org/config.yml set the variable odoo_role_enable_dbfilter_from_header: true
.
In the nginx configuration located on odoo-example-inventory/inventory/group_vars/all.yml map each domain with the equivalent DB. In this case it is not necessary the DB name to match the subdomain name.
nginx_configs:
upstream:
- |
map $http_host $odoo_dbfilter {
'prod.example.org' odoo;
'test.example.org' test;
}
upstream odoo { server 127.0.0.1:8069; }