From bec074cf640b04f63cfee2ec1082b652e80c3dcf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20-=20Le=20Filament?= <remi@le-filament.com> Date: Mon, 17 Oct 2022 10:19:47 +0200 Subject: [PATCH] [ADD] module_change_auto_install --- README.md | 20 ++++++++++++++++++++ defaults/main.yml | 3 +++ templates/odoo.conf.j2 | 3 +++ templates/prod.yaml.j2 | 8 +++++--- templates/test.yaml.j2 | 5 +++-- 5 files changed, 34 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 5ae8c79..f7751fb 100644 --- a/README.md +++ b/README.md @@ -170,11 +170,31 @@ odoo_nonprod_instances_example: # To be renamed odoo_nonprod_instances - account_bank_statement_import_ofx extra_urls: - "docs-test.example.org" + ## OPTIONAL parameters for deploying another app (for instance a JS app) # extra_app: # - name: odootest_app # - image: nginx:latest # - url: app-test.example.org + + ## OPTIONAL - Allow access to Odoo DB from outside world + odoo_remote_db_access: false + + ## OPTIONAL - Extra commands to be added in Dockerfile building Odoo image + # odoo_specific_dockerfile_commands: [] + ## OPTIONAL - Extra host to be defined in Odoo docker /etc/hosts for local access and prevent DNS resolution + # odoo_extra_host: "docs.example.org:172.17.0.1" + ## OPTIONAL - update performance limits for Odoo (see https://www.odoo.com/documentation/14.0/developer/reference/cmdline.html) + # odoo_db_maxconn: 64 + # odoo_limit_time_cpu: 300 + # odoo_limit_time_real: 600 + ## OPTIONAL - Extra variables to be added in odoo.conf + # odoo_server_wide_modules: "queue_job" + # odoo_modules_auto_install_disabled: "stock_sms" + # odoo_modules_auto_install_enabled: "mail_tracking" + # odoo_extra_conf: "log_level = debug" + ## OPTIONAL - update performance limits for Odoo (see https://www.odoo.com/documentation/14.0/developer/reference/cmdline.html) + # postgres_options: "-c max_connections=100" ``` Also backups are designed to be performed only on prod instances, backups can however be restored on every non prod instance. diff --git a/defaults/main.yml b/defaults/main.yml index 7a72632..d9b7fce 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -97,6 +97,9 @@ odoo_remote_db_access: false # odoo_limit_time_cpu: 300 # odoo_limit_time_real: 600 ## OPTIONAL - Extra variables to be added in odoo.conf +# odoo_server_wide_modules: "queue_job" +# odoo_modules_auto_install_disabled: "stock_sms" +# odoo_modules_auto_install_enabled: "mail_tracking" # odoo_extra_conf: "log_level = debug" ## OPTIONAL - update performance limits for Odoo (see https://www.odoo.com/documentation/14.0/developer/reference/cmdline.html) # postgres_options: "-c max_connections=100" diff --git a/templates/odoo.conf.j2 b/templates/odoo.conf.j2 index ee0b26f..f641eff 100644 --- a/templates/odoo.conf.j2 +++ b/templates/odoo.conf.j2 @@ -31,9 +31,12 @@ limit_time_real = {{ odoo_limit_time_real | default(600) }} ; logfile = None ; longpolling_port = 8072 ; max_cron_threads = 2 +modules_auto_install_disabled = account_edi,mail_bot,web_unsplash{% if odoo_modules_auto_install_disabled is defined %},{{ odoo_modules_auto_install_disabled }}{% endif %} +modules_auto_install_enabled = account_move_name_sequence,account_reconcile_show_boolean,account_reconciliation_widget,disable_odoo_online,mail_debrand,partner_disable_gravatar,partner_firstname,password_security,remove_login_links,remove_odoo_enterprise,web_responsive,web_no_bubble{% if odoo_modules_auto_install_enabled is defined %},{{ odoo_modules_auto_install_enabled }}{% endif %} ; osv_memory_age_limit = 1.0 ; osv_memory_count_limit = False proxy_mode = True +server_wide_modules = web,module_change_auto_install{% if odoo_server_wide_modules is defined %},{{ odoo_server_wide_modules }}{% endif %} ; smtp_password = False {% if mailname is defined %} ; smtp_port = 25 diff --git a/templates/prod.yaml.j2 b/templates/prod.yaml.j2 index 1d031c7..3ca6bb0 100644 --- a/templates/prod.yaml.j2 +++ b/templates/prod.yaml.j2 @@ -97,6 +97,7 @@ services: MAIL_CANONICAL_DOMAINS: "{{ mailname }}" MAIL_NON_CANONICAL_DEFAULT: "{{ mailname }}" restart: unless-stopped + {% if restrict_internet_access %} {% if imap_mailserver is defined %} email_imap: @@ -131,6 +132,7 @@ services: TARGET: "{{ mailserver }}" PRE_RESOLVE: 1 restart: unless-stopped + {% endif %} {% else %} image: mailhog/mailhog @@ -138,10 +140,10 @@ services: restart: unless-stopped labels: co.elastic.logs/enabled: "false" + {% endif %} {% if restrict_internet_access and odoo_prod.extra_urls is defined %} {% for server in odoo_prod.extra_urls %} - {{ server.url }}: image: tecnativa/whitelist container_name: odoo_{{ server.url }} @@ -157,10 +159,10 @@ services: TARGET: "{{ server.url }}" PRE_RESOLVE: 1 restart: unless-stopped + {% endfor %} {% endif %} {% if metabase %} - metabase: image: metabase/metabase container_name: odoo_metabase @@ -181,9 +183,9 @@ services: restart: unless-stopped volumes: - metabase:/metabase-data:z + {% endif %} {% if odoo_prod.extra_app is defined %} - app: image: {{ odoo_prod.extra_app.image }} container_name: {{ odoo_prod.extra_app.name }} diff --git a/templates/test.yaml.j2 b/templates/test.yaml.j2 index 8f17639..3152681 100644 --- a/templates/test.yaml.j2 +++ b/templates/test.yaml.j2 @@ -92,9 +92,9 @@ services: traefik.http.routers.{{ item.dir }}smtp.rule: "Host(`{{ item.url }}`) && PathPrefix(`/smtp/`)" traefik.http.routers.{{ item.dir }}smtp.service: "{{ item.dir }}smtp" traefik.http.services.{{ item.dir }}smtp.loadbalancer.server.port: "8025" + {% if restrict_internet_access and item.extra_urls is defined %} {% for url in item.extra_urls %} - {{ url }}: image: tecnativa/whitelist container_name: {{ item.dir }}_{{ url }} @@ -110,10 +110,10 @@ services: TARGET: "{{ url }}" PRE_RESOLVE: 1 restart: unless-stopped + {% endfor %} {% endif %} {% if item.extra_app is defined %} - app: image: {{ item.extra_app.image }} container_name: {{ item.extra_app.name }} @@ -127,6 +127,7 @@ services: traefik.http.routers.{{ item.extra_app.name | lower | regex_replace('_','') }}.rule: "Host(`{{ item.extra_app.url }}`)" traefik.http.routers.{{ item.extra_app.name | lower | regex_replace('_','') }}.service: "{{ item.extra_app.name | lower | regex_replace('_','') }}" traefik.http.services.{{ item.extra_app.name | lower | regex_replace('_','') }}.loadbalancer.server.port: "80" + {% endif %} networks: -- GitLab