diff --git a/precise/openerp/etc/init.d/openerp-server b/precise/openerp/etc/init.d/openerp-server new file mode 100755 index 00000000..4165167a --- /dev/null +++ b/precise/openerp/etc/init.d/openerp-server @@ -0,0 +1,71 @@ +#!/bin/sh + +### BEGIN INIT INFO +# Provides: openerp-server +# Required-Start: $remote_fs $syslog +# Required-Stop: $remote_fs $syslog +# Should-Start: $network +# Should-Stop: $network +# Default-Start: 2 3 4 5 +# Default-Stop: 0 1 6 +# Short-Description: Enterprise Resource Management software +# Description: Open ERP is a complete ERP and CRM software. +### END INIT INFO + +PATH=/sbin:/bin:/usr/sbin:/usr/bin +PYTHON=/srv/virtualenv/default/bin/python +DAEMON=/opt/apps/openobject-server/openerp-server +NAME=openerp-server +DESC=openerp-server + +USER=openerp + +test -x ${DAEMON} || exit 0 + +set -e + +case "${1}" in + start) + echo -n "Starting ${DESC}: " + + start-stop-daemon --start --quiet --pidfile /var/run/${NAME}.pid \ + --chuid ${USER} --background --make-pidfile \ + --exec ${PYTHON} -- ${DAEMON} --config=/etc/openerp-server.conf \ + --logfile=/var/log/openerp/openerp-server.log + + echo "${NAME}." + ;; + + stop) + echo -n "Stopping ${DESC}: " + + start-stop-daemon --stop --quiet --pidfile /var/run/${NAME}.pid \ + --oknodo + + echo "${NAME}." + ;; + + restart|force-reload) + echo -n "Restarting ${DESC}: " + + start-stop-daemon --stop --quiet --pidfile /var/run/${NAME}.pid \ + --oknodo + + sleep 1 + + start-stop-daemon --start --quiet --pidfile /var/run/${NAME}.pid \ + --chuid ${USER} --background --make-pidfile \ + --exec ${PYTHON} -- ${DAEMON} --config=/etc/openerp-server.conf \ + --logfile=/var/log/openerp/openerp-server.log + + echo "${NAME}." + ;; + + *) + N=/etc/init.d/${NAME} + echo "Usage: ${NAME} {start|stop|restart|force-reload}" >&2 + exit 1 + ;; +esac + +exit 0 diff --git a/precise/openerp/etc/openerp-server.conf b/precise/openerp/etc/openerp-server.conf new file mode 100644 index 00000000..f39a2b36 --- /dev/null +++ b/precise/openerp/etc/openerp-server.conf @@ -0,0 +1,67 @@ + +[options] +; This is the password that allows database operations +; Will be written to by the server when password is changed +; !! Keep this file secure !! +admin_passwd = atptsfOPratcads + +root_path = /opt/apps/openobject-server/bin + +without_demo = False +verbose = False + +; Database settings +db_user = openerp +db_password = jw8s0F4 +; Please uncomment the following line *after* you have created the +; database. It activates the auto module check on startup. +; db_name = False +db_port = 5432 +db_host = localhost +db_maxconn = 64 + +; Networking Settings +xmlrpc = True +xmlrpc_interface = +xmlrpc_port = 8069 + +proxy_mode = True + +netrpc = True +netrpc_interface = +netrpc_port = 8070 + +; Uncomment these for xml-rpc over SSL +;xmlrpcs = True +;xmlrpcs_interface = +;xmlrpcs_port = 8071 +;secure_pkey_file = /etc/ssl/openerp/server.pkey +;secure_cert_file = /etc/ssl/openerp/server.crt + +; Log settings +logfile = /var/log/openerp/openerp-server.log +syslog = False +logrotate = True +log_level = info + +; False prevents the client displaying the list of databases +list_db = True +addons_path = /opt/apps/openobject-server/openerp/addons,/opt/apps/openobject-addons/0k,/opt/apps/openerp-web/addons,/opt/apps/openobject-addons/legacy +demo = {} +soap = False +reportgz = False +translate_modules = ['all'] + +; Static http parameters +static_http_enable = False +static_http_document_root = /var/www/html +static_http_url_prefix = / + +; Outbound email configuration +;smtp_user = info@example.com +;email_from = "OpenERP Support" +;smtp_port = 25 +;smtp_password = ******** +;smtp_ssl = True +;smtp_server = mail.example.com + diff --git a/precise/openerp/hooks/install b/precise/openerp/hooks/install new file mode 100755 index 00000000..b980c7ea --- /dev/null +++ b/precise/openerp/hooks/install @@ -0,0 +1,169 @@ +#!/bin/bash + +set -eux # -x for verbose logging to juju debug-log + + +cat <> /etc/fstab +lxc-nfs-datastore:/srv/lxc-datastore/data/git/var/git /var/git nfs4 timeo=14,intr,bootwait,auto 0 0 +EOF + +mkdir -p /var/git +mount /var/git || exit 1 + +[ -d "/var/git/0k" ] || exit 1 + + +apt-get install sudo libxml2-dev libxslt-dev libpq-dev libyaml-dev \ + zlib1g-dev libfreetype6-dev \ + libjpeg-dev libmysqlclient-dev -y --force-yes + +set +eux +source /srv/virtualenv/default/bin/activate +set -eux + +## install deps for PIL compilations +## from http://www.sandersnewmedia.com/why/2012/04/16/installing-pil-virtualenv-ubuntu-1204 + +if ! [ -e "/usr/lib/libjpeg.so" ]; then + apt-get build-dep python-imaging -y --force-yes + ln -s /usr/lib/`uname -i`-linux-gnu/libfreetype.so /usr/lib/ + ln -s /usr/lib/`uname -i`-linux-gnu/libjpeg.so /usr/lib/ + ln -s /usr/lib/`uname -i`-linux-gnu/libz.so /usr/lib/ +fi + +## Installing PIL with our archive is safer. +#pip install pil +(cd /tmp && +cp /var/git/archives/PIL-1.1.7.tar.gz . && +tar xvzf PIL-1.1.7.tar.gz && +cd PIL-1.1.7 && +python setup.py install +) + +pip install lxml pyparsing==1.5.7 psycopg2 pyyaml reportlab mako \ + pywebdav==0.9.4 feedparser caldav pytz pydot \ + python-dateutil==1.5 cherrypy==3.1.2 formencode==1.2.2 \ + babel simplejson==2.0.9 python-openid mysql-python vatnumber \ + mock unittest2 fudge docutils jinja2 gdata + + +## Install pychart... from our repo as : +## download link in PyPi is dead, +## and gna.org was down recently + +cp /var/git/archives/PyChart-1.39.tar.gz /tmp +(cd /tmp ; tar xvzf PyChart*.tar.gz +cd PyChart* +python setup.py install +) + + +## Install OOOP... from our git repo as: +## we have some bug correction and custom features + +if ! [ -d "/opt/apps/ooop" ]; then +( +cd /opt/apps && +git clone -s /var/git/0k/ooop.git && +cd /opt/apps/ooop && +git checkout 0k/prod/master && + +## beurk +ln -sf /opt/apps/ooop/ooop.py /srv/virtualenv/default/lib/python2.7/ooop.py +) +fi + + +## +## Install openobject-server from 0k GIT version +## + +( +cd /opt/apps +git clone -s /var/git/0k/openobject-server.git +cd /opt/apps/openobject-server +git checkout 6.1/0k/prod/master +) + +adduser --system --home=/var/lib/openerp --group openerp + +## XXXvlab: warning password in charm !! +cp -i etc/openerp-server.conf /etc/ +cp -i etc/init.d/openerp-server /etc/init.d/ + +chown openerp /etc/openerp-server.conf +chmod 600 /etc/openerp-server.conf +chown openerp /etc/init.d/openerp-server + +update-rc.d openerp-server defaults + +mkdir /var/log/openerp +touch /var/log/openerp/openerp-server.log +chown openerp /var/log/openerp -R + + +## Install add-ons +## make a better way for installing add-ons + +#addons_path=/opt/apps/openobject-addons/0k +#if ! [ -d "$addons_path" ]; then +# mkdir -p $addons_path +# for addons in $(/var/git/list-addons 0k/dev/master | grep ^0k); do +# git clone -s /var/git/$addons /opt/apps/openobject-addons/${addons%.git} +# (cd /opt/apps/openobject-addons/${addons%.git} +# git checkout 6.1/0k/prod/master || +# git checkout 0k/prod/master || +# git checkout 0k/dev/master || +# git checkout 6.1/simplee/prod/master || +# git checkout simplee/prod/master || +# git checkout simplee/dev/master || +# git checkout master +# ) +# done +#else +# echo 'WARNING: skipping modules installation as directory was already existent !' +#fi + + +## install addons + +( +mkdir -p /opt/apps/openobject-addons/ && +cd /opt/apps/openobject-addons/ && +git clone -s /var/git/0k/openobject-addons legacy && +cd /opt/apps/openobject-addons/legacy && +git checkout 6.1/0k/dev/master +) + +## Install from 0k GIT version +## because we have bug corrections and new features +( +cd /opt/apps && +git clone -s /var/git/0k/openerp-web.git && +cd /opt/apps/openerp-web && +git checkout 6.1/0k/dev/master +) + +## Install werkzeug from github last version +## because last PyPi version is 8.4 and we need the 9.0+ + +( +cd /tmp && +git clone https://github.com/mitsuhiko/werkzeug.git && +cd werkzeug && +python setup.py install +) + + +## +## Linking with external filestore ! +## + +( +cd /opt/apps/openobject-server/openerp && +ln -sf /var/openerp-filestore filestore && +cd /var/openerp-filestore && +chown openerp . +) + + diff --git a/precise/openerp/hooks/start b/precise/openerp/hooks/start new file mode 100755 index 00000000..9eb7853c --- /dev/null +++ b/precise/openerp/hooks/start @@ -0,0 +1,3 @@ +#!/bin/bash + +juju-log "Nothing to Start for base." diff --git a/precise/openerp/hooks/stop b/precise/openerp/hooks/stop new file mode 100755 index 00000000..170162bd --- /dev/null +++ b/precise/openerp/hooks/stop @@ -0,0 +1,3 @@ +#!/bin/bash + +juju-log "Nothing to stop for base." diff --git a/precise/openerp/metadata.yaml b/precise/openerp/metadata.yaml new file mode 100644 index 00000000..ae399b75 --- /dev/null +++ b/precise/openerp/metadata.yaml @@ -0,0 +1,8 @@ +name: openerp +summary: "OpenERP server" +maintainer: "Valentin Lab " +inherit: python-venv +description: | + OpenERP server +data-resources: + - /var/openerp-filestore diff --git a/precise/openerp/revision b/precise/openerp/revision new file mode 100644 index 00000000..573541ac --- /dev/null +++ b/precise/openerp/revision @@ -0,0 +1 @@ +0