Browse Source

new: [0k-openerp] charm intelligence is now migrated in ``0k-oe``.

This will allow much better integration with different version.
postgres
Valentin Lab 10 years ago
parent
commit
95e2312d56
  1. 2
      precise/0k-odoo-light/hooks/install
  2. 7
      precise/0k-openerp/etc/default/openerp-server
  3. 81
      precise/0k-openerp/etc/init.d/openerp-server
  4. 67
      precise/0k-openerp/etc/openerp-server.conf
  5. 299
      precise/0k-openerp/hooks/install
  6. 2
      precise/0k-openerp/revision

2
precise/0k-odoo-light/hooks/install

@ -68,7 +68,7 @@ fi
## ===================== END OF DUPLICATE CODE =========== ## ===================== END OF DUPLICATE CODE ===========
(cd ../0k-openerp (cd ../0k-openerp
RELEASE=jessie NO_VIRTUALENV=1 hooks/install
RELEASE=jessie VIRTUALENV= hooks/install
) )
apt-get remove -y --force-yes $DEPS_TO_REMOVE apt-get remove -y --force-yes $DEPS_TO_REMOVE

7
precise/0k-openerp/etc/default/openerp-server

@ -1,7 +0,0 @@
DBFILTER="[
# ('^(?P<dbprefix>[a-zA-Z0-9]+)\.(simplee\.fr|0k\.io|txs\.fr)$', '^%(dbprefix)s.*$'),
# ('^(tuxservices|172\.16\.[0-9]+\.[0-9]+)(:[0-9]+)?$', '^tuxservices.*\$'), ## All database will be shown
# (None, '^$') ## Default: no database will be shown
(None, '^.*$') ## All database will be shown
]"

81
precise/0k-openerp/etc/init.d/openerp-server

@ -1,81 +0,0 @@
#!/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/0k-oe/openobject-server/openerp-server
NAME=openerp-server
DESC=openerp-server
DEFAULT_FILE=/etc/default/openerp-server
DBFILTER="'.*'"
[ -e "$DEFAULT_FILE" ] && . "$DEFAULT_FILE"
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 \
--db-filter="$DBFILTER"
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 \
--db-filter="$DBFILTER"
echo "${NAME}."
;;
*)
N=/etc/init.d/${NAME}
echo "Usage: ${NAME} {start|stop|restart|force-reload}" >&2
exit 1
;;
esac
exit 0

67
precise/0k-openerp/etc/openerp-server.conf

