diff --git a/odoo-tecnativa/README.rst b/odoo-tecnativa/README.rst new file mode 100644 index 00000000..949ff9ab --- /dev/null +++ b/odoo-tecnativa/README.rst @@ -0,0 +1,8 @@ + + +Odoo-tecnativa is a odoo image containing all source and add-ons because +we want to certify the whole image. + +So this means there are no builds being managed by compose, and no injection +of code. + diff --git a/odoo-tecnativa/hooks/init b/odoo-tecnativa/hooks/init new file mode 100755 index 00000000..e549a07c --- /dev/null +++ b/odoo-tecnativa/hooks/init @@ -0,0 +1,25 @@ +#!/bin/bash + +## Init is run on host +## For now it is run every time the script is launched, but +## it should be launched only once after build. + +## Accessible variables are: +## - SERVICE_NAME Name of current service +## - DOCKER_BASE_IMAGE Base image from which this service might be built if any +## - SERVICE_DATASTORE Location on host of the DATASTORE of this service +## - SERVICE_CONFIGSTORE Location on host of the CONFIGSTORE of this service + + +LIB="$SERVICE_DATASTORE/var/lib/odoo" + +. lib/common + +set -e + +odoo_uid=$(get_odoo_uid) + +mkdir -p "$LIB" +## XXXvlab: this one can fail if files are removed (from sessions dir) +chown -R "$odoo_uid" "$LIB" || true +# setfacl -R -m "u:$odoo_uid:rx" "/opt/apps/0k-oe" diff --git a/odoo-tecnativa/hooks/postgres_database-relation-joined b/odoo-tecnativa/hooks/postgres_database-relation-joined new file mode 100755 index 00000000..802e1c31 --- /dev/null +++ b/odoo-tecnativa/hooks/postgres_database-relation-joined @@ -0,0 +1,51 @@ +#!/bin/bash + +## XXXvlab: this hook should go into a generic odoo image + +## XXXvlab: should get location of code +CONFIG=$SERVICE_CONFIGSTORE/etc/odoo-server.conf + +. lib/common + +set -e + +PASSWORD="$(relation-get password)" +USER="$(relation-get user)" +DBNAME="$(relation-get dbname)" +ADMIN_PASSWORD=$(relation-base-compose-get admin-password) + +control=$(echo -en "$USER\0$DBNAME\0$PASSWORD\0$ADMIN_PASSWORD" | md5_compat) + +config-add "\ +services: + $MASTER_BASE_CHARM_NAME: + command: + - '--database=$DBNAME' + ## All this is to please technativa image, but is quite redundant + environment: + PGHOST: $MASTER_TARGET_CHARM_NAME + PGDATABASE: $DBNAME + PGPASSWORD: $PASSWORD + PGUSER: $USER + #DBFILTER: $DBNAME + ADMIN_PASSWORD: $ADMIN_PASSWORD +" + +[ "$control" == "$(relation-get control 2>/dev/null)" ] && exit 0 + + +file_put $CONFIG <