[ADD]Flectra base and dev images

This commit is contained in:
Fabien BOURGEOIS 2018-11-06 17:32:00 +01:00
parent 38577171a1
commit dcb2110169
10 changed files with 188 additions and 0 deletions

View File

@ -120,6 +120,24 @@ services:
POSTGRES_USER: odoo POSTGRES_USER: odoo
POSTGRES_PASSWORD: somethingToChange POSTGRES_PASSWORD: somethingToChange
flectra:
init: true
build:
context: ./flectra
dockerfile: Dockerfile
image: registry.yaltik.net/flectra:yaltik1
environment:
DB_MAXCONN: 20
XMLRPC_PORT: 8069
LONGPOLLING_PORT: 8072
WORKERS: 2
LIMIT_TIME_CPU: 720
LIMIT_TIME_REAL: 1440
ADMIN_PASSWORD: somethingToChange
LIST_DB: "False"
POSTGRES_USER: flectra
POSTGRES_PASSWORD: somethingToChange
odoocmd: odoocmd:
build: build:
context: ./scripts context: ./scripts

View File

@ -88,3 +88,24 @@ services:
LIST_DB: "True" LIST_DB: "True"
POSTGRES_USER: odoo POSTGRES_USER: odoo
POSTGRES_PASSWORD: somethingToChange POSTGRES_PASSWORD: somethingToChange
flectradev:
extends:
file: base.yml
service: flectra
build:
context: ./flectra
dockerfile: Dockerfile.dev
image: registry.yaltik.net/flectradev:yaltik1
environment:
DEV: 1
CODE_FOLDER: code
ADMIN_PASSWORD: dev
LIST_DB: "True"
DB_MAXCONN: 20
WORKERS: 2
LIMIT_TIME_CPU: 3000
LIMIT_TIME_REAL: 6000
LIMIT_MEMORY_SOFT: 7000000000
LIMIT_MEMORY_HARD: 16000000000

60
odoo/flectra/Dockerfile Normal file
View File

@ -0,0 +1,60 @@
FROM debian:stretch
MAINTAINER Yaltik - Fabien Bourgeois <fabien@yaltik.com>
# http://bugs.python.org/issue19846
# > At the moment, setting "LANG=C" on a Linux system *fundamentally breaks Python 3*, and that's not OK.
ENV LANG C.UTF-8
# Flectra dependencies from Debian APT repository
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
build-essential git mercurial curl \
libxml2-dev libxslt1-dev libldap2-dev libsasl2-dev libjpeg-dev libpq-dev \
libfreetype6-dev libssl1.0-dev \
python3-dev python3-setuptools python3-pip \
nodejs node-less xz-utils \
postgresql-client-9.6
# Handle Node PATH
RUN ln -s /usr/bin/nodejs /usr/bin/node
# WKHTMLTOPDF and fonts
RUN curl -o wkhtmltox.tar.xz -SL https://github.com/wkhtmltopdf/wkhtmltopdf/releases/download/0.12.4/wkhtmltox-0.12.4_linux-generic-amd64.tar.xz \
&& echo '3f923f425d345940089e44c1466f6408b9619562 wkhtmltox.tar.xz' | sha1sum -c - \
&& tar xvf wkhtmltox.tar.xz \
&& cp wkhtmltox/lib/* /usr/local/lib/ \
&& cp wkhtmltox/bin/* /usr/local/bin/ \
&& cp -r wkhtmltox/share/man/man1 /usr/local/share/man/
# Packages cleanup
RUN apt-get purge -y --auto-remove \
&& apt-get clean \
&& rm -r ./wkhtmltox*
# Create flectra user
RUN useradd flectra -md /opt/flectra
# Install Flectra 1.0 latest
ENV FLECTRA_BRANCH 1.0
WORKDIR /opt/flectra
# Default user
USER flectra
RUN mkdir pipcache data backups extra-addons custom-addons
RUN git clone -b ${FLECTRA_BRANCH} --depth 1 https://gitlab.com/flectra-hq/flectra
RUN pip3 install --user -U pip
RUN .local/bin/pip3 install --user -r flectra/requirements.txt
# Launch scripts
COPY ./launch.sh ./
COPY ./genconf.sh ./
# Post-install tasks
RUN touch flectra.conf
# Flectra default ports
EXPOSE 7072 7073
# Volumes : data dir for filestore and addons
VOLUME /opt/flectra/data
CMD [ "bash", "launch.sh" ]

View File

@ -0,0 +1,12 @@
FROM registry.yaltik.net/flectra:yaltik1
MAINTAINER Yaltik - Fabien Bourgeois <fabien@yaltik.com>
# PostgreSQL CLI
RUN .local/bin/pip3 install --user pgcli
COPY pgcli.sh ./
# Flectra specific
RUN .local/bin/pip3 install --user watchdog
COPY shell.sh ./
COPY i18n.sh ./
COPY launch.dev.sh ./launch.sh
ENV DEV 1

45
odoo/flectra/genconf.sh Normal file
View File

@ -0,0 +1,45 @@
#!/bin/bash
# Small program, inspired from Yajo's one : https://bitbucket.org/yajo/docker-odoo
# It generates configuration file
CONF=/opt/flectra/flectra.conf
ADDONS_PATH="/opt/flectra/flectra/addons,/opt/flectra/data/addons"
cd extra-addons
for d in */ ; do
if ! [ "$d" == "*/" ]; then
ADDONS_PATH="$ADDONS_PATH,/opt/flectra/extra-addons/$d"
fi
done
cd ../custom-addons
for d in */ ; do
if ! [ "$d" == "*/" ]; then
ADDONS_PATH="$ADDONS_PATH,/opt/flectra/custom-addons/$d"
fi
done
# Configuration generation
echo "
[options]
; Configuration file auto-generated
addons_path = $ADDONS_PATH
data_dir = ${DATA:=/opt/flectra/data}
dbfilter = ${DB_FILTER}
db_name = ${DB_NAME}
db_host = ${DB_HOST:=postgres}
db_port = ${DB_PORT:=5432}
db_user = $POSTGRES_USER
db_password = $POSTGRES_PASSWORD
db_maxconn = ${DB_MAXCONN:=10}
list_db = ${LIST_DB:=True}
xmlrpc_port = ${XMLRPC_PORT:=8069}
longpolling_port = ${LONGPOLLING_PORT:=8072}
proxy_mode = ${PROXY_MODE:=True}
workers = ${WORKERS:=1}
limit_time_cpu = ${LIMIT_TIME_CPU:=60}
limit_time_real = ${LIMIT_TIME_REAL:=120}
limit_memory_soft = ${LIMIT_MEMORY_SOFT:=671088640}
limit_memory_hard = ${LIMIT_MEMORY_HARD:=1610612736}
admin_passwd = ${ADMIN_PASSWORD:=admin}" > $CONF

