mirror of
				https://github.com/odoocker/odoocker
				synced 2025-11-04 15:19:22 +01:00 
			
		
		
		
	general enhancements
This commit is contained in:
		
							
								
								
									
										46
									
								
								.env.example
									
									
									
									
									
								
							
							
						
						
									
										46
									
								
								.env.example
									
									
									
									
									
								
							@@ -1,22 +1,14 @@
 | 
			
		||||
#--------------------------#
 | 
			
		||||
#    Main Configuration    #
 | 
			
		||||
#--------------------------#
 | 
			
		||||
# Project
 | 
			
		||||
PROJECT_NAME=odoocker
 | 
			
		||||
DOMAIN=erp.odoocker.test
 | 
			
		||||
SUPPORT_EMAIL=mail@example.com
 | 
			
		||||
CORS_ALLOWED_DOMAIN="'http://external-domain.test'"
 | 
			
		||||
 | 
			
		||||
# App
 | 
			
		||||
APP_ENV=fresh
 | 
			
		||||
DEV_MODE=reload,qweb
 | 
			
		||||
 | 
			
		||||
# Odoo
 | 
			
		||||
ODOO_VERSION=14.0
 | 
			
		||||
UPDATE=
 | 
			
		||||
APP_ENV=fresh
 | 
			
		||||
INIT=
 | 
			
		||||
UPDATE=
 | 
			
		||||
LOAD=base,web
 | 
			
		||||
WORKERS=1
 | 
			
		||||
DEV_MODE=reload,qweb
 | 
			
		||||
DOMAIN=erp.odoocker.test
 | 
			
		||||
 | 
			
		||||
# Enterprise
 | 
			
		||||
GITHUB_USER=
 | 
			
		||||
@@ -29,21 +21,21 @@ DB_PORT=5432
 | 
			
		||||
DB_NAME=odoo
 | 
			
		||||
DB_USER=odoo
 | 
			
		||||
DB_PASSWORD=odoo
 | 
			
		||||
LOAD_LANGUAGE=
 | 
			
		||||
 | 
			
		||||
DB_SSLMODE=prefer
 | 
			
		||||
DB_MAXCONN=64
 | 
			
		||||
DB_TEMPLATE=unaccent_template
 | 
			
		||||
UNACCENT=True
 | 
			
		||||
LIST_DB=True
 | 
			
		||||
DBFILTER=.*
 | 
			
		||||
LOAD_LANGUAGE=
 | 
			
		||||
 | 
			
		||||
# Logging
 | 
			
		||||
LOG_LEVEL=info
 | 
			
		||||
LOG_HANDLER="[':INFO']"
 | 
			
		||||
 | 
			
		||||
# PgAdmin
 | 
			
		||||
PGADMIN_DOMAIN=pgadmin.odoocker.test
 | 
			
		||||
PGADMIN_PASSWORD=odoo
 | 
			
		||||
# Nginx
 | 
			
		||||
CORS_ALLOWED_DOMAIN="'http://external-domain.test'"
 | 
			
		||||
 | 
			
		||||
# Testing
 | 
			
		||||
TEST_ENABLE=False
 | 
			
		||||
@@ -59,16 +51,24 @@ SMTP_PASSWORD=
 | 
			
		||||
EMAIL_FROM=
 | 
			
		||||
FROM_FILTER=
 | 
			
		||||
 | 
			
		||||
# PgAdmin
 | 
			
		||||
PGADMIN_DOMAIN=pgadmin.odoocker.test
 | 
			
		||||
PGADMIN_PASSWORD=odoo
 | 
			
		||||
 | 
			
		||||
#------------------------------#
 | 
			
		||||
#    Project Configurations    #
 | 
			
		||||
#------------------------------#
 | 
			
		||||
PROJECT_NAME=${PROJECT_NAME}
 | 
			
		||||
DOMAIN=${DOMAIN}
 | 
			
		||||
SUPPORT_EMAIL=${SUPPORT_EMAIL}
 | 
			
		||||
ODOO_VERSION=${ODOO_VERSION}
 | 
			
		||||
GITHUB_USER=${GITHUB_USER}
 | 
			
		||||
GITHUB_ACCESS_TOKEN=${GITHUB_ACCESS_TOKEN}
 | 
			
		||||
