Split off sahana-shared from Sahana

This commit is contained in:
Disassembler 2018-10-28 08:56:24 +01:00
parent 5e4dbd6adf
commit 6bafd28e3e
No known key found for this signature in database
GPG Key ID: 524BD33A0EE29499
18 changed files with 71 additions and 57 deletions

View File

@ -2,7 +2,8 @@ IMAGE sahana-demo
LAYER shared/alpine
LAYER shared/libxml
LAYER shared/python2
LAYER sahana/sahana
LAYER shared/sahana
LAYER sahana-demo/sahana-demo
MOUNT DIR /srv/sahana-demo/conf srv/web2py/applications/eden/models
MOUNT DIR /srv/sahana-demo/data/default srv/web2py/applications/eden/modules/templates/default

View File

@ -4,4 +4,4 @@ lxcpath: sahana-demo
desc: Řízení humanítární činnosti - Ukázková instance
host: sahana-demo
version: 0.0.1
deps: python2 sahana postgres
deps: sahana-shared postgres

57
sahana-shared/lxcfile Normal file
View File

@ -0,0 +1,57 @@
IMAGE sahana
LAYER shared/alpine
LAYER shared/libxml
LAYER shared/python2
LAYER shared/sahana
RUN EOF
# Install runtime dependencies
apk --no-cache add geos@et nginx py-gdal@et py2-dateutil py2-lxml py2-numpy py2-pillow py2-psycopg2 py2-requests uwsgi-python
# Install build dependencies
apk --no-cache add --virtual .deps build-base git freetype-dev libpng-dev py-numpy-dev py2-pip python2-dev ttf-dejavu
# Hackfix for python find_library('c') call
ln -s /lib/ld-musl-x86_64.so.1 /lib/libc.so.1
# Install web2py
git clone --recursive https://github.com/web2py/web2py.git /srv/web2py
git -C /srv/web2py checkout 7035398
git -C /srv/web2py submodule update
# Fix Web2py urllib import (https://github.com/web2py/pydal/commit/9d2290c)
sed -i 's/import traceback/import traceback\nimport urllib/' /srv/web2py/gluon/packages/dal/pydal/base.py
# Symlink WSGI handler
ln -s /srv/web2py/handlers/wsgihandler.py /srv/web2py/wsgihandler.py
# Install Sahana
git clone --depth 1 https://github.com/sahana/eden.git /srv/web2py/applications/eden
# Install python dependencies, exclude old or unnecessary ones
sed -i 's/^ansible/#ansible/' /srv/web2py/applications/eden/optional_requirements.txt
sed -i 's/^boto/#boto/' /srv/web2py/applications/eden/optional_requirements.txt
sed -i 's/^PIL/#PIL/' /srv/web2py/applications/eden/optional_requirements.txt
sed -i 's/^PyRTF/#PyRTF/' /srv/web2py/applications/eden/optional_requirements.txt
sed -i 's/^PyYAML/#PyYAML/' /srv/web2py/applications/eden/optional_requirements.txt
pip install -r /srv/web2py/applications/eden/optional_requirements.txt
# Copy fonts with Czech glyphs
cp /usr/share/fonts/ttf-dejavu/DejaVuSerif-Bold.ttf /srv/web2py/applications/eden/static/fonts/DejaVuSerif-Bold.ttf
cp /usr/share/fonts/ttf-dejavu/DejaVuSerif.ttf /srv/web2py/applications/eden/static/fonts/DejaVuSerif.ttf
EOF
COPY lxc
RUN EOF
# Create OS user
addgroup -S -g 8001 sahana
adduser -S -u 8001 -h /srv/web2py -s /bin/false -g sahana -G sahana sahana
chown -R sahana:sahana /srv/web2py
# Cleanup
apk --no-cache del .deps
find /srv/web2py -name '.git*' -exec rm -rf {} +
rm -r /srv/web2py/applications/admin /srv/web2py/applications/examples /srv/web2py/applications/welcome
rm -r /root/.cache
EOF

4
sahana-shared/pkg Normal file
View File

@ -0,0 +1,4 @@
pkg: sahana-shared
lxcpath: shared/sahana
version: 0.0.1
deps: python2

View File