4
odoo/flectra/i18n.sh Normal file
View File

@ -0,0 +1,4 @@
#!/bin/bash
cd "custom-addons/$CODE_FOLDER/$2/i18n/" && /opt/flectra/flectra/flectra-bin -c /opt/flectra/flectra.conf -d "$1" --i18n-export="$2".po --modules="$2" && mv "$2".po "$2".pot && cd /opt/flectra
cd "custom-addons/$CODE_FOLDER/$2/i18n/" && /opt/flectra/flectra/flectra-bin -c /opt/flectra/flectra.conf -d "$1" --i18n-export=fr.po --modules="$2" --language=fr_FR && cd /opt/flectra

View File

@ -0,0 +1,15 @@
#!/bin/bash
CONF=/opt/flectra/flectra.conf
FLECTRACMD="/opt/flectra/flectra/flectra-bin --config $CONF"
if [ $LOAD ]; then
FLECTRACMD="$FLECTRACMD --load=$LOAD"
fi
if [ "$DEV" == 1 ]; then
FLECTRACMD="$FLECTRACMD --dev all --log-handler :DEBUG"
fi
# Configuration generation and Flectra launch
bash genconf.sh && $FLECTRACMD

7
odoo/flectra/launch.sh Normal file
View File

@ -0,0 +1,7 @@
#!/bin/bash
CONF=/opt/flectra/flectra.conf
FLECTRACMD="/opt/flectra/flectra/flectra-bin --config $CONF"
# Configuration generation and Flectra launch
bash genconf.sh && $FLECTRACMD

3
odoo/flectra/pgcli.sh Normal file
View File

@ -0,0 +1,3 @@
#!/bin/bash
./.local/bin/pgcli postgresql://$POSTGRES_USER:$POSTGRES_PASSWORD@${DB_HOST:=postgres}

3
odoo/flectra/shell.sh Normal file
View File

@ -0,0 +1,3 @@
#!/bin/bash
/opt/flectra/flectra/flectra-bin shell -c flectra.conf -d "$@" --no-xmlrpc