ENTERPRISE_REPO=https://${GITHUB_USER}:${GITHUB_ACCESS_TOKEN}@github.com/odoo/enterprise.git
 | 
			
		||||
# Docker
 | 
			
		||||
PROJECT_NAME=odoocker
 | 
			
		||||
SUPPORT_EMAIL=mail@example.com
 | 
			
		||||
 | 
			
		||||
# Containers Tags
 | 
			
		||||
ODOO_TAG=14.0
 | 
			
		||||
POSTGRES_TAG=15.4
 | 
			
		||||
NGINX_TAG=1.25.2
 | 
			
		||||
NGINX_PROXY_TAG=1.3.1
 | 
			
		||||
ACME_COMPANION_TAG=2.2.8
 | 
			
		||||
PGADMIN_TAG=7.6
 | 
			
		||||
 | 
			
		||||
#------------#
 | 
			
		||||
#    Odoo    #
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										13
									
								
								README.md
									
									
									
									
									
								
							
							
						
						
									
										13
									
								
								README.md
									
									
									
									
									
								
							@@ -77,7 +77,6 @@ This file is divided in sections, you most likely are going to focus on the `Mai
 | 
			
		||||
Sample `.env` file:
 | 
			
		||||
```
 | 
			
		||||
# Odoo
 | 
			
		||||
ODOO_VERSION=16.0
 | 
			
		||||
UPDATE=custom_account_addon
 | 
			
		||||
INIT=
 | 
			
		||||
LOAD=base,web
 | 
			
		||||
@@ -164,6 +163,18 @@ docker-compose up -d --build && docker-compose logs odoo
 | 
			
		||||
# Pro(d) Tips
 | 
			
		||||
The following tips will enhance your developing and production experience.
 | 
			
		||||
 | 
			
		||||
## 1. Search through Community, Enterprise, Extra & Custom Addons at once:
 | 
			
		||||
If you are using `Visual Studio Code` & the Remote
 | 
			
		||||
```
 | 
			
		||||
alias odoo='cd odoocker'
 | 
			
		||||
 | 
			
		||||
alias hard-deploy='docker-compose down && git pull && docker-compose pull && docker-compose build --no-cache && docker-compose up -d && docker-compose logs -f odoo'
 | 
			
		||||
 | 
			
		||||
alias deploy='docker-compose down && git pull && docker-compose up -d --build && docker-compose logs -f --tail 2000 odoo'
 | 
			
		||||
 | 
			
		||||
alias logs='docker-compose logs -f --tail 2000 odoo'
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
## 1. Define the following aliases:
 | 
			
		||||
```
 | 
			
		||||
alias odoo='cd odoocker'
 | 
			
		||||
 
 | 
			
		||||
@@ -18,7 +18,7 @@ services:
 | 
			
		||||
      - 443:443
 | 
			
		||||
 | 
			
		||||
  letsencrypt:
 | 
			
		||||
    image: nginxproxy/acme-companion:2.2.8
 | 
			
		||||
    image: nginxproxy/acme-companion:${ACME_COMPANION_TAG}
 | 
			
		||||
    depends_on:
 | 
			
		||||
      - nginx-proxy
 | 
			
		||||
    restart: unless-stopped
 | 
			
		||||
 
 | 
			
		||||
@@ -1,6 +1,6 @@
 | 
			
		||||
services:
 | 
			
		||||
  pgadmin:
 | 
			
		||||
    image: dpage/pgadmin4:7.4
 | 
			
		||||
    image: dpage/pgadmin4:${PGADMIN_TAG}
 | 
			
		||||
    restart: unless-stopped
 | 
			
		||||
    expose:
 | 
			
		||||
      - 80
 | 
			
		||||
 
 | 
			
		||||
@@ -4,12 +4,11 @@ services:
 | 
			
		||||
      context: ./
 | 
			
		||||
      dockerfile: ./odoo/Dockerfile
 | 
			
		||||
      args:
 | 
			
		||||
        - ODOO_VERSION
 | 
			
		||||
        - ODOO_TAG
 | 
			
		||||
        - ODOO_RC
 | 
			
		||||
        - ROOT_PATH
 | 
			
		||||
        - GITHUB_USER
 | 
			
		||||
        - GITHUB_ACCESS_TOKEN
 | 
			
		||||
        - ENTERPRISE_REPO
 | 
			
		||||
        - ENTERPRISE_ADDONS
 | 
			
		||||
        - LOG_PATH
 | 
			
		||||
    depends_on:
 | 
			
		||||
