enable separated features

This commit is contained in:
Yhael S
2023-10-20 00:07:37 -05:00
parent 986fffafc3
commit c3f70d3a99
8 changed files with 50 additions and 39 deletions

View File

@@ -120,7 +120,7 @@ USE_S3=false
USE_SENTRY=false USE_SENTRY=false
# Which services are going to be brought up # Which services are going to be brought up
COMPOSE_PROFILES=base COMPOSE_PROFILES=base,cache,storage,ssl,admin
# Service profiles # Service profiles
ODOO_PROFILES="base" ODOO_PROFILES="base"
@@ -320,6 +320,9 @@ CORS_ALLOWED_DOMAIN=${CORS_ALLOWED_DOMAIN}
#----------------------# #----------------------#
# ACME Companion # # ACME Companion #
#----------------------# #----------------------#
# For prod use: https://acme-v02.api.letsencrypt.org/directory
ACME_CA_URI=https://acme-staging-v02.api.letsencrypt.org/directory
CERTS_UPDATE_INTERVAL=3600
DEFAULT_EMAIL=${SUPPORT_EMAIL} DEFAULT_EMAIL=${SUPPORT_EMAIL}
#-------------# #-------------#

View File

@@ -19,3 +19,4 @@ services:
restart: 'no' restart: 'no'
ports: ports:
- 80:80 - 80:80
- 443:443

View File

@@ -1,21 +1,5 @@
services: services:
odoo:
restart: unless-stopped
ports:
- 127.0.0.1:8069:8069
- 127.0.0.1:8071:8071
- 127.0.0.1:8072:8072
postgres:
restart: unless-stopped
ports:
- 127.0.0.1:5432:5432
nginx-proxy:
restart: unless-stopped
ports:
- 80:80
- 443:443
volumes: volumes:
acme: acme:

View File

@@ -14,8 +14,9 @@ services:
- ENTERPRISE_ADDONS - ENTERPRISE_ADDONS
- THIRD_PARTY_ADDONS - THIRD_PARTY_ADDONS
- LOG_PATH - LOG_PATH
depends_on: - USE_REDIS
- postgres - USE_S3
- USE_SENTRY
tty: true tty: true
volumes: volumes:
- odoo-data:${DATA_DIR} - odoo-data:${DATA_DIR}
@@ -161,6 +162,8 @@ services:
- acme:${NGINX_ACME} - acme:${NGINX_ACME}
- ${DOCKER_SOCK}:${DOCKER_SOCK}:ro - ${DOCKER_SOCK}:${DOCKER_SOCK}:ro
environment: environment:
- ACME_CA_URI
- CERTS_UPDATE_INTERVAL
- DEFAULT_EMAIL - DEFAULT_EMAIL
networks: networks:
- internal - internal

View File

@@ -16,6 +16,9 @@ ARG GITHUB_ACCESS_TOKEN
ARG ENTERPRISE_ADDONS ARG ENTERPRISE_ADDONS
ARG THIRD_PARTY_ADDONS ARG THIRD_PARTY_ADDONS
ARG ODOO_RC ARG ODOO_RC
ARG USE_REDIS
ARG USE_S3
ARG USE_SENTRY
ENV ODOO_TAG=${ODOO_TAG} \ ENV ODOO_TAG=${ODOO_TAG} \
LOG_PATH=${LOG_PATH} \ LOG_PATH=${LOG_PATH} \
@@ -23,7 +26,10 @@ ENV ODOO_TAG=${ODOO_TAG} \
GITHUB_ACCESS_TOKEN=${GITHUB_ACCESS_TOKEN} \ GITHUB_ACCESS_TOKEN=${GITHUB_ACCESS_TOKEN} \
ENTERPRISE_ADDONS=${ENTERPRISE_ADDONS} \ ENTERPRISE_ADDONS=${ENTERPRISE_ADDONS} \
THIRD_PARTY_ADDONS=${THIRD_PARTY_ADDONS} \ THIRD_PARTY_ADDONS=${THIRD_PARTY_ADDONS} \
ODOO_RC=${ODOO_RC} ODOO_RC=${ODOO_RC} \
USE_REDIS=${USE_REDIS} \
USE_S3=${USE_S3} \
USE_SENTRY=${USE_SENTRY}
#------------------------# #------------------------#
# APT Dependencies # # APT Dependencies #

View File

