From b04e8f0605428b45d86962025db9e858fa9c47be Mon Sep 17 00:00:00 2001 From: Valentin Lab Date: Thu, 9 Oct 2014 11:14:16 +0800 Subject: [PATCH] new: [0k-odoo-light] new charm. --- precise/0k-odoo-light/hooks/install | 95 +++++++++++++++++++++++++++++ precise/0k-odoo-light/hooks/start | 3 + precise/0k-odoo-light/hooks/stop | 3 + precise/0k-odoo-light/metadata.yaml | 23 +++++++ precise/0k-odoo-light/revision | 1 + 5 files changed, 125 insertions(+) create mode 100755 precise/0k-odoo-light/hooks/install create mode 100755 precise/0k-odoo-light/hooks/start create mode 100755 precise/0k-odoo-light/hooks/stop create mode 100644 precise/0k-odoo-light/metadata.yaml create mode 100644 precise/0k-odoo-light/revision diff --git a/precise/0k-odoo-light/hooks/install b/precise/0k-odoo-light/hooks/install new file mode 100755 index 00000000..b89041e2 --- /dev/null +++ b/precise/0k-odoo-light/hooks/install @@ -0,0 +1,95 @@ +#!/bin/bash + +set -ex # -x for verbose logging to juju debug-log + +export DEBIAN_FRONTEND=noninteractive LANG=en_US.UTF-8 + +## +## Code +## + +## we need ssh because git needs it. +DEPS="sudo" +DEPS_TO_REMOVE="git" +[ "$NO_SSH" ] || DEPS_TO_REMOVE="$DEPS_TO_REMOVE ssh" + +KEEP_ONLY_PO=${KEEP_ONLY_PO:-fr en de} + +apt-get install -y --force-yes --no-install-recommends \ + $DEPS $DEPS_TO_REMOVE + +## XXXvlab: should use base-0k code instead ! +## ======= BEGIN OF DUPLICATE CODE... well it has been modified ======= +## +## ssh config +## +## 0k git remote path +GIT_0K_BASE=${GIT_0K_BASE:-"git.0k.io:/var/git"} + +## 0k git remote options +GIT_0K_CLONE_OPTIONS=${GIT_0K_CLONE_OPTIONS:-""} + + +if [ -z "$NO_SSH" ]; then + + cp ../base-0k/src/etc/ssh/lxc_git_access_id_rsa /etc/ssh/lxc_git_access_id_rsa + chmod 0600 /etc/ssh/lxc_git_access_id_rsa + + mkdir -p /root/.ssh + + cat < /root/.ssh/config + +Host git.0k.io + User lxc-user + IdentityFile /etc/ssh/lxc_git_access_id_rsa + UserKnownHostsFile /dev/null + StrictHostKeyChecking no + Port 10022 + +EOF + +fi + + +## +## install git sub +## + + +if [ -z "$ODOO_CP_FROM_DIR" ]; then + ( + mkdir -p /opt/apps && + cd /opt/apps && + git clone $GIT_0K_CLONE_OPTIONS "$GIT_0K_BASE"/0k/git-sub && + ln -sf /opt/apps/git-sub/bin/git-sub /usr/lib/git-core/ + ) +fi + +## ===================== END OF DUPLICATE CODE =========== + +(cd ../0k-openerp +RELEASE=jessie NO_VIRTUALENV=1 hooks/install +) + +apt-get remove -y --force-yes $DEPS_TO_REMOVE +apt-get autoremove -y + +rm -rf /opt/apps/git-sub /usr/lib/git-core/git-sub + + +find /opt/apps -name .git -type d -exec rm -rf {} \; -prune + +if [ "$KEEP_ONLY_PO" ]; then + find_args="" + for lang in $KEEP_ONLY_PO; do + find_args="$find_args -not -name $lang.po" + done + + find /opt/apps -name \*.po -type f $find_args -delete +fi + +cat < /root/.0k-oe.rc + +PYTHON_BINARY=/usr/bin/python + +EOF diff --git a/precise/0k-odoo-light/hooks/start b/precise/0k-odoo-light/hooks/start new file mode 100755 index 00000000..9eb7853c --- /dev/null +++ b/precise/0k-odoo-light/hooks/start @@ -0,0 +1,3 @@ +#!/bin/bash + +juju-log "Nothing to Start for base." diff --git a/precise/0k-odoo-light/hooks/stop b/precise/0k-odoo-light/hooks/stop new file mode 100755 index 00000000..170162bd --- /dev/null +++ b/precise/0k-odoo-light/hooks/stop @@ -0,0 +1,3 @@ +#!/bin/bash + +juju-log "Nothing to stop for base." diff --git a/precise/0k-odoo-light/metadata.yaml b/precise/0k-odoo-light/metadata.yaml new file mode 100644 index 00000000..56441abf --- /dev/null +++ b/precise/0k-odoo-light/metadata.yaml @@ -0,0 +1,23 @@ +name: 0k-odoo-light +summary: "OpenERP server" +maintainer: "Valentin Lab " +inherit: docker://debian:jessie +manifest: + include-charm: + - 0k-openerp + - base-0k +description: | + OpenERP server - deployement ready +data-resources: + - /var/openerp-filestore + - /var/log/openerp +docker: + entrypoint: '["oe"]' + expose: + - 8069 + - 8072 +require: + link: + - postgres +provide: + - odoo diff --git a/precise/0k-odoo-light/revision b/precise/0k-odoo-light/revision new file mode 100644 index 00000000..573541ac --- /dev/null +++ b/precise/0k-odoo-light/revision @@ -0,0 +1 @@ +0