feat: call git-clone-addons, init-db and setup-mail explicitly
This commit is contained in:
6 files changed
+40
-26
No files matched your search
+20
-4
@@ -55,7 +55,6 @@ services:
|
||||
ADDONS_GIT_REPOS: "git@github.com:Mint-System/Odoo-Apps-Server-Tools.git#16.0,git@github.com:OCA/server-tools.git#16.0"
|
||||
ODOO_ADDONS_PATH: /mnt/addons/,/mnt/oca/,/mnt/enterprise,/mnt/themes/
|
||||
ODOO_DATABASE: "16.0"
|
||||
ODOO_INIT: "True"
|
||||
ODOO_INIT_LANG: de_CH
|
||||
ODOO_INIT_ADDONS: server_environment_ir_config_parameter
|
||||
ENVIRONMENT: production
|
||||
@@ -114,7 +113,7 @@ Define Odoo system parameters. Requires `server_environment_ir_config_parameter`
|
||||
|
||||
### Incoming and Outgoing Mail-Server
|
||||
|
||||
Load mail server configuration from environment vars.
|
||||
Define the mail configuration with these env vars:
|
||||
|
||||
* `ODOO_MAIL_SMTP_HOST`: If set Odoo sends mails to this host.
|
||||
* `ODOO_MAIL_SMTP_PORT`: SMTP port. Default is `587`.
|
||||
@@ -126,6 +125,12 @@ Load mail server configuration from environment vars.
|
||||
* `ODOO_MAIL_USERNAME`: Username of the Odoo mailbox.
|
||||
* `ODOO_MAIL_PASSWORD`: Password of the Odoo mailbox.
|
||||
|
||||
And load the configuration into the database by running:
|
||||
|
||||
```bash
|
||||
docker-compose run --rm odoo setup-mail
|
||||
```
|
||||
|
||||
### Module Repos
|
||||
|
||||
The entrypoint script can clone git repositories.
|
||||
@@ -134,6 +139,12 @@ The entrypoint script can clone git repositories.
|
||||
* `GIT_SSH_PRIVATE_KEY` Base64 encoded private key for SSH connection.
|
||||
* `ADDONS_GIT_REPOS` Comma seperated list of git clone urls appended with `#` and branch name.
|
||||
|
||||
Run the command:
|
||||
|
||||
```bash
|
||||
docker-compose run --rm odoo git-clone-addons
|
||||
```
|
||||
|
||||
### Addons Path
|
||||
|
||||
The entrypoint script searches for module folders in the addons path and creates a new addons path.
|
||||
@@ -142,13 +153,18 @@ The entrypoint script searches for module folders in the addons path and creates
|
||||
|
||||
### Initialize
|
||||
|
||||
If enabled the entrypoint script initializes the Odoo database.
|
||||
Set these environment variables for database initaisation:
|
||||
|
||||
* `ODOO_DATABASE` Name of the Odoo database. No default is set.
|
||||
* `ODOO_INIT` Enable to initalise the database. Default is `False`.
|
||||
* `ODOO_INIT_LANG` Language used for database initialisation. Default is `en_US`.
|
||||
* `ODOO_INIT_ADDONS` Provide comma separated list of modules for database initialisation. Default is `web`.
|
||||
|
||||
And run the init command:
|
||||
|
||||
```bash
|
||||
docker-compose run --rm odoo init-db
|
||||
```
|
||||
|
||||
### Server Environment
|
||||
|
||||
The Odoo server can be configured using the following env vars.
|
||||
|
||||
+3
-5
@@ -16,8 +16,6 @@ if [ -v PASSWORD_FILE ]; then
|
||||
PASSWORD="$(< $PASSWORD_FILE)"
|
||||
fi
|
||||
|
||||
source git-clone-addons
|
||||
|
||||
source set-addons-path
|
||||
|
||||
export ENVIRONMENT=${ENVIRONMENT:="development"}
|
||||
@@ -68,11 +66,11 @@ check_config "db_password" "$PGPASSWORD"
|
||||
entrypoint-log "Waiting for database connection."
|
||||
wait-for-psql.py ${DB_ARGS[@]} --timeout=30
|
||||
|
||||
init-db
|
||||
# init-db
|
||||
|
||||
setup-mail
|
||||
# setup-mail
|
||||
|
||||
odoo-update
|
||||
# odoo-update
|
||||
|
||||
entrypoint-log "Running Odoo $ODOO_VERSION as user: $USER"
|
||||
|
||||
|
||||
@@ -45,13 +45,6 @@ if [ -n "$ADDONS_GIT_REPOS" ]; then
|
||||
entrypoint-log "Init and update git submodules in $GIT_PATH."
|
||||
git -C "$GIT_PATH" submodule update --init --recursive --depth 1
|
||||
fi
|
||||
|
||||
# Add git repo to addons path
|
||||
if [ -n "$ODOO_ADDONS_PATH" ]; then
|
||||
ODOO_ADDONS_PATH="$ODOO_ADDONS_PATH,$GIT_PATH"
|
||||
else
|
||||
ODOO_ADDONS_PATH="$GIT_PATH"
|
||||
fi
|
||||
done
|
||||
|
||||
# Remove git ssh key
|
||||
@@ -59,6 +52,4 @@ if [ -n "$ADDONS_GIT_REPOS" ]; then
|
||||
ssh-add -d ~/.ssh/id_ed25519
|
||||
rm ~/.ssh/id_ed25519
|
||||
fi
|
||||
|
||||
export ODOO_ADDONS_PATH
|
||||
fi
|
||||
@@ -1,7 +1,6 @@
|
||||
#!/bin/bash
|
||||
|
||||
if [ -n "$ODOO_DATABASE" ]; then
|
||||
: "${ODOO_INIT:=False}"
|
||||
|
||||
entrypoint-log "Check if database $ODOO_DATABASE exists."
|
||||
DATABASE_EXISTS=$(exec psql "postgres://$PGUSER:$PGPASSWORD@$PGHOST:$PGPORT/postgres" -tAc "SELECT COUNT(*) FROM pg_database WHERE datname = '$ODOO_DATABASE'")
|
||||
@@ -15,7 +14,7 @@ if [ -n "$ODOO_DATABASE" ]; then
|
||||
entrypoint-log "Check if database $ODOO_DATABASE is initialized"
|
||||
DATABASE_INITIALIZED=$(exec psql "postgres://$PGUSER:$PGPASSWORD@$PGHOST:$PGPORT/$ODOO_DATABASE" -tAc "SELECT COUNT(*) FROM information_schema.tables WHERE table_name = 'ir_module_module'")
|
||||
|
||||
if [ "$ODOO_INIT" = "True" ] && [ "$DATABASE_INITIALIZED" = "0" ]; then
|
||||
if [ "$DATABASE_INITIALIZED" = "0" ]; then
|
||||
: "${ODOO_INIT_LANG:=en_US}"
|
||||
: "${ODOO_INIT_ADDONS:=web}"
|
||||
entrypoint-log "Initialize database $ODOO_DATABASE with modules: $ODOO_INIT_ADDONS."
|
||||
|
||||
@@ -1,5 +1,10 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Add git path to addons path
|
||||
if [ -n "$ADDONS_GIT_REPOS" ]; then
|
||||
ODOO_ADDONS_PATH="/var/lib/odoo/git,$ODOO_ADDONS_PATH"
|
||||
fi
|
||||
|
||||
if [ -n "$ODOO_ADDONS_PATH" ]; then
|
||||
|
||||
entrypoint-log "Resolve addons path: $ODOO_ADDONS_PATH"
|
||||
|
||||
@@ -973,26 +973,31 @@ function test-container() {
|
||||
echo "Start container environment."
|
||||
start db,mail
|
||||
|
||||
echo "Init Odoo container."
|
||||
echo "Clone Odoo addons."
|
||||
export GIT_SSH_PRIVATE_KEY
|
||||
export GIT_SSH_PUBLIC_KEY
|
||||
export ADDONS_GIT_REPOS="https://github.com/OCA/server-env.git#${GIT_BRANCH},https://github.com/OCA/server-tools.git#${GIT_BRANCH},https://github.com/Mint-System/Odoo-Apps-Server-Tools.git#${GIT_BRANCH},https://github.com/Mint-System/Odoo-Apps-Connector.git#${GIT_BRANCH}"
|
||||
docker-compose run --rm odoo git-clone-addons
|
||||
|
||||
echo "Init Odoo database."
|
||||
export ODOO_ADDONS_PATH="/mnt/enterprise,/mnt/oca"
|
||||
export ODOO_DATABASE=test
|
||||
export ODOO_INIT=True
|
||||
export ODOO_INIT_LANG=de_CH
|
||||
export ODOO_INIT_ADDONS=server_environment_ir_config_parameter,module_auto_update,prometheus_exporter,mail_server_filter,git_base,contacts,web_enterprise
|
||||
export PYTHON_INSTALL=prometheus-client,manifestoo
|
||||
init odoo
|
||||
docker-compose run --rm odoo init-db
|
||||
|
||||
echo "Setup Odoo mail config."
|
||||
export ODOO_MAIL_SMTP_HOST=mail
|
||||
export ODOO_MAIL_SMTP_PORT=1025
|
||||
export ODOO_MAIL_SMTP_ENCRYPTION=none
|
||||
docker-compose run --rm odoo setup-mail
|
||||
|
||||
echo "Start Odoo container."
|
||||
export SERVER_WIDE_MODULES=session_db,module_change_auto_install
|
||||
export SESSION_DB_URI=postgres://odoo:odoo@db/test
|
||||
export MODULE_AUTO_INSTALL_DISABLED=odoo_test_xmlrunner
|
||||
export CLICK_ODOO_UPDATE=True
|
||||
export ODOO_MAIL_SMTP_HOST=mail
|
||||
export ODOO_MAIL_SMTP_PORT=1025
|
||||
export ODOO_MAIL_SMTP_ENCRYPTION=none
|
||||
export MAIL_DEFAULT_FROM="test"
|
||||
export BROWSER_OPEN=false
|
||||
start odoo
|
||||
|
||||
Reference in new issue
Block a user