@ -1,67 +0,0 @@
[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 = %%PASSWORD%%
root_path = /opt/apps/0k-oe/openobject-server/bin
without_demo = False
verbose = False
; Database settings
db_user = %%OPENERP_USERNAME%%
db_password = %%OPENERP_PASSWOR%%
; 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/0k-oe/openobject-server/openerp/addons,/opt/apps/0k-oe/addons,/opt/apps/0k-oe/openerp-web/addons
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" <info@example.com>
;smtp_port = 25
;smtp_password = ********
;smtp_ssl = True
;smtp_server = mail.example.com

299
precise/0k-openerp/hooks/install

@ -7,308 +7,55 @@ set -ex # -x for verbose logging to juju debug-log
## Options (changeable thanks to ``/etc/charm/openerp.conf``) ## Options (changeable thanks to ``/etc/charm/openerp.conf``)
## ##
OPENERP_PASSWORD=${OPENERP_PASSWORD:-openerp_password}
export OPENERP_PASSWORD=${OPENERP_PASSWORD:-openerp_password}
## 0k git remote path ## 0k git remote path
GIT_0K_BASE=${GIT_0K_BASE:-"git.0k.io:/var/git"}
export GIT_0K_BASE=${GIT_0K_BASE:-"git.0k.io:/var/git"}
## 0k git remote options ## 0k git remote options
GIT_0K_CLONE_OPTIONS=${GIT_0K_CLONE_OPTIONS:-""}
export GIT_0K_CLONE_OPTIONS=${GIT_0K_CLONE_OPTIONS:-""}
## 0k git-sub setup options ## 0k git-sub setup options
GIT_0K_SUB_CLONE_OPTIONS=${GIT_0K_SUB_CLONE_OPTIONS:-""}
export GIT_0K_SUB_CLONE_OPTIONS=${GIT_0K_SUB_CLONE_OPTIONS:-""}
## 0k git default checkout reference (for 0k-oe root package) ## 0k git default checkout reference (for 0k-oe root package)
GIT_0K_CHECKOUT_REF=${GIT_0K_CHECKOUT_REF:-"8.0/0k/dev/master"}
export GIT_0K_CHECKOUT_REF=${GIT_0K_CHECKOUT_REF:-"8.0/0k/dev/master"}
RELEASE=${RELEASE:-}
test -z "$RELEASE" && RELEASE=$(lsb_release -c -s)
##
## Code
##
if [ -z "$NO_VIRTUALENV" ]; then
set +ex
source /srv/virtualenv/default/bin/activate
set -ex
fi
if [ "$NO_VIRTUALENV" ]; then
apt-get install -y --no-install-recommends python-geoip python-gevent \
python-ldap python-lxml python-markupsafe python-pip \
python-psutil python-psycopg2 python-pychart python-pydot \
python-reportlab python-simplejson python-yaml wget wkhtmltopdf \
python-mysqldb
fi
if [ "$RELEASE" == "wheezy" ]; then
(
cd /tmp
wget http://downloads.sourceforge.net/project/wkhtmltopdf/0.12.1/wkhtmltox-0.12.1_linux-precise-amd64.deb
dpkg -i wkhtmltox-0.12.1_linux-precise-amd64.deb
rm -f wkhtmltox-0.12.1_linux-precise-amd64.deb
)
fi
pip install sact.epoch shyaml
## set only if not already set:
export VIRTUALENV=${VIRTUALENV-/srv/virtualenv/default}
RELEASE=${RELEASE:-}
## Install OOOP... from our git repo as:
## we have some bug correction and custom features
PYTHON_LIB_DEST=/usr/lib/python2.7
if [ -z "$NO_VIRTUALENV" ]; then
PYTHON_LIB_DEST=/srv/virtualenv/default/lib/python2.7
fi
mkdir -p /opt/apps
if ! [ -d "/opt/apps/ooop" ]; then
(
cd /opt/apps &&
git clone $GIT_0K_CLONE_OPTIONS "$GIT_0K_BASE/0k/ooop.git" &&
cd /opt/apps/ooop &&
git checkout 0k/prod/master &&
## beurk
ln -sf /opt/apps/ooop/ooop.py $PYTHON_LIB_DEST/ooop.py
)
fi
## Install aerolib... from our git repo as:
if ! [ -d "/opt/apps/aeroolib" ]; then
(
cd /opt/apps &&
git clone $GIT_0K_CLONE_OPTIONS "$GIT_0K_BASE/0k/aeroolib.git" &&
cd /opt/apps/aeroolib &&
git checkout master &&
## beurk
ln -sf /opt/apps/aeroolib/aeroolib/aeroolib $PYTHON_LIB_DEST/aeroolib
)
fi
## 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 &&
cd /tmp &&
rm -rf werkzeug
)
test -z "$RELEASE" && export RELEASE=$(lsb_release -c -s)
## ##
## Install 0k-oe
## Code
## ##
AVOID_INSTALL="pil pillow"
if [ "$NO_VIRTUALENV" ]; then
## These are provided in the system already our by our means
AVOID_INSTALL="$AVOID_INSTALL psycopg2 lxml gevent python-ldap MarkupSafe
psutil http://download.gna.org/pychart/PyChart-1.39.tar.gz
pydot reportlab simplejson PyYAML"
fi
( (
mkdir -p /opt/apps
cd /opt/apps || exit 1 cd /opt/apps || exit 1
if ! [ -d /opt/apps/0k-oe ]; then
if [ "$ODOO_CP_FROM_DIR" ]; then if [ "$ODOO_CP_FROM_DIR" ]; then
cp -a "$ODOO_CP_FROM_DIR" "/opt/apps/0k-oe" cp -a "$ODOO_CP_FROM_DIR" "/opt/apps/0k-oe"
else else
apt-get install -y python-pip && pip install shyaml
git sub clone $GIT_0K_CLONE_OPTIONS $GIT_0K_SUB_CLONE_OPTIONS -b "$GIT_0K_CHECKOUT_REF" \ git sub clone $GIT_0K_CLONE_OPTIONS $GIT_0K_SUB_CLONE_OPTIONS -b "$GIT_0K_CHECKOUT_REF" \
"$GIT_0K_BASE"/0k/0k-oe "$GIT_0K_BASE"/0k/0k-oe
fi
fi && fi &&
cd 0k-oe &&
(
[ -e odoo/requirements.txt ] && cat odoo/requirements.txt
for req in addons/*/requirements.txt; do
if [ -r "$req" ]; then
cat "$req"
cd 0k-oe/charm &&
find install.d/ -mindepth 1 -maxdepth 1 -executable -regex 'install.d/[0-9]+-.*' | sort -n |
while read script; do
echo "=== LAUNCHING SCRIPT: $script"
"$script"
errlvl=$?
echo "=== EXIT OF SCRIPT: $script, ERRLVL: $errlvl"
if [ "$errlvl" != 0 ]; then
exit 1
fi fi
done done
) | sort -u > /tmp/requirements.txt
for pack in $AVOID_INSTALL; do
sed -ri "s%^($pack.*)$%#\1%g" /tmp/requirements.txt
done
) || exit 1 ) || exit 1
##
## Install PIL/Pillow if in Virtualenv or if Pillow is needed
##
NEED_PILLOW=$(cat /tmp/requirements.txt | grep -i "^pillow")
if [ -z "$NO_VIRTUALENV" -o "$NEED_PILLOW" ]; then
##
## Installing PIL/Pillow
##
if [ "$NEED_PILLOW" ]; then
DEV="$DEV build-essential libtiff5-dev libjpeg-dev zlib1g-dev libfreetype6-dev liblcms2-dev libwebp-dev
tcl8.5-dev tk8.5-dev python-dev"
LIB="$LIB python-tk libjpeg62 libtiff5"
else
## from http://www.sandersnewmedia.com/why/2012/04/16/installing-pil-virtualenv-ubuntu-1204
DEV="$DEV libxml2-dev libxslt-dev libpq-dev libyaml-dev
zlib1g-dev libfreetype6-dev
libsasl2-dev libjpeg-dev libmysqlclient-dev"
LIB="libxslt1.1 libpq5 libjpeg62 libtiff5 libmysqlclient18"
fi
## install deps for PIL compilations
apt-get install $DEV $LIB \
-y --force-yes --no-install-recommends
if ! [ -e "/usr/lib/libjpeg.so" ]; then
if [ "$RELEASE" == "trusty" ]; then
## for some reason /etc/apt/sources.list can be WITHOUT deb-src lines
apt-cache policy python-imaging | tail -n 1 | \
while read code url distrib arch type; do
echo deb-src $url $(echo "$distrib" | tr "/" " ");
done >> /etc/apt/sources.list &&
apt-get update
fi
if ! [ -d "/usr/include/freetype2/freetype" ]; then
(cd /usr/include/freetype2 &&
ln -sf . freetype)
fi
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
if [ "$NEED_PILLOW" ]; then
pip install "$NEED_PILLOW"
else
## Installing PIL with our archive is safer.
#pip install pil
(
cd /tmp &&
scp "$GIT_0K_BASE"/archives/PIL-1.1.7.tar.gz . &&
tar xvzf PIL-1.1.7.tar.gz &&
cd PIL-1.1.7 &&
python setup.py install
cd /tmp
rm -rf /tmp/PIL-1.1.7
)
fi
fi
if [ -z "$NO_VIRTUALENV" ]; then
## Install pychart... from our repo as :
## download link in PyPi is dead,
## and gna.org was down recently
(
scp "$GIT_0K_BASE/archives/PyChart-1.39.tar.gz" /tmp &&
cd /tmp && tar xvzf PyChart*.tar.gz &&
cd PyChart* &&
python setup.py install &&
cd /tmp &&
rm -rf /tmp/PyChart*
)
## should be in connectors requirements.
pip install mysql-python
fi
pip install -r /tmp/requirements.txt || exit 1
rm /tmp/requirements.txt
## System user
adduser --system --home=/var/lib/openerp --group openerp
## /etc/init.d
if [ -z "$DOCKER" ]; then
cp -i etc/init.d/openerp-server /etc/init.d/
chown openerp /etc/init.d/openerp-server
update-rc.d openerp-server defaults
fi
## /etc/openerp-server.conf
cp -i etc/openerp-server.conf /etc/
sed -ri "s/%%PASSWORD%%/$OPENERP_PASSWORD/g" /etc/openerp-server.conf
chown openerp /etc/openerp-server.conf
chmod 600 /etc/openerp-server.conf
## Log dir
mkdir -p /var/log/openerp
touch /var/log/openerp/openerp-server.log
chown openerp /var/log/openerp -R
cp -i etc/default/openerp-server /etc/default/openerp-server
##
## Linking with external filestore !
##
(
## keeping for compatibility with older version
cd /opt/apps/0k-oe/odoo/openerp &&
mkdir -p /var/openerp-filestore &&
ln -sf /var/openerp-filestore filestore &&
cd /var/openerp-filestore &&
chown openerp .
)
ln -sf "/opt/apps/0k-oe/bin/oe" "/usr/local/bin/oe"
##
## Remove all unwanted libs
##
if [ -z "$NO_VIRTUALENV" -o "$NEED_PILLOW" ]; then
if [ "$NEED_PILLOW" ]; then
## it won't work for pillow as we didn't use any Build-Depends
BUILD_DEPS=
else
BUILD_DEPS="python-imaging"
fi
for dep in $BUILD_DEPS; do
apt-get autoremove -y --force-yes $(apt-cache showsrc "$dep" |
sed -e '/Build-Depends/!d;s/Build-Depends: \|,\|([^)]*),*\|\[[^]]*\]//g')
done
fi
apt-get autoremove $DEV -y --force-yes

2
precise/0k-openerp/revision

@ -1 +1 @@
0
1
Loading…
Cancel
Save