Improve readability of initialize and start scripts

This commit is contained in:
Stéphane Bidoul 2021-12-20 22:59:58 +01:00
parent 3b3a6f4ea9
commit c383c3c31d
No known key found for this signature in database
GPG key ID: BCAB2555446B5B92
3 changed files with 17 additions and 19 deletions

View file

@ -2,21 +2,12 @@
set -ex set -ex
# Remove initialization sentinel, in case we are reinitializing.
# If it exists, copy the previously initialized venv. rm -fr /mnt/data/initialized
if [ -f /mnt/data/initialized ] ; then
pip list
# Install 'deb' external dependencies of all Odoo addons found in path.
DEBIAN_FRONTEND=noninteractive apt-get install -qq --no-install-recommends $(oca_list_external_dependencies deb)
exit 0
fi
DEBIAN_FRONTEND=noninteractive apt-get -yqq install rsync
# Remove addons dir, in case we are reinitializing after a previously # Remove addons dir, in case we are reinitializing after a previously
# failed installation. # failed installation.
rm -fr $ADDONS_DIR rm -fr $ADDONS_DIR
# Clone the repository at git reference into $ADDONS_DIR. # Clone the repository at git reference into $ADDONS_DIR.
git clone --quiet --filter=blob:none $RUNBOAT_GIT_REPO $ADDONS_DIR git clone --quiet --filter=blob:none $RUNBOAT_GIT_REPO $ADDONS_DIR
cd $ADDONS_DIR cd $ADDONS_DIR
@ -27,6 +18,7 @@ git checkout build
oca_install_addons oca_install_addons
# Keep a copy of the venv that we can re-use for shorter startup time. # Keep a copy of the venv that we can re-use for shorter startup time.
rsync -a /opt/odoo-venv/ /mnt/data/odoo-venv DEBIAN_FRONTEND=noninteractive apt-get -yqq install rsync
rsync -a --delete /opt/odoo-venv/ /mnt/data/odoo-venv
touch /mnt/data/initialized touch /mnt/data/initialized

View file

@ -1,7 +1,7 @@
#!/bin/bash #!/bin/bash
# #
# Install all addons in the test database. # Clone repo and install all addons in the test database.
# #
set -ex set -ex
@ -17,7 +17,6 @@ ADDONS=$(addons --addons-dir ${ADDONS_DIR} --include "${INCLUDE}" --exclude "${E
unbuffer $(which odoo || which openerp-server) \ unbuffer $(which odoo || which openerp-server) \
--data-dir=/mnt/data/odoo-data-dir \ --data-dir=/mnt/data/odoo-data-dir \
--db-template=template1 \
-d ${PGDATABASE} \ -d ${PGDATABASE} \
-i ${ADDONS:-base} \ -i ${ADDONS:-base} \
--stop-after-init --stop-after-init

View file

@ -6,16 +6,23 @@
set -ex set -ex
bash /runboat/runboat-clone-and-install.sh if [ ! -f /mnt/data/initialized ] ; then
echo "Build is not initialized. Cannot start."
exit 1
fi
# show what is installed (the venv in /opt/odoo-venv has been mounted)
pip list
# Install 'deb' external dependencies of all Odoo addons found in path.
DEBIAN_FRONTEND=noninteractive apt-get install -qq --no-install-recommends $(oca_list_external_dependencies deb)
oca_wait_for_postgres oca_wait_for_postgres
# --db_user is necessary for Odoo <= 10
# --db_user and --db_filter is necessary for Odoo <= 10
unbuffer $(which odoo || which openerp-server) \ unbuffer $(which odoo || which openerp-server) \
--data-dir=/mnt/data/odoo-data-dir \ --data-dir=/mnt/data/odoo-data-dir \
--no-database-list \ --no-database-list \
-d ${PGDATABASE} \ --database ${PGDATABASE} \
--db-filter=^${PGDATABASE} \ --db-filter=^${PGDATABASE} \
--db_user=${PGUSER} --db_user=${PGUSER}