@@ -30,6 +29,8 @@ services:
 | 
			
		||||
    build: 
 | 
			
		||||
      context: ./postgres
 | 
			
		||||
      dockerfile: Dockerfile
 | 
			
		||||
      args:
 | 
			
		||||
        - POSTGRES_TAG
 | 
			
		||||
    restart: unless-stopped
 | 
			
		||||
    tty: true
 | 
			
		||||
    volumes:
 | 
			
		||||
@@ -44,7 +45,7 @@ services:
 | 
			
		||||
      - internal
 | 
			
		||||
 | 
			
		||||
  nginx:
 | 
			
		||||
    image: nginx:1.25.1
 | 
			
		||||
    image: nginx:${NGINX_TAG}
 | 
			
		||||
    depends_on:
 | 
			
		||||
      - odoo
 | 
			
		||||
    restart: unless-stopped
 | 
			
		||||
@@ -63,7 +64,7 @@ services:
 | 
			
		||||
      - internal
 | 
			
		||||
 | 
			
		||||
  nginx-proxy:
 | 
			
		||||
    image: nginxproxy/nginx-proxy:1.3.1
 | 
			
		||||
    image: nginxproxy/nginx-proxy:${NGINX_PROXY_TAG}
 | 
			
		||||
    depends_on:
 | 
			
		||||
      - nginx
 | 
			
		||||
    restart: unless-stopped
 | 
			
		||||
 
 | 
			
		||||
@@ -1,26 +1,25 @@
 | 
			
		||||
#------------------------#
 | 
			
		||||
#     Odoo Community     #
 | 
			
		||||
#------------------------#
 | 
			
		||||
ARG ODOO_VERSION
 | 
			
		||||
FROM odoo:${ODOO_VERSION}
 | 
			
		||||
ARG ODOO_TAG
 | 
			
		||||
FROM odoo:${ODOO_TAG}
 | 
			
		||||
 | 
			
		||||
# Switch to root user
 | 
			
		||||
USER root
 | 
			
		||||
 | 
			
		||||
# Receive ARGs from docker-compose.yml & convert them into ENVs
 | 
			
		||||
ARG ODOO_TAG
 | 
			
		||||
ARG ROOT_PATH
 | 
			
		||||
ARG LOG_PATH
 | 
			
		||||
ARG GITHUB_USER
 | 
			
		||||
ARG GITHUB_ACCESS_TOKEN
 | 
			
		||||
ARG ENTERPRISE_REPO
 | 
			
		||||
ARG ENTERPRISE_ADDONS
 | 
			
		||||
ARG ODOO_RC
 | 
			
		||||
 | 
			
		||||
ENV ODOO_VERSION=${ODOO_VERSION} \
 | 
			
		||||
ENV ODOO_TAG=${ODOO_TAG} \
 | 
			
		||||
    LOG_PATH=${LOG_PATH} \
 | 
			
		||||
    GITHUB_USER=${GITHUB_USER} \
 | 
			
		||||
    GITHUB_ACCESS_TOKEN=${GITHUB_ACCESS_TOKEN} \
 | 
			
		||||
    ENTERPRISE_REPO=${ENTERPRISE_REPO} \
 | 
			
		||||
    ENTERPRISE_ADDONS=${ENTERPRISE_ADDONS} \
 | 
			
		||||
    ODOO_RC=${ODOO_RC}
 | 
			
		||||
 | 
			
		||||
@@ -53,7 +52,7 @@ RUN mkdir -p ${ENTERPRISE_ADDONS} && \
 | 
			
		||||
 | 
			
		||||
# Clone Enterprise addons if user and token are present
 | 
			
		||||
