From 29360f1ec3c3b0d2c1d85b8c2a1f0f49b83ce044 Mon Sep 17 00:00:00 2001 From: "Jorge E. Gomez" Date: Fri, 18 Dec 2020 21:57:49 -0500 Subject: [PATCH 1/2] FIX Postgresql user must not be superuser --- roles/odoo/tasks/setup-postgresql.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/roles/odoo/tasks/setup-postgresql.yml b/roles/odoo/tasks/setup-postgresql.yml index ddddac2..7fef545 100644 --- a/roles/odoo/tasks/setup-postgresql.yml +++ b/roles/odoo/tasks/setup-postgresql.yml @@ -6,7 +6,7 @@ become_user: postgres postgresql_user: name: '{{ item }}' - role_attr_flags: SUPERUSER + role_attr_flags: 'NOCREATEDB' loop: - odoo - agofer From 997ed2b86ef4bc5a9c3972be5eb494657df7ef2a Mon Sep 17 00:00:00 2001 From: "Jorge E. Gomez" Date: Fri, 18 Dec 2020 22:00:39 -0500 Subject: [PATCH 2/2] Unify ports and file location --- roles/odoo/files/nginx.conf | 12 ++++++------ roles/odoo/files/systemd_unit | 2 +- roles/odoo/tasks/main.yml | 11 ++++++++--- roles/odoo/templates/odoo.conf.j2 | 2 +- roles/odoo/vars/main/vault.yml | 13 +++++++------ 5 files changed, 23 insertions(+), 17 deletions(-) diff --git a/roles/odoo/files/nginx.conf b/roles/odoo/files/nginx.conf index 7570f4f..c54094b 100644 --- a/roles/odoo/files/nginx.conf +++ b/roles/odoo/files/nginx.conf @@ -1,8 +1,8 @@ -upstream odoo8 { +upstream odoo { server 127.0.0.1:8090 weight=1 fail_timeout=0; } -upstream odoo8-im { +upstream odoo-im { server 127.0.0.1:8082 weight=1 fail_timeout=0; } @@ -49,11 +49,11 @@ server { } location / { - proxy_pass http://odoo8; + proxy_pass http://odoo; } location /longpolling { - proxy_pass http://odoo8-im; + proxy_pass http://odoo-im; } # Cache some static data in memory for 2 hours. @@ -62,12 +62,12 @@ server { proxy_cache_valid 200 120m; proxy_buffering on; expires 864000; - proxy_pass http://odoo8; + proxy_pass http://odoo; } location /website/static/ { proxy_cache_valid 200 120m; proxy_buffering on; expires 864000; - proxy_pass http://odoo8; + proxy_pass http://odoo; } } diff --git a/roles/odoo/files/systemd_unit b/roles/odoo/files/systemd_unit index fcae4a7..40c3347 100644 --- a/roles/odoo/files/systemd_unit +++ b/roles/odoo/files/systemd_unit @@ -9,7 +9,7 @@ SyslogIdentifier=odoo PermissionsStartOnly=true User=odoo Group=odoo -ExecStart=/home/odoo/.venv/odoo/bin/python /opt/odoo/odoo/odoo-bin -c /etc/odoo/odoo.conf +ExecStart=/home/odoo/.venv/odoo/bin/python /opt/odoo/core/odoo-bin -c /etc/odoo/odoo.conf StandardOutput=journal+console [Install] diff --git a/roles/odoo/tasks/main.yml b/roles/odoo/tasks/main.yml index 3fee66b..0c9434a 100644 --- a/roles/odoo/tasks/main.yml +++ b/roles/odoo/tasks/main.yml @@ -18,7 +18,7 @@ owner: odoo loop: - /var/log/odoo - - /opt + - /opt/odoo - /home/odoo/.local/share/Odoo/filestore/agofer - /home/odoo/src - /etc/odoo @@ -32,14 +32,19 @@ - name: Clone current Odoo code git: repo: '{{ sourcecode_location }}' - dest: /opt + dest: /opt/odoo depth: 1 - name: Install python requirements for Odoo pip: virtualenv: /home/odoo/.venv/odoo virtualenv_command: python3.8 -m venv - requirements: /opt/odoo/odoo/requirements.txt + requirements: /opt/odoo/core/requirements.txt + + # Possible errors in gevent module with Ubuntu 20.04 + # (chat, stars, don't update interactively on screen) + # $ pip install --upgrade gevent + # Successfully installed gevent-20.9.0 greenlet-0.4.17 ... - name: Download and install wkhtmltopdf apt: diff --git a/roles/odoo/templates/odoo.conf.j2 b/roles/odoo/templates/odoo.conf.j2 index b95dce3..7a1fac8 100644 --- a/roles/odoo/templates/odoo.conf.j2 +++ b/roles/odoo/templates/odoo.conf.j2 @@ -19,7 +19,7 @@ unaccent = True # Registro #----------------------------------------------------------------------------- # syslog = True -logfile = /var/log/odoo/odoo-server.log +logfile = /var/log/odoo/odoo.log logrotate = False # ['debug_rpc_answer', 'debug_rpc', 'debug', 'debug_sql', # 'info', 'warn', 'error', 'critical'] diff --git a/roles/odoo/vars/main/vault.yml b/roles/odoo/vars/main/vault.yml index 782c08c..f791eed 100644 --- a/roles/odoo/vars/main/vault.yml +++ b/roles/odoo/vars/main/vault.yml @@ -1,7 +1,8 @@ $ANSIBLE_VAULT;1.1;AES256 -66653830636139353764356363313765383435316164373665356537623563333165646530656130 -6366303863663861623161303639376639323639303633610a393234663539353130653438313433 -64306536383230636331646239313535346135353762383139656162316636393537373139643562 -3034376331353462340a313735323765656562343263313137613630646538653931643730353264 -33383561326633613231363634613839303462373431313130653431656437633861636461393635 -3137386137643535396333636337356631633734383162336333 +64343734356562396165383863386635313362353930306436373531383566333030356138636231 +3035393066663033636331663030353937333230356334630a613362343232386635383539333333 +62356664643235666237633366653561623439326637333730393239656238386432663162633634 +3262616235623566390a653130363334633263373135356564653333646231373830656262373532 +38396232363362663735343038333337666337656438633333643832363366333631663339373465 +61663165616337623964313530373838633133636539343438386338343639333739616633353163 +643663363037653561316437303534346433