From 5fc7bf20c30f9949d1ace716059a9662af91c605 Mon Sep 17 00:00:00 2001 From: Fabien Bourgeois Date: Sun, 20 Nov 2016 20:41:17 +0100 Subject: [PATCH] [IMP][FIX]Better multiprocess and longpolling handling for dev dev, on demand --- odoo/base.yml | 2 ++ odoo/dev.yml | 12 ++++++++++++ odoo/nginx/Dockerfile.dev | 8 ++++++++ odoo/nginx/odoo.conf.dev | 29 +++++++++++++++++++++++++++++ odoo/odoo/genconf.sh | 2 ++ 5 files changed, 53 insertions(+) create mode 100644 odoo/nginx/Dockerfile.dev create mode 100644 odoo/nginx/odoo.conf.dev diff --git a/odoo/base.yml b/odoo/base.yml index 596d406..be15914 100644 --- a/odoo/base.yml +++ b/odoo/base.yml @@ -23,6 +23,8 @@ services: image: odoo:yaltik8 environment: DB_MAXCONN: 20 + XMLRPC_PORT: 8069 + LONGPOLLING_PORT: 8072 WORKERS: 2 LIMIT_TIME_CPU: 720 LIMIT_TIME_REAL: 1440 diff --git a/odoo/dev.yml b/odoo/dev.yml index 17a83df..fba76f3 100644 --- a/odoo/dev.yml +++ b/odoo/dev.yml @@ -1,6 +1,18 @@ version: '2' services: + nginx: + build: + context: ./nginx + dockerfile: Dockerfile.dev + image: nginx:odoodev + environment: + PORT: 80 + NGINX_HOST: localhost 127.0.0.1 + ODOO_SERVICE: odoo + ODOO_SERVER_NAMES: localodoo odoo ocb + command: /bin/true + odoodev: extends: file: base.yml diff --git a/odoo/nginx/Dockerfile.dev b/odoo/nginx/Dockerfile.dev new file mode 100644 index 0000000..673aa6d --- /dev/null +++ b/odoo/nginx/Dockerfile.dev @@ -0,0 +1,8 @@ +FROM nginx:yaltik +MAINTAINER Yaltik - Fabien Bourgeois + +# Default variables +ENV ODOO_SERVER_NAMES odoo + +# Copy templates and usefull files +COPY odoo.conf.dev /etc/nginx/templates/odoo.conf diff --git a/odoo/nginx/odoo.conf.dev b/odoo/nginx/odoo.conf.dev new file mode 100644 index 0000000..1c80958 --- /dev/null +++ b/odoo/nginx/odoo.conf.dev @@ -0,0 +1,29 @@ +upstream odooserver { + server ${ODOO_SERVICE}:8069 fail_timeout=300s; +} + +upstream odoolongpoll { + server ${ODOO_SERVICE}:8072 fail_timeout=300s; +} + +server { + listen 80; + server_name ${ODOO_SERVER_NAMES}; + client_max_body_size 200M; + location / { + proxy_pass http://odooserver; + proxy_http_version 1.1; + proxy_read_timeout 300; + proxy_set_header Host ${DOLLSIGN}host; + proxy_set_header X-Real-IP ${DOLLSIGN}remote_addr; + proxy_set_header X-Forward-For ${DOLLSIGN}proxy_add_x_forwarded_for; + proxy_redirect http://$http_host/ https://$host:$server_port/; + } + location /longpolling { + proxy_pass http://odoolongpoll; + proxy_set_header Host ${DOLLSIGN}host; + proxy_set_header X-Real-IP ${DOLLSIGN}remote_addr; + proxy_set_header X-Forward-For ${DOLLSIGN}proxy_add_x_forwarded_for; + proxy_redirect off; + } +} diff --git a/odoo/odoo/genconf.sh b/odoo/odoo/genconf.sh index 0b4e6bd..728f05d 100644 --- a/odoo/odoo/genconf.sh +++ b/odoo/odoo/genconf.sh @@ -32,6 +32,8 @@ db_user = $POSTGRES_USER db_password = $POSTGRES_PASSWORD db_maxconn = ${DB_MAXCONN:=10} list_db = ${LIST_DB:=True} +xmlrpc_port = ${XMLRPC_PORT:=8069} +longpolling_port = ${LONGPOLLING_PORT:=8072} workers = ${WORKERS:=1} limit_time_cpu = ${LIMIT_TIME_CPU:=60} limit_time_real = ${LIMIT_TIME_REAL:=120}