RUN if [ -n "$GITHUB_USER" ] && [ -n "$GITHUB_ACCESS_TOKEN" ]; then \
 | 
			
		||||
        git clone ${ENTERPRISE_REPO} ${ENTERPRISE_ADDONS} --depth 1 --branch ${ODOO_VERSION} --single-branch --no-tags; \
 | 
			
		||||
        git clone https://${GITHUB_USER}:${GITHUB_ACCESS_TOKEN}@github.com/odoo/enterprise.git ${ENTERPRISE_ADDONS} --depth 1 --branch ${ODOO_TAG} --single-branch --no-tags; \
 | 
			
		||||
    fi
 | 
			
		||||
 | 
			
		||||
#---------------------#
 | 
			
		||||
 
 | 
			
		||||
@@ -12,62 +12,63 @@ case "$1" in
 | 
			
		||||
            wait-for-psql.py --db_host ${DB_HOST} --db_port ${DB_PORT} --db_user ${DB_USER} --db_password ${DB_PASSWORD} --timeout=30
 | 
			
		||||
 | 
			
		||||
            if [ ${APP_ENV} = 'fresh' ] || [ ${APP_ENV} = 'restore' ]; then
 | 
			
		||||
                echo odoo --config ${ODOO_RC} --database= --init= --update= --load=${SERVER_WIDE_MODULES} --log-handler=${LOG_HANDLER} --log-level=${LOG_LEVEL} --load-language= --workers=0 --limit-time-cpu=3600 --limit-time-real=7200
 | 
			
		||||
                # Ideal for a fresh install or restore a production database.
 | 
			
		||||
                echo odoo --config ${ODOO_RC} --database= --init= --update= --load=${SERVER_WIDE_MODULES} --log-level=${LOG_LEVEL} --load-language= --workers=0 --limit-time-cpu=3600 --limit-time-real=7200
 | 
			
		||||
 | 
			
		||||
                exec odoo --config ${ODOO_RC} --database= --init= --update= --load=${SERVER_WIDE_MODULES} --log-handler=${LOG_HANDLER} --log-level=${LOG_LEVEL} --load-language= --workers=0 --limit-time-cpu=3600 --limit-time-real=7200
 | 
			
		||||
                exec odoo --config ${ODOO_RC} --database= --init= --update= --load-language= --workers=0 --limit-time-cpu=3600 --limit-time-real=7200
 | 
			
		||||
            fi
 | 
			
		||||
 | 
			
		||||
            if [ ${APP_ENV} = 'full' ] ; then
 | 
			
		||||
                echo odoo --config ${ODOO_RC} --database=${DB_NAME} --init=${INIT} --update= --load=${SERVER_WIDE_MODULES} --log-handler=${LOG_HANDLER} --log-level=${LOG_LEVEL} --load-language=${LOAD_LANGUAGE} --max-cron-threads=${MAX_CRON_THREADS} --limit-time-cpu=3600 --limit-time-real=7200 --workers=0 --without-demo=all
 | 
			
		||||
                # Ideal for initializing a fresh database with a huge amount of addons.
 | 
			
		||||
                echo odoo --config ${ODOO_RC} --database=${DB_NAME} --init=${INIT} --update= --load=${SERVER_WIDE_MODULES} --log-level=${LOG_LEVEL} --load-language=${LOAD_LANGUAGE} --max-cron-threads=${MAX_CRON_THREADS} --limit-time-cpu=3600 --limit-time-real=7200
 | 
			
		||||
 | 
			
		||||
                exec odoo --config ${ODOO_RC} --database=${DB_NAME} --init=${INIT} --update= --load=${SERVER_WIDE_MODULES} --log-handler=${LOG_HANDLER} --log-level=${LOG_LEVEL} --load-language=${LOAD_LANGUAGE} --max-cron-threads=${MAX_CRON_THREADS} --limit-time-cpu=3600 --limit-time-real=7200 --workers=0 --without-demo=all
 | 
			
		||||
                exec odoo --config ${ODOO_RC} --update= --workers=0 --limit-time-cpu=3600 --limit-time-real=7200
 | 
			
		||||
            fi
 | 
			
		||||
 | 
			
		||||
            if [ ${APP_ENV} = 'local' ] ; then
 | 
			
		||||
                # Automagically update the addons you are currently working on.
 | 
			
		||||
                echo odoo --config ${ODOO_RC} --database=${DB_NAME} --init=${INIT} --update=${UPDATE} --load=${SERVER_WIDE_MODULES} --log-handler=${LOG_HANDLER} --log-level=${LOG_LEVEL} --workers=${WORKERS} --dev=${DEV_MODE}
 | 
			
		||||
                # Listens to all .env variables mapped into odoo.conf file.
 | 
			
		||||
                echo odoo --config ${ODOO_RC}
 | 
			
		||||
 | 
			
		||||
                exec odoo --config ${ODOO_RC} --database=${DB_NAME} --init=${INIT} --update=${UPDATE} --load=${SERVER_WIDE_MODULES} --log-handler=${LOG_HANDLER} --log-level=${LOG_LEVEL} --workers=${WORKERS} --dev=${DEV_MODE}
 | 
			
		||||
                exec odoo --config ${ODOO_RC}
 | 
			
		||||
            fi
 | 
			
		||||
 | 
			
		||||
            if [ ${APP_ENV} = 'debug' ] ; then
 | 
			
		||||
                # Automagically update the addons you are currently working on.
 | 
			
		||||
                echo /usr/bin/python3 -m debugpy --listen ${DEBUG_INTERFACE}:${DEBUG_PORT} ${DEBUG_PATH} --config ${ODOO_RC} --database=${DB_NAME} --init=${INIT} --update=${UPDATE} --load=${SERVER_WIDE_MODULES} --log-handler=${LOG_HANDLER} --log-level=${LOG_LEVEL} --workers=${WORKERS} --dev=${DEV_MODE}
 | 
			
		||||
                # Same as local but you can debug you custom addons with your code editor (VSCode).
 | 
			
		||||
                echo debugpy odoo --config ${ODOO_RC}
 | 
			
		||||
 | 
			
		||||
                exec /usr/bin/python3 -m debugpy --listen ${DEBUG_INTERFACE}:${DEBUG_PORT} ${DEBUG_PATH} --config ${ODOO_RC} --database=${DB_NAME} --init=${INIT} --update=${UPDATE} --load=${SERVER_WIDE_MODULES} --log-handler=${LOG_HANDLER} --log-level=${LOG_LEVEL} --workers=${WORKERS} --dev=${DEV_MODE}
 | 
			
		||||
                exec /usr/bin/python3 -m debugpy --listen ${DEBUG_INTERFACE}:${DEBUG_PORT} ${DEBUG_PATH} --config ${ODOO_RC}
 | 
			
		||||
            fi
 | 
			
		||||
 | 
			
		||||
            if [ ${APP_ENV} = 'testing' ] ; then
 | 
			
		||||
                # Runs the tests in a 'test_*' database for the addons you are currently working on via test tags.
 | 
			
		||||
                echo odoo --config ${ODOO_RC} --database=test_${DB_NAME} --test-enable --test-tags ${TEST_TAGS} --init=${ADDONS_TO_TEST} --update=${ADDONS_TO_TEST} --load=${SERVER_WIDE_MODULES} --log-handler=${LOG_HANDLER} --log-level=${LOG_LEVEL} --without-demo= --workers=0 --stop-after-init
 | 
			
		||||
                # Initializies a fresh 'test_*' database, installs the addons to test, and runs tests you specify in the test tags.
 | 
			
		||||
                echo odoo --config ${ODOO_RC} --database=test_${DB_NAME} --test-enable --test-tags ${TEST_TAGS} --init=${ADDONS_TO_TEST} --update=${ADDONS_TO_TEST} --load=${SERVER_WIDE_MODULES} --log-level=${LOG_LEVEL} --without-demo= --workers=0 --stop-after-init
 | 
			
		||||
 | 
			
		||||
                exec odoo --config ${ODOO_RC} --database=test_${DB_NAME} --test-enable --test-tags ${TEST_TAGS} --init=${ADDONS_TO_TEST} --update=${ADDONS_TO_TEST} --load=${SERVER_WIDE_MODULES} --log-handler=${LOG_HANDLER} --log-level=${LOG_LEVEL} --without-demo= --workers=0 --stop-after-init
 | 
			
		||||
                exec odoo --config ${ODOO_RC} --database=test_${DB_NAME} --test-enable --test-tags ${TEST_TAGS} --init=${ADDONS_TO_TEST} --update=${ADDONS_TO_TEST} --without-demo= --workers=0 --stop-after-init
 | 
			
		||||
            fi
 | 
			
		||||
 | 
			
		||||
            if [ ${APP_ENV} = 'staging' ] ; then
 | 
			
		||||
                # Automagically upgrade all addons and install new ones.
 | 
			
		||||
                echo odoo --config ${ODOO_RC} --database=${DB_NAME} --init=${INIT} --update=all --load=${SERVER_WIDE_MODULES} --log-handler=${LOG_HANDLER} --log-level=${LOG_LEVEL} --load-language=${LOAD_LANGUAGE} --limit-time-cpu=3600 --limit-time-real=7200 --workers=0 --without-demo=all
 | 
			
		||||
                # Automagically upgrade all addons and install new ones. Ideal for deployment process.
 | 
			
		||||
                echo odoo --config ${ODOO_RC} --database=${DB_NAME} --init=${INIT} --update=all --load=${SERVER_WIDE_MODULES} --log-level=${LOG_LEVEL} --load-language=${LOAD_LANGUAGE} --limit-time-cpu=3600 --limit-time-real=7200
 | 
			
		||||
 | 
			
		||||
                exec odoo --config ${ODOO_RC} --database=${DB_NAME} --init=${INIT} --update=all --load=${SERVER_WIDE_MODULES} --log-handler=${LOG_HANDLER} --log-level=${LOG_LEVEL} --load-language=${LOAD_LANGUAGE} --limit-time-cpu=3600 --limit-time-real=7200 --workers=0 --without-demo=all
 | 
			
		||||
                exec odoo --config ${ODOO_RC} --update=all --without-demo=all --workers=0 --limit-time-cpu=3600 --limit-time-real=7200
 | 
			
		||||
            fi
 | 
			
		||||
 | 
			
		||||
            if [ ${APP_ENV} = 'production' ] ; then
 | 
			
		||||
                # Bring up Odoo ready for production.
 | 
			
		||||
                echo odoo --config ${ODOO_RC} --database= --init= --update= --load=${SERVER_WIDE_MODULES} --workers=${WORKERS} --log-handler=${LOG_HANDLER} --log-level=${LOG_LEVEL} --load-language= --without-demo=all --dev=False
 | 
			
		||||
                echo odoo --config ${ODOO_RC} --database= --init= --update= --load=${SERVER_WIDE_MODULES} --workers=${WORKERS} --log-level=${LOG_LEVEL} --load-language= --without-demo=all --dev=
 | 
			
		||||
 | 
			
		||||
                exec odoo --config ${ODOO_RC} --database= --init= --update= --load=${SERVER_WIDE_MODULES} --workers=${WORKERS} --log-handler=${LOG_HANDLER} --log-level=${LOG_LEVEL} --load-language= --without-demo=all --dev=False
 | 
			
		||||
                exec odoo --config ${ODOO_RC} --database= --init= --update= --load-language= --without-demo=all --dev=
 | 
			
		||||
            fi
 | 
			
		||||
        fi
 | 
			
		||||
        ;;
 | 
			
		||||
    -*)
 | 
			
		||||
        # TODO: check which cases end up here.
 | 
			
		||||
 | 
			
		||||
        wait-for-psql.py --db_host ${DB_HOST} --db_port ${DB_PORT} --db_user ${DB_USER} --db_password ${DB_PASSWORD} --timeout=30
 | 
			
		||||
        echo odoo --config ${ODOO_RC}
 | 
			
		||||
        exec odoo --config ${ODOO_RC}
 | 
			
		||||
        ;;
 | 
			
		||||
    *)
 | 
			
		||||
 | 
			
		||||
        # TODO: check which cases end up here.
 | 
			
		||||
        echo "$@"
 | 
			
		||||
        exec "$@"
 | 
			
		||||
esac
 | 
			
		||||
 
 | 
			
		||||
@@ -1,4 +1,5 @@
 | 
			
		||||
FROM postgres:15.3
 | 
			
		||||
ARG POSTGRES_TAG
 | 
			
		||||
FROM postgres:${POSTGRES_TAG}
 | 
			
		||||
 | 
			
		||||
#------------------------#
 | 
			
		||||
#    APT Dependencies    #
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user