├── Dockerfile-nginx ├── Dockerfile-odoo ├── README.md ├── docker-compose.yaml ├── dockerignore ├── gitignore ├── odoo-nginx.conf ├── odoo-nginx_ssl.conf └── odoo.conf /Dockerfile-nginx: -------------------------------------------------------------------------------- 1 | FROM nginx:latest 2 | MAINTAINER Ozrlz 3 | 4 | # Conf files 5 | COPY odoo-nginx.conf /etc/nginx/conf.d/ 6 | 7 | # Delete default files 8 | RUN rm /etc/nginx/conf.d/default.conf 9 | 10 | # Expose 8069 port, in which the users will interact with odoo services 11 | EXPOSE 8069 12 | -------------------------------------------------------------------------------- /Dockerfile-odoo: -------------------------------------------------------------------------------- 1 | FROM odoo:10.0 2 | MAINTAINER Ozrlz 3 | 4 | USER root 5 | 6 | # Copy the key content, such as the config file and the enterprise addons 7 | COPY ./odoo.conf /etc/odoo/odoo.conf 8 | RUN chown odoo:odoo -R /etc/odoo/ 9 | 10 | USER odoo 11 | 12 | EXPOSE 8072 13 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # IMPORTANT 2 | Whenever you run by first time, you must reload the nginx configuration files. 3 | This can ve achieved by typing: 4 | docker exec -it container_name service nginx reload 5 | * Where container_name is the name of the nginx container 6 | ============================= 7 | 8 | # odoo-nginx-reverse-proxy 9 | Odoo instance with docker. Odoo customized with workers and a nginx container that acts as a reverse proxy. 10 | 11 | Odoo exposes 8069 and 8072 ports (as specified in the odoo.conf and dockerfile files). 12 | Nginx exposes 80 (default) and 8069 ports (as specified in the dockerfile file) 13 | 14 | In the docker-compose file, odoo_proxy (nginx) publishs 8069 port. 15 | -------------------------------------------------------------------------------- /docker-compose.yaml: -------------------------------------------------------------------------------- 1 | version: '2' 2 | services: 3 | web: 4 | container_name: odoo_web 5 | build: 6 | context: . 7 | dockerfile: Dockerfile-odoo 8 | depends_on: 9 | - db 10 | volumes: 11 | - odoo-web-data:/var/lib/odoo 12 | db: 13 | container_name: odoo_db 14 | image: postgres:9.4 15 | environment: 16 | - POSTGRES_PASSWORD=odoo 17 | - POSTGRES_USER=odoo 18 | - PGDATA=/var/lib/postgresql/data/pgdata 19 | volumes: 20 | - odoo-db-data:/var/lib/postgresql/data/pgdata 21 | proxy: 22 | depends_on: 23 | - web 24 | container_name: odoo_proxy 25 | build: 26 | context: . 27 | dockerfile: Dockerfile-nginx 28 | ports: 29 | - "8069:8069" 30 | volumes: 31 | odoo-web-data: 32 | odoo-db-data: 33 | -------------------------------------------------------------------------------- /dockerignore: -------------------------------------------------------------------------------- 1 | #Ignore the zip containing the zipped addons 2 | *.zip -------------------------------------------------------------------------------- /gitignore: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ozrlz/odoo-nginx-reverse-proxy/716b375a2e758a23a0cad36cdfe99b99b5244ad5/gitignore -------------------------------------------------------------------------------- /odoo-nginx.conf: -------------------------------------------------------------------------------- 1 | # Define a server for odoo backend (port 8069, as configured on the odoo.conf file (odoo file) ) 2 | upstream odoo-backend { 3 | server web:8069; 4 | } 5 | 6 | # Define a server for longpolling (port 8072, as configured on the odoo.conf file (odoo file) ) 7 | upstream odoo-lp{ 8 | server web:8072; 9 | } 10 | 11 | server { 12 | listen 8069; 13 | server_name localhost; 14 | # Log files 15 | access_log /var/log/nginx/odoo-access.log; 16 | error_log /var/log/nginx/odoo-error.log; 17 | 18 | # Increase proxy buffer size 19 | proxy_buffers 16 64k; 20 | proxy_buffer_size 128k; 21 | # Force timeouts if the backend dies 22 | proxy_next_upstream error timeout invalid_header http_500 http_502 http_503; 23 | # Enable data compression 24 | gzip on; 25 | gzip_min_length 1100; 26 | gzip_buffers 4 32k; 27 | gzip_types text/plain text/xml text/css text/less application/x-javascript application/xml application/json application/javascript; 28 | gzip_vary on; 29 | 30 | # Proxy header and settings 31 | proxy_set_header Host $http_host; 32 | proxy_set_header X-Real-IP $remote_addr; 33 | proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; 34 | proxy_set_header X-Forwarded-Proto $scheme; 35 | 36 | 37 | 38 | # Cache static data 39 | location ~* /web/static/ { 40 | proxy_cache_valid 200 60m; 41 | proxy_buffering on; 42 | expires 864000; 43 | proxy_pass http://odoo-backend; 44 | } 45 | 46 | location / { 47 | proxy_pass http://odoo-backend; 48 | # The following makes the timeout broader 49 | proxy_read_timeout 30000; 50 | proxy_redirect off; 51 | } 52 | 53 | location /longpolling { 54 | proxy_pass http://odoo-lp; 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /odoo-nginx_ssl.conf: -------------------------------------------------------------------------------- 1 | # Define a server for odoo backend (port 8069, as configured on the odoo.conf file (odoo file) ) 2 | upstream odoo-backend { 3 | server web:8069; 4 | } 5 | 6 | # Define a server for longpolling (port 8072, as configured on the odoo.conf file (odoo file) ) 7 | upstream odoo-lp{ 8 | server web:8072; 9 | } 10 | 11 | server { 12 | listen 8069; 13 | server_name localhost; 14 | # Log files 15 | access_log /var/log/nginx/odoo-access.log; 16 | error_log /var/log/nginx/odoo-error.log; 17 | # SSL 18 | ssl on; 19 | ssl_certificate /etc/nginx/ssl/cert.pem; 20 | ssl_certificate_key /etc/nginx/ssl/key.pem; 21 | keepalive_timeout 60; 22 | # Proxy header and settings 23 | proxy_set_header Host $host; 24 | proxy_set_header X-Real-IP $remote_addr; 25 | proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; 26 | proxy_set_header X-Forwarded-Proto $scheme; 27 | proxy_redirect off; 28 | 29 | 30 | # Increase proxy buffer size 31 | proxy_buffers 16 64k; 32 | proxy_buffer_size 128k; 33 | # Force timeouts if the backend dies 34 | proxy_next_upstream error timeout invalid_header http_500 http_502 http_503; 35 | # Enable data compression 36 | gzip on; 37 | gzip_min_length 1100; 38 | gzip_buffers 4 32k; 39 | gzip_types text/plain text/xml text/css text/less application/x-javascript application/xml application/json application/javascript; 40 | gzip_vary on; 41 | 42 | # Cache static data 43 | location ~* /web/static/ { 44 | proxy_cache_valid 200 60m; 45 | proxy_buffering on; 46 | expires 864000; 47 | proxy_pass http://odoo-backend; 48 | } 49 | 50 | location / { 51 | proxy_pass http://odoo-backend; 52 | # The following makes the timeout broader 53 | proxy_read_timeout 30000; 54 | proxy_redirect off; 55 | } 56 | 57 | location /longpolling { 58 | proxy_pass http://odoo-lp; 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /odoo.conf: -------------------------------------------------------------------------------- 1 | [options] 2 | addons_path = /usr/lib/python2.7/dist-packages/odoo/addons,/mnt/extra-addons 3 | data_dir = /var/lib/odoo 4 | db_host = db 5 | db_user = odoo 6 | db_password = odoo 7 | csv_internal_sep = , 8 | limit_memory_hard = 2147483648 9 | limit_memory_soft = 1342177280 10 | limit_request = 8192 11 | limit_time_cpu = 480 12 | limit_time_real = 960 13 | max_cron_threads = 2 14 | workers = 5 15 | longpolling_port = 8072 16 | list_db = True 17 | proxy_mode = True 18 | xmlrpc = True 19 | dbfilter = .* 20 | ;xmlrpc_interface = 127.0.0.1 21 | ;netrpc_interface = 127.0.0.1 22 | ; db_maxconn = 64 23 | ; db_name = False 24 | ; db_template = template1 25 | ; debug_mode = False 26 | ; email_from = False 27 | ; log_db = False 28 | ; log_handler = [':INFO'] 29 | ; log_level = info 30 | ; logfile = None 31 | ; osv_memory_age_limit = 1.0 32 | ; osv_memory_count_limit = False 33 | ; smtp_password = False 34 | ; smtp_port = 25 35 | ; smtp_server = localhost 36 | ; smtp_ssl = False 37 | ; smtp_user = False 38 | ; xmlrpc_port = 8069 39 | ; xmlrpcs = True 40 | ; xmlrpcs_interface = 41 | ; xmlrpcs_port = 8071 42 | --------------------------------------------------------------------------------