Add Odoo 10 to graveyard (cherry-picked from 2018-11-17)
This commit is contained in:
parent
e5574db63c
commit
cc1ea7fa25
41
extra/graveyard/odoo10/install.sh
Normal file
41
extra/graveyard/odoo10/install.sh
Normal file
@ -0,0 +1,41 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
set -ev
|
||||||
|
|
||||||
|
cd $(realpath $(dirname "${0}"))/install
|
||||||
|
|
||||||
|
# Check prerequisites
|
||||||
|
[ ! -e /run/openrc/started/postgres ] && service postgres start && STOP_POSTGRES=1
|
||||||
|
|
||||||
|
# Create databases
|
||||||
|
export ODOO_PWD=$(head -c 18 /dev/urandom | base64)
|
||||||
|
envsubst <createdb.sql | lxc-attach -u 5432 -g 5432 postgres -- psql
|
||||||
|
|
||||||
|
# Configure Odoo
|
||||||
|
export ODOO_ADMIN_USER="admin"
|
||||||
|
export ODOO_ADMIN_PWD=$(head -c 12 /dev/urandom | base64)
|
||||||
|
mkdir -p /srv/odoo10/conf/ /srv/odoo10/data/
|
||||||
|
chown 8019:8019 /srv/odoo10/data/
|
||||||
|
envsubst <srv/odoo10/conf/odoo.conf >/srv/odoo10/conf/odoo.conf
|
||||||
|
|
||||||
|
# Populate database
|
||||||
|
lxc-start odoo10 -- /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/odoo10.log; do
|
||||||
|
sleep 1
|
||||||
|
done
|
||||||
|
lxc-stop odoo10
|
||||||
|
|
||||||
|
# Update admin account
|
||||||
|
export ODOO_ADMIN_HASH=$(lxc-execute odoo10 -- python -c "from passlib.hash import pbkdf2_sha512;print pbkdf2_sha512.encrypt('${ODOO_ADMIN_PWD}')")
|
||||||
|
envsubst <adminpwd.sql | lxc-attach -u 5432 -g 5432 postgres -- psql odoo10
|
||||||
|
|
||||||
|
# Install service
|
||||||
|
cp etc/init.d/odoo10 /etc/init.d/odoo10
|
||||||
|
rc-update -u
|
||||||
|
|
||||||
|
# Stop services required for setup
|
||||||
|
[ ! -z ${STOP_POSTGRES} ] && service postgres stop
|
||||||
|
|
||||||
|
# Register application
|
||||||
|
vmmgr register-app odoo10 "${ODOO_ADMIN_USER}" "${ODOO_ADMIN_PWD}"
|
||||||
|
|
||||||
|
exit 0
|
3
extra/graveyard/odoo10/install/adminpwd.sql
Normal file
3
extra/graveyard/odoo10/install/adminpwd.sql
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
UPDATE res_lang SET active = true WHERE code = 'cs_CZ';
|
||||||
|
UPDATE res_partner SET lang = 'cs_CZ', tz = 'Europe/Prague' WHERE id = 3;
|
||||||
|
UPDATE res_users SET password_crypt = '${ODOO_ADMIN_HASH}' WHERE login = 'admin';
|
4
extra/graveyard/odoo10/install/createdb.sql
Normal file
4
extra/graveyard/odoo10/install/createdb.sql
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
CREATE ROLE odoo10 NOSUPERUSER NOCREATEDB NOCREATEROLE NOINHERIT LOGIN ENCRYPTED PASSWORD '${ODOO_PWD}';
|
||||||
|
CREATE DATABASE odoo10;
|
||||||
|
REVOKE ALL ON DATABASE odoo10 FROM public;
|
||||||
|
ALTER DATABASE odoo10 OWNER TO odoo10;
|
23
extra/graveyard/odoo10/install/etc/init.d/odoo10
Normal file
23
extra/graveyard/odoo10/install/etc/init.d/odoo10
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
#!/sbin/openrc-run
|
||||||
|
|
||||||
|
description="Odoo 10 container"
|
||||||
|
|
||||||
|
depend() {
|
||||||
|
need postgres
|
||||||
|
}
|
||||||
|
|
||||||
|
start() {
|
||||||
|
lxc-start odoo10
|
||||||
|
}
|
||||||
|
|
||||||
|
start_post() {
|
||||||
|
/usr/bin/vmmgr register-proxy odoo10
|
||||||
|
}
|
||||||
|
|
||||||
|
stop_pre() {
|
||||||
|
/usr/bin/vmmgr unregister-proxy odoo10
|
||||||
|
}
|
||||||
|
|
||||||
|
stop() {
|
||||||
|
lxc-stop odoo10
|
||||||
|
}
|
11
extra/graveyard/odoo10/install/srv/odoo10/conf/odoo.conf
Normal file
11
extra/graveyard/odoo10/install/srv/odoo10/conf/odoo.conf
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
[options]
|
||||||
|
admin_passwd = ${ODOO_ADMIN_PWD}
|
||||||
|
data_dir = /srv/odoo/data
|
||||||
|
db_host = postgres
|
||||||
|
db_name = odoo10
|
||||||
|
db_password = ${ODOO_PWD}
|
||||||
|
db_user = odoo10
|
||||||
|
email_from = admin@example.com
|
||||||
|
proxy_mode = True
|
||||||
|
smtp_server = host
|
||||||
|
xmlrpc_port = 8080
|
3
extra/graveyard/odoo10/install/srv/odoo10/update-conf.sh
Normal file
3
extra/graveyard/odoo10/install/srv/odoo10/update-conf.sh
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
sed -i "s|\(^email_from = \).*|\1${EMAIL}|" /srv/odoo10/conf/odoo.conf
|
51
extra/graveyard/odoo10/lxcfile
Normal file
51
extra/graveyard/odoo10/lxcfile
Normal file
@ -0,0 +1,51 @@
|
|||||||
|
IMAGE odoo10
|
||||||
|
LAYER shared/alpine
|
||||||
|
LAYER shared/libxml
|
||||||
|
LAYER shared/python2
|
||||||
|
LAYER shared/nodejs
|
||||||
|
LAYER odoo10/odoo10
|
||||||
|
|
||||||
|
FIXLAYER /usr/bin/fix-apk
|
||||||
|
|
||||||
|
RUN EOF
|
||||||
|
# Install runtime dependencies
|
||||||
|
apk --no-cache add libjpeg-turbo libpq py2-setuptools
|
||||||
|
|
||||||
|
# Install build dependencies
|
||||||
|
apk --no-cache add --virtual .deps build-base git libjpeg-turbo-dev libxml2-dev libxslt-dev linux-headers openldap-dev postgresql-dev py2-pip python2-dev yarn
|
||||||
|
|
||||||
|
# Clone Odoo repository
|
||||||
|
git clone -b 10.0 --single-branch --depth 1 https://github.com/odoo/odoo.git /srv/odoo
|
||||||
|
|
||||||
|
# Clone addons
|
||||||
|
git clone -b 10.0 --single-branch --depth 1 https://github.com/OCA/vertical-ngo /tmp/addons/vertical-ngo
|
||||||
|
git clone -b 10.0 --single-branch --depth 1 https://github.com/OCA/stock-logistics-transport /tmp/addons/stock-logistics-transport
|
||||||
|
git clone -b 10.0 --single-branch --depth 1 https://github.com/OCA/stock-logistics-warehouse /tmp/addons/stock-logistics-warehouse
|
||||||
|
git clone -b 10.0 --single-branch --depth 1 https://github.com/OCA/stock-logistics-workflow /tmp/addons/stock-logistics-workflow
|
||||||
|
git clone -b 10.0 --single-branch --depth 1 https://github.com/OCA/sale-workflow /tmp/addons/sale-workflow
|
||||||
|
for ADDON in $(ls -d /tmp/addons/vertical-ngo/*/ /tmp/addons/stock-logistics-transport/*/ /tmp/addons/stock-logistics-warehouse/*/ /tmp/addons/stock-logistics-workflow/*/ /tmp/addons/sale-workflow/*/ | sed 's|/$||' | grep -v '/setup$'); do
|
||||||
|
mv ${ADDON} /srv/odoo/addons/
|
||||||
|
done
|
||||||
|
rm -rf /tmp/addons
|
||||||
|
|
||||||
|
# Install Odoo
|
||||||
|
cd /srv/odoo
|
||||||
|
pip install -r requirements.txt
|
||||||
|
yarn global add less
|
||||||
|
|
||||||
|
# Create OS user
|
||||||
|
addgroup -S -g 8019 odoo
|
||||||
|
adduser -S -u 8019 -h /srv/odoo -s /bin/false -g odoo -G odoo odoo
|
||||||
|
chown -R odoo:odoo /srv/odoo
|
||||||
|
|
||||||
|
# Cleanup
|
||||||
|
apk --no-cache del .deps
|
||||||
|
find /srv/odoo -name '.git*' -exec rm -rf {} +
|
||||||
|
rm -rf /root/.cache/ /usr/local/share/.cache
|
||||||
|
EOF
|
||||||
|
|
||||||
|
MOUNT FILE /srv/odoo10/conf/odoo.conf srv/odoo/odoo.conf
|
||||||
|
MOUNT DIR /srv/odoo10/data srv/odoo/data
|
||||||
|
|
||||||
|
USER 8019 8019
|
||||||
|
CMD /srv/odoo/odoo-bin -c srv/odoo/odoo.conf
|
7
extra/graveyard/odoo10/pkg
Normal file
7
extra/graveyard/odoo10/pkg
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
pkg: odoo10
|
||||||
|
title: Odoo 10
|
||||||
|
lxcpath: odoo10
|
||||||
|
desc: Sada aplikací pro správu organizace
|
||||||
|
host: odoo10
|
||||||
|
version: 0.0.1
|
||||||
|
deps: python3 nodejs postgres
|
13
extra/graveyard/odoo10/uninstall.sh
Normal file
13
extra/graveyard/odoo10/uninstall.sh
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
set -ev
|
||||||
|
|
||||||
|
# Remove service
|
||||||
|
rm -f /etc/init.d/odoo10
|
||||||
|
rc-update -u
|
||||||
|
|
||||||
|
# Drop database and user
|
||||||
|
[ ! -e /run/openrc/started/postgres ] && service postgres start && STOP_POSTGRES=1
|
||||||
|
echo 'DROP DATABASE IF EXISTS odoo10; DROP ROLE IF EXISTS odoo10;' | lxc-attach -u 5432 -g 5432 postgres -- psql
|
||||||
|
[ ! -z ${STOP_POSTGRES} ] && service postgres stop
|
||||||
|
|
||||||
|
exit 0
|
Loading…
Reference in New Issue
Block a user