@@ -25,14 +25,14 @@ case "$1" in
if [ ${APP_ENV} = 'fresh' ] || [ ${APP_ENV} = 'restore' ]; then if [ ${APP_ENV} = 'fresh' ] || [ ${APP_ENV} = 'restore' ]; then
# Ideal for a fresh install or restore a production database. # 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 echo odoo --config ${ODOO_RC} --database= --init= --update= --load=${LOAD} --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 exec odoo --config ${ODOO_RC} --database= --init= --update= --load-language= --workers=0 --limit-time-cpu=3600 --limit-time-real=7200
fi fi
if [ ${APP_ENV} = 'local' ] ; then if [ ${APP_ENV} = 'local' ] ; then
# Listens to all .env variables mapped into odoo.conf file. # Listens to all .env variables mapped into odoo.conf file.
echo odoo --config ${ODOO_RC} echo odoo --config ${ODOO_RC} --database=${DB_NAME} --init=${INIT} --update=${UPDATE} --load=${LOAD} --workers=${WORKERS} --log-level=${LOG_LEVEL} --dev=${DEV_MODE}
exec odoo --config ${ODOO_RC} exec odoo --config ${ODOO_RC}
fi fi
@@ -46,21 +46,21 @@ case "$1" in
if [ ${APP_ENV} = 'testing' ] ; then if [ ${APP_ENV} = 'testing' ] ; then
# Initializies a fresh 'test_*' database, installs the addons to test, and runs tests you specify in the test tags. # 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 --dev= --stop-after-init echo odoo --config ${ODOO_RC} --database=test_${DB_NAME} --test-enable --test-tags ${TEST_TAGS} --init=${ADDONS_TO_TEST} --update=${ADDONS_TO_TEST} --load=${LOAD} --log-level=${LOG_LEVEL} --without-demo= --workers=0 --dev= --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 --dev= --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 --dev= --stop-after-init
fi fi
if [ ${APP_ENV} = 'staging' ] ; then if [ ${APP_ENV} = 'staging' ] ; then
# Automagically upgrade all addons and install new ones. Ideal for deployment process. # 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 --dev= echo odoo --config ${ODOO_RC} --database=${DB_NAME} --init=${INIT} --update=all --load=${LOAD} --log-level=${LOG_LEVEL} --load-language=${LOAD_LANGUAGE} --limit-time-cpu=3600 --limit-time-real=7200 --dev=
exec odoo --config ${ODOO_RC} --update=all --without-demo=all --workers=0 --limit-time-cpu=3600 --limit-time-real=7200 --dev= exec odoo --config ${ODOO_RC} --update=all --without-demo=all --workers=0 --limit-time-cpu=3600 --limit-time-real=7200 --dev=
fi fi
if [ ${APP_ENV} = 'production' ] ; then if [ ${APP_ENV} = 'production' ] ; then
# Bring up Odoo ready for production. # Bring up Odoo ready for production.
echo odoo --config ${ODOO_RC} --database= --init= --update= --load=${SERVER_WIDE_MODULES} --workers=${WORKERS} --log-level=${LOG_LEVEL} --load-language= --without-demo=all --dev= echo odoo --config ${ODOO_RC} --database= --init= --update= --load=${LOAD} --workers=${WORKERS} --log-level=${LOG_LEVEL} --load-language= --without-demo=all --dev=
exec odoo --config ${ODOO_RC} --database= --init= --update= --load-language= --without-demo=all --dev= exec odoo --config ${ODOO_RC} --database= --init= --update= --load-language= --without-demo=all --dev=
fi fi

View File

@@ -20,6 +20,23 @@ while IFS='=' read -r key value || [[ -n $key ]]; do
export "$key=$value" export "$key=$value"
done < .env done < .env
# Check the USE_REDIS variable to decide whether to copy Redis directories
if [[ $USE_REDIS == "true" ]]; then
LOAD+=",session_redis"
fi
# Check the USE_S3 variable to decide whether to copy S3 directories
if [[ $USE_S3 == "true" ]]; then
LOAD+=",base_attachment_object_storage,attachment_s3"
fi
# Check if the repository directory exists and Sentry is to be used
if [[ $USE_SENTRY == "true" ]]; then
LOAD+=",sentry"
fi
echo "Loading addons: $LOAD"
# Copy the example conf to the destination to start replacing the variables # Copy the example conf to the destination to start replacing the variables
cp "$TEMPLATE_CONF" "$ODOO_RC" cp "$TEMPLATE_CONF" "$ODOO_RC"

View File

@@ -2,24 +2,21 @@
set -e set -e
# Check if the repository directory exists and either Redis or S3 is to be used # Always use base_attachment_object_storage
if [[ ! -d "odoo-cloud-platform" && ( $USE_REDIS -eq 1 || $USE_S3 -eq 1 ) ]]; then git clone https://github.com/odoocker/odoo-cloud-platform.git --depth 1 --branch $ODOO_TAG --single-branch --no-tags;
git clone https://github.com/odoocker/odoo-cloud-platform.git --depth 1 --branch ${ODOO_TAG} --single-branch --no-tags; cp -r odoo-cloud-platform/base_attachment_object_storage $THIRD_PARTY_ADDONS/base_attachment_object_storage
fi
# Check the USE_REDIS variable to decide whether to copy Redis directories if [[ $USE_REDIS == "true" ]]; then
if [[ $USE_REDIS -eq 1 ]]; then cp -r odoo-cloud-platform/session_redis $THIRD_PARTY_ADDONS/session_redis
cp -r odoo-cloud-platform/session_redis ${THIRD_PARTY_ADDONS}/session_redis
fi fi
# Check the USE_S3 variable to decide whether to copy S3 directories # Check the USE_S3 variable to decide whether to copy S3 directories
if [[ $USE_S3 -eq 1 ]]; then if [[ $USE_S3 == "true" ]]; then
cp -r odoo-cloud-platform/base_attachment_object_storage ${THIRD_PARTY_ADDONS}/base_attachment_object_storage cp -r odoo-cloud-platform/attachment_s3 $THIRD_PARTY_ADDONS/attachment_s3
cp -r odoo-cloud-platform/attachment_s3 ${THIRD_PARTY_ADDONS}/attachment_s3
fi fi
# Check if the repository directory exists and Sentry is to be used # Check if the repository directory exists and Sentry is to be used
if [[ ! -d "server-tools" && $USE_SENTRY -eq 1 ]]; then if [[ $USE_SENTRY == "true" ]]; then
git clone https://github.com/odoocker/server-tools.git --depth 1 --branch ${ODOO_TAG} --single-branch --no-tags; git clone https://github.com/odoocker/server-tools.git --depth 1 --branch $ODOO_TAG --single-branch --no-tags;
cp -r server-tools/sentry ${THIRD_PARTY_ADDONS}/sentry cp -r server-tools/sentry $THIRD_PARTY_ADDONS/sentry
fi fi