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

@@ -16,6 +16,9 @@ ARG GITHUB_ACCESS_TOKEN
ARG ENTERPRISE_ADDONS
ARG THIRD_PARTY_ADDONS
ARG ODOO_RC
ARG USE_REDIS
ARG USE_S3
ARG USE_SENTRY
ENV ODOO_TAG=${ODOO_TAG} \
LOG_PATH=${LOG_PATH} \
@@ -23,7 +26,10 @@ ENV ODOO_TAG=${ODOO_TAG} \
GITHUB_ACCESS_TOKEN=${GITHUB_ACCESS_TOKEN} \
ENTERPRISE_ADDONS=${ENTERPRISE_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 #

View File

@@ -25,14 +25,14 @@ case "$1" in
if [ ${APP_ENV} = 'fresh' ] || [ ${APP_ENV} = 'restore' ]; then
# 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
fi
if [ ${APP_ENV} = 'local' ] ; then
# 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}
fi
@@ -46,21 +46,21 @@ case "$1" in
if [ ${APP_ENV} = 'testing' ] ; then
# 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
fi
if [ ${APP_ENV} = 'staging' ] ; then
# 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=
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-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=
fi

View File

@@ -20,6 +20,23 @@ while IFS='=' read -r key value || [[ -n $key ]]; do
export "$key=$value"
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
cp "$TEMPLATE_CONF" "$ODOO_RC"

View File

@@ -2,24 +2,21 @@
set -e
# Check if the repository directory exists and either Redis or S3 is to be used
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;
fi
# Always use base_attachment_object_storage
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
# Check the USE_REDIS variable to decide whether to copy Redis directories
if [[ $USE_REDIS -eq 1 ]]; then
cp -r odoo-cloud-platform/session_redis ${THIRD_PARTY_ADDONS}/session_redis
if [[ $USE_REDIS == "true" ]]; then
cp -r odoo-cloud-platform/session_redis $THIRD_PARTY_ADDONS/session_redis
fi
# Check the USE_S3 variable to decide whether to copy S3 directories
if [[ $USE_S3 -eq 1 ]]; 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
if [[ $USE_S3 == "true" ]]; then
cp -r odoo-cloud-platform/attachment_s3 $THIRD_PARTY_ADDONS/attachment_s3
fi
# Check if the repository directory exists and Sentry is to be used
if [[ ! -d "server-tools" && $USE_SENTRY -eq 1 ]]; then
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
if [[ $USE_SENTRY == "true" ]]; then
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
fi