Community mailing list archives

Re: Dev Advice

DevCO Colombia , David Arnold
- 06/14/2016 13:47:47
I need to update myself, this approach does not work as expected while creating from a template the attachments in the filestore are not copied properly and there are tracebacks breaking the frontend - damn.
Traceback (most recent call last):
  File "/home/src/o9/openerp/addons/base/ir/", line 105, in _file_read
    r = open(full_path,'rb').read().encode('base64')
IOError: [Errno 2] No such file or directory: u'/var/lib/odoo/filestore/feat_nomail/6e/6e6176e1e7e0cba500162db03dae1eaca6d2e9ee'

El mar., 14 jun. 2016 a las 12:38, David Arnold (<>) escribió:
Hi all,

I followed all your advices! I'm grateful for your answers and this small compilation of best practices. Now I can feed back a learning I had, which I think can be improved in upstream, possibly.

As interacting directly with the database is cumbersome (I have abstracted away as much as possible, it's in a separate docker I barely touch and don;t want to touch), I used the template approach like this in the entrypoint script, which now looks like this, I then put the environment variables in docker-compose.override.yml (have a look at the docker docs in case you didn't know about this special meaning file!), which is not under version control to keep those settings locally scoped:

OPTS="${OPTS} --db_host db"
OPTS="${OPTS} --debug"
OPTS="${OPTS} --dev"
OPTS="${OPTS} --db-filter ${DB_FILTER}"
OPTS="${OPTS} --data-dir /var/lib/odoo"
OPTS="${OPTS} --addons-path $SRCFOLDER/o9/addons,$SRCFOLDER/devco,$SRCFOLDER/access-addons,$EXTRAFOLDER"
OPTS="${OPTS} --log-handler ${LOGHANDLER}"
OPTS="${OPTS} --db-template ${DB_TEMPLATE}"

Now, when I use a pre-seeded Database as template and want to create a new one, the logs show that there is a problem initializing base as apparently when creating a database odoo tries to initialize base regardless of respecting weather it's already installed in the template. Remember, that I cannot just copy the templates as I have purposefully filtered them away to make sure I never touch them and they don't clutter my workflow and I don't want to interact directly on the db docker as this means yet another console window. I assume that this initialization is not a big deal as it just fails softly, but I would argue that database creation could possibly respect this use case of the template flag.

What do you think? Shouldn't db creation respect template flag or is there actually no need/reason for this?

Best -i all

El lun., 13 jun. 2016 a las 17:22, David Arnold (<>) escribió:
Hi Jos, thanks! Seems like a nice idea indeed, too!
Jos De Graeve <> schrieb am Mo., 13. Juni 2016 um 12:57:
Hi David,

On a test machine, you can change your postgresql config to get some 10% a 20% speed improvements, at the cost of reliability -- so do not do this on a production machine --

in postgresql.conf

change "#fsync = on" to  'fsync = off'
change "#synchronous_commit = on" to 'synchronous_commit = off'


Jos De Graeve - Apertoso business ICT

Guido Gezellelaan 16 - B-9800 Deinze - Belgium
Direct: +32 9 381 64 51
General:+32 9 381 64 50
Mobile: +32 475 54 68 80
mail/im/skype: - apertoso

2016-06-10 14:17 GMT+02:00 David Arnold <>:

Nhomar, Cody, Holger, thanks! I see now! Good idea!! Best

Cody Kitterman <> schrieb am Do., 9. Juni 2016 um 23:07:

Thanks again for responding to the github ping... He's saying you can create several roles and use them in conjunction with several config files: create the roles, use a different one in each config file, and either point to a different template or don't...
$ sudo su - postgres
-bash-4.3$ pg_ctl -D /db_directory start
-bash-4.3$ psql
postgres=# \du
postgres=# \du
                             List of roles
Role name | Attributes | Member of
postgres | Superuser, Create role, Create DB, Replication | {}
tester_a | Create role, Create DB | {}
tester_b | Create role, Create DB | {}
postgres=# \q
:: Configuration file #1 ::
db_user = tester_a
db_password = tesser
db_template = template1

:: Configuration file #2 ::
db_user = tester_b
db_password = tesser
db_template = template1


:: Configuration file #5 ::
db_user = tester_e
db_password = tesser
db_template = some_template_you_come_up with

(Maybe you want to include PL/Python in this template)


It's what I've been doing and so I'll second the advice.

Cody K.

On Thursday, June 9, 2016, Nhomar Hernandez <> wrote:

On Thu, Jun 9, 2016 at 8:51 PM, David Arnold <> wrote:
Holger, thanks, didn't know about db filters regex capas! Even better!! What did you mean by virtual users? I think I didn't understand you.. Thanks!

About users:

Create a user in postgres by env/topic, then use it then odoo will see only BD's properly contextualized.

Nhomar Hernandez
CEO Vauxoo.
Twitter: @nhomar
Odoo Gold Partner
Skype: nhomar00 (Envia mail previo no lo superviso siempre).
Móvil Venezuela:
+58 4144110269
Móvil México:
+52 1 4773933942

Post to:

Post to:

Post to:

Post to: