Make Odoo SPOC-compatible
This commit is contained in:
parent
590dde8206
commit
0790a9243b
27
lxc-apps/odoo/app
Normal file
27
lxc-apps/odoo/app
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
{
|
||||||
|
"version": "13.0.0-200313",
|
||||||
|
"meta": {
|
||||||
|
"title": "Odoo",
|
||||||
|
"desc-cs": "Sada aplikací pro správu organizace",
|
||||||
|
"desc-en": "Company management application suite",
|
||||||
|
"license": "GPL"
|
||||||
|
},
|
||||||
|
"containers": {
|
||||||
|
"odoo": {
|
||||||
|
"image": "odoo_13.0.0-200313",
|
||||||
|
"depends": [
|
||||||
|
"odoo-postgres"
|
||||||
|
],
|
||||||
|
"mounts": {
|
||||||
|
"odoo/odoo_data": "srv/odoo/data",
|
||||||
|
"odoo/odoo_conf/odoo.conf": "srv/odoo/odoo.conf:file"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"odoo-postgres": {
|
||||||
|
"image": "postgres_12.2.0-200313",
|
||||||
|
"mounts": {
|
||||||
|
"odoo/postgres_data": "var/lib/postgresql"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -1,5 +1,5 @@
|
|||||||
IMAGE odoo_13.0.0-191113
|
IMAGE odoo_13.0.0-200313
|
||||||
FROM alpine3.9-python3.6_3.6.8-190620
|
FROM alpine3.11-python3.8_3.8.2-200313
|
||||||
|
|
||||||
RUN EOF
|
RUN EOF
|
||||||
# Install runtime dependencies
|
# Install runtime dependencies
|
||||||
@ -26,5 +26,5 @@ RUN EOF
|
|||||||
rm -rf /usr/local/share/.cache
|
rm -rf /usr/local/share/.cache
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
USER 8080 8080
|
USER odoo
|
||||||
CMD /srv/odoo/odoo-bin -c srv/odoo/odoo.conf
|
CMD /srv/odoo/odoo-bin -c srv/odoo/odoo.conf
|
@ -1,45 +1,45 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
set -ev
|
set -ev
|
||||||
|
|
||||||
|
# Volumes
|
||||||
|
POSTGRES_DATA="${VOLUMES_DIR}/odoo/postgres_data"
|
||||||
|
ODOO_CONF="${VOLUMES_DIR}/odoo/odoo_conf"
|
||||||
|
ODOO_DATA="${VOLUMES_DIR}/odoo/odoo_data"
|
||||||
|
|
||||||
# Create Postgres instance
|
# Create Postgres instance
|
||||||
mkdir -p /srv/odoo/postgres_data
|
install -o 105432 -g 105432 -m 700 -d ${POSTGRES_DATA}
|
||||||
chown -R 105432:105432 /srv/odoo/postgres_data
|
spoc-container exec odoo-postgres -- initdb -D /var/lib/postgresql
|
||||||
chmod 700 /srv/odoo/postgres_data
|
|
||||||
lxc-execute -n odoo-postgres -- initdb -D /var/lib/postgresql
|
|
||||||
|
|
||||||
# Configure Postgres
|
# Configure Postgres
|
||||||
cp postgres_data/postgresql.conf /srv/odoo/postgres_data/postgresql.conf
|
install -o 105432 -g 105432 -m 600 postgres_data/postgresql.conf ${POSTGRES_DATA}/postgresql.conf
|
||||||
cp postgres_data/pg_hba.conf /srv/odoo/postgres_data/pg_hba.conf
|
install -o 105432 -g 105432 -m 600 postgres_data/pg_hba.conf ${POSTGRES_DATA}/pg_hba.conf
|
||||||
|
|
||||||
# Create databases
|
# Create databases
|
||||||
export ODOO_PWD=$(head -c 18 /dev/urandom | base64 | tr -d '+/=')
|
export ODOO_PWD=$(head -c 18 /dev/urandom | base64 | tr -d '+/=')
|
||||||
service lxc-odoo-postgres start
|
spoc-container start odoo-postgres
|
||||||
envsubst <createdb.sql | lxc-attach -u 5432 -g 5432 odoo-postgres -- psql
|
envsubst <createdb.sql | spoc-container exec odoo-postgres -- psql
|
||||||
|
|
||||||
# Configure Odoo
|
# Configure Odoo
|
||||||
export ODOO_ADMIN_USER="admin"
|
export ODOO_ADMIN_USER="admin"
|
||||||
export ODOO_ADMIN_PWD=$(head -c 12 /dev/urandom | base64 | tr -d '+/=')
|
export ODOO_ADMIN_PWD=$(head -c 12 /dev/urandom | base64 | tr -d '+/=')
|
||||||
mkdir -p /srv/odoo/odoo_conf/ /srv/odoo/odoo_data/
|
install -o 108080 -g 108080 -m 750 -d ${ODOO_CONF}
|
||||||
envsubst <odoo_conf/odoo.conf >/srv/odoo/odoo_conf/odoo.conf
|
install -o 108080 -g 108080 -m 750 -d ${ODOO_DATA}
|
||||||
chown 100000:100000 /srv/odoo/odoo_conf/
|
envsubst <odoo_conf/odoo.conf | install -o 108080 -g 108080 -m 640 /dev/stdin ${ODOO_CONF}/odoo.conf
|
||||||
chown 108080:108080 /srv/odoo/odoo_data/
|
|
||||||
|
|
||||||
# Populate database
|
# Populate database
|
||||||
lxc-start odoo -- /srv/odoo/odoo-bin -c /srv/odoo/odoo.conf -i base --load-language=cs_CZ
|
spoc-container exec odoo -- /srv/odoo/odoo-bin -c /srv/odoo/odoo.conf -i base --load-language=cs_CZ &
|
||||||
until grep -q 'odoo.modules.loading: Modules loaded.' /var/log/lxc/odoo.log; do
|
ODOO_PID=$!
|
||||||
|
until grep -q 'odoo.modules.loading: Modules loaded.' /var/log/spoc/odoo.log; do
|
||||||
sleep 1
|
sleep 1
|
||||||
done
|
done
|
||||||
lxc-stop odoo
|
kill ${ODOO_PID}
|
||||||
|
|
||||||
# Update admin account
|
# Update admin account
|
||||||
export ODOO_ADMIN_HASH=$(lxc-execute odoo -- python -c "from passlib.hash import pbkdf2_sha512;print(pbkdf2_sha512.encrypt('${ODOO_ADMIN_PWD}'))")
|
export ODOO_ADMIN_HASH=$(spoc-container exec odoo -- python -c "from passlib.hash import pbkdf2_sha512;print(pbkdf2_sha512.encrypt('${ODOO_ADMIN_PWD}'))")
|
||||||
envsubst <adminpwd.sql | lxc-attach -u 5432 -g 5432 odoo-postgres -- psql odoo
|
envsubst <adminpwd.sql | spoc-container exec odoo-postgres -- psql odoo
|
||||||
|
|
||||||
# Install config update script
|
|
||||||
cp update-conf.sh /srv/odoo/update-conf.sh
|
|
||||||
|
|
||||||
# Stop services required for setup
|
# Stop services required for setup
|
||||||
service lxc-odoo-postgres stop
|
spoc-container stop odoo-postgres
|
||||||
|
|
||||||
# Register application
|
# Register application
|
||||||
vmmgr register-app odoo odoo "${ODOO_ADMIN_USER}" "${ODOO_ADMIN_PWD}"
|
vmmgr register-app odoo odoo "${ODOO_ADMIN_USER}" "${ODOO_ADMIN_PWD}"
|
||||||
|
@ -1,27 +0,0 @@
|
|||||||
{
|
|
||||||
"version": "13.0.0-191113",
|
|
||||||
"meta": {
|
|
||||||
"title": "Odoo",
|
|
||||||
"desc-cs": "Sada aplikací pro správu organizace",
|
|
||||||
"desc-en": "Company management application suite",
|
|
||||||
"license": "GPL"
|
|
||||||
},
|
|
||||||
"containers": {
|
|
||||||
"odoo": {
|
|
||||||
"image": "odoo_13.0.0-191113",
|
|
||||||
"depends": [
|
|
||||||
"odoo-postgres"
|
|
||||||
],
|
|
||||||
"mounts": [
|
|
||||||
["DIR", "/srv/odoo/odoo_data", "/srv/odoo/data"],
|
|
||||||
["FILE", "/srv/odoo/odoo_conf/odoo.conf", "/srv/odoo/odoo.conf"]
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"odoo-postgres": {
|
|
||||||
"image": "postgres_11.3.0-190620",
|
|
||||||
"mounts": [
|
|
||||||
["DIR", "/srv/odoo/postgres_data", "/var/lib/postgresql"]
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -2,7 +2,7 @@
|
|||||||
set -ev
|
set -ev
|
||||||
|
|
||||||
# Remove persistent data
|
# Remove persistent data
|
||||||
rm -rf /srv/odoo
|
rm -rf "${VOLUMES_DIR}/odoo"
|
||||||
|
|
||||||
# Unregister application
|
# Unregister application
|
||||||
vmmgr unregister-app odoo
|
vmmgr unregister-app odoo
|
||||||
|
Loading…
Reference in New Issue
Block a user