@ -2,60 +2,9 @@ IMAGE sahana
LAYER shared/alpine
LAYER shared/libxml
LAYER shared/python2
LAYER shared/sahana
LAYER sahana/sahana
RUN EOF
# Install runtime dependencies
apk --no-cache add geos@et nginx py-gdal@et py2-dateutil py2-lxml py2-numpy py2-pillow py2-psycopg2 py2-requests uwsgi-python
# Install build dependencies
apk --no-cache add --virtual .deps build-base git freetype-dev libpng-dev py-numpy-dev py2-pip python2-dev ttf-dejavu
# Hackfix for python find_library('c') call
ln -s /lib/ld-musl-x86_64.so.1 /lib/libc.so.1
# Install web2py
git clone --recursive https://github.com/web2py/web2py.git /srv/web2py
git -C /srv/web2py checkout 7035398
git -C /srv/web2py submodule update
# Fix Web2py urllib import (https://github.com/web2py/pydal/commit/9d2290c)
sed -i 's/import traceback/import traceback\nimport urllib/' /srv/web2py/gluon/packages/dal/pydal/base.py
# Symlink WSGI handler
ln -s /srv/web2py/handlers/wsgihandler.py /srv/web2py/wsgihandler.py
# Install Sahana
git clone --depth 1 https://github.com/sahana/eden.git /srv/web2py/applications/eden
# Install python dependencies, exclude old or unnecessary ones
sed -i 's/^ansible/#ansible/' /srv/web2py/applications/eden/optional_requirements.txt
sed -i 's/^boto/#boto/' /srv/web2py/applications/eden/optional_requirements.txt
sed -i 's/^PIL/#PIL/' /srv/web2py/applications/eden/optional_requirements.txt
sed -i 's/^PyRTF/#PyRTF/' /srv/web2py/applications/eden/optional_requirements.txt
sed -i 's/^PyYAML/#PyYAML/' /srv/web2py/applications/eden/optional_requirements.txt
pip install -r /srv/web2py/applications/eden/optional_requirements.txt
# Copy fonts with Czech glyphs
cp /usr/share/fonts/ttf-dejavu/DejaVuSerif-Bold.ttf /srv/web2py/applications/eden/static/fonts/DejaVuSerif-Bold.ttf
cp /usr/share/fonts/ttf-dejavu/DejaVuSerif.ttf /srv/web2py/applications/eden/static/fonts/DejaVuSerif.ttf
EOF
COPY lxc
RUN EOF
# Create OS user
addgroup -S -g 8001 sahana
adduser -S -u 8001 -h /srv/web2py -s /bin/false -g sahana -G sahana sahana
chown -R sahana:sahana /srv/web2py
# Cleanup
apk --no-cache del .deps
find /srv/web2py -name '.git*' -exec rm -rf {} +
rm -r /srv/web2py/applications/admin /srv/web2py/applications/examples /srv/web2py/applications/welcome
rm -r /root/.cache
EOF
MOUNT DIR /srv/sahana/conf srv/web2py/applications/eden/models
MOUNT DIR /srv/sahana/data/Spotter srv/web2py/applications/eden/modules/templates/Spotter
MOUNT DIR /srv/sahana/data/databases srv/web2py/applications/eden/databases

View File

@ -4,4 +4,4 @@ lxcpath: sahana
desc: Řízení humanítární činnosti
host: sahana
version: 0.0.1
deps: python2 postgres
deps: sahana-shared postgres

View File

@ -2,7 +2,8 @@ IMAGE sambro
LAYER shared/alpine
LAYER shared/libxml
LAYER shared/python2
LAYER sahana/sahana
LAYER shared/sahana
LAYER sambro/sambro
MOUNT DIR /srv/sambro/conf srv/web2py/applications/eden/models
MOUNT DIR /srv/sambro/data/SAMBRO srv/web2py/applications/eden/modules/templates/SAMBRO

View File

@ -4,4 +4,4 @@ lxcpath: sambro
desc: Centrum hlášení a výstrah
host: sambro
version: 0.0.1
deps: python2 sahana postgres
deps: sahana-shared postgres

View File

@ -44,6 +44,7 @@ lxc-build ../pandora
lxc-build ../postgres
lxc-build ../rabbitmq
lxc-build ../redis
lxc-build ../sahana-shared
lxc-build ../sahana
lxc-build ../sahana-demo
lxc-build ../sambro
@ -81,6 +82,7 @@ lxc-pack ../pandora
lxc-pack ../postgres
lxc-pack ../rabbitmq
lxc-pack ../redis
lxc-pack ../sahana-shared
lxc-pack ../sahana
lxc-pack ../sahana-demo
lxc-pack ../sambro