From 6bafd28e3e86f24fa482d958eae03eb0c819ffa3 Mon Sep 17 00:00:00 2001 From: Disassembler Date: Sun, 28 Oct 2018 08:56:24 +0100 Subject: [PATCH] Split off sahana-shared from Sahana --- sahana-demo/lxcfile | 3 +- sahana-demo/pkg | 2 +- .../lxc/etc/nginx/nginx.conf | 0 .../lxc/etc/services.d/.s6-svscan/finish | 0 .../lxc/etc/services.d/nginx/run | 0 .../lxc/etc/services.d/uwsgi/down-signal | 0 .../lxc/etc/services.d/uwsgi/run | 0 .../lxc/etc/uwsgi/uwsgi.conf | 0 .../web2py/applications/eden/languages/cs.py | 0 .../lxc/srv/web2py/routes.py | 0 .../lxc/srv/web2py/run_scheduler.py | 0 sahana-shared/lxcfile | 57 +++++++++++++++++++ sahana-shared/pkg | 4 ++ sahana/lxcfile | 53 +---------------- sahana/pkg | 2 +- sambro/lxcfile | 3 +- sambro/pkg | 2 +- zz-build/build-all.sh | 2 + 18 files changed, 71 insertions(+), 57 deletions(-) rename {sahana => sahana-shared}/lxc/etc/nginx/nginx.conf (100%) rename {sahana => sahana-shared}/lxc/etc/services.d/.s6-svscan/finish (100%) rename {sahana => sahana-shared}/lxc/etc/services.d/nginx/run (100%) rename {sahana => sahana-shared}/lxc/etc/services.d/uwsgi/down-signal (100%) rename {sahana => sahana-shared}/lxc/etc/services.d/uwsgi/run (100%) rename {sahana => sahana-shared}/lxc/etc/uwsgi/uwsgi.conf (100%) rename {sahana => sahana-shared}/lxc/srv/web2py/applications/eden/languages/cs.py (100%) rename {sahana => sahana-shared}/lxc/srv/web2py/routes.py (100%) rename {sahana => sahana-shared}/lxc/srv/web2py/run_scheduler.py (100%) create mode 100644 sahana-shared/lxcfile create mode 100644 sahana-shared/pkg diff --git a/sahana-demo/lxcfile b/sahana-demo/lxcfile index 9877904..0600d54 100644 --- a/sahana-demo/lxcfile +++ b/sahana-demo/lxcfile @@ -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 diff --git a/sahana-demo/pkg b/sahana-demo/pkg index 77ba103..370b745 100644 --- a/sahana-demo/pkg +++ b/sahana-demo/pkg @@ -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 diff --git a/sahana/lxc/etc/nginx/nginx.conf b/sahana-shared/lxc/etc/nginx/nginx.conf similarity index 100% rename from sahana/lxc/etc/nginx/nginx.conf rename to sahana-shared/lxc/etc/nginx/nginx.conf diff --git a/sahana/lxc/etc/services.d/.s6-svscan/finish b/sahana-shared/lxc/etc/services.d/.s6-svscan/finish similarity index 100% rename from sahana/lxc/etc/services.d/.s6-svscan/finish rename to sahana-shared/lxc/etc/services.d/.s6-svscan/finish diff --git a/sahana/lxc/etc/services.d/nginx/run b/sahana-shared/lxc/etc/services.d/nginx/run similarity index 100% rename from sahana/lxc/etc/services.d/nginx/run rename to sahana-shared/lxc/etc/services.d/nginx/run diff --git a/sahana/lxc/etc/services.d/uwsgi/down-signal b/sahana-shared/lxc/etc/services.d/uwsgi/down-signal similarity index 100% rename from sahana/lxc/etc/services.d/uwsgi/down-signal rename to sahana-shared/lxc/etc/services.d/uwsgi/down-signal diff --git a/sahana/lxc/etc/services.d/uwsgi/run b/sahana-shared/lxc/etc/services.d/uwsgi/run similarity index 100% rename from sahana/lxc/etc/services.d/uwsgi/run rename to sahana-shared/lxc/etc/services.d/uwsgi/run diff --git a/sahana/lxc/etc/uwsgi/uwsgi.conf b/sahana-shared/lxc/etc/uwsgi/uwsgi.conf similarity index 100% rename from sahana/lxc/etc/uwsgi/uwsgi.conf rename to sahana-shared/lxc/etc/uwsgi/uwsgi.conf diff --git a/sahana/lxc/srv/web2py/applications/eden/languages/cs.py b/sahana-shared/lxc/srv/web2py/applications/eden/languages/cs.py similarity index 100% rename from sahana/lxc/srv/web2py/applications/eden/languages/cs.py rename to sahana-shared/lxc/srv/web2py/applications/eden/languages/cs.py diff --git a/sahana/lxc/srv/web2py/routes.py b/sahana-shared/lxc/srv/web2py/routes.py similarity index 100% rename from sahana/lxc/srv/web2py/routes.py rename to sahana-shared/lxc/srv/web2py/routes.py diff --git a/sahana/lxc/srv/web2py/run_scheduler.py b/sahana-shared/lxc/srv/web2py/run_scheduler.py similarity index 100% rename from sahana/lxc/srv/web2py/run_scheduler.py rename to sahana-shared/lxc/srv/web2py/run_scheduler.py diff --git a/sahana-shared/lxcfile b/sahana-shared/lxcfile new file mode 100644 index 0000000..f902d90 --- /dev/null +++ b/sahana-shared/lxcfile @@ -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 diff --git a/sahana-shared/pkg b/sahana-shared/pkg new file mode 100644 index 0000000..fc0f482 --- /dev/null +++ b/sahana-shared/pkg @@ -0,0 +1,4 @@ +pkg: sahana-shared +lxcpath: shared/sahana +version: 0.0.1 +deps: python2 diff --git a/sahana/lxcfile b/sahana/lxcfile index 5b1e63a..9097a0b 100644 --- a/sahana/lxcfile +++ b/sahana/lxcfile @@ -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 diff --git a/sahana/pkg b/sahana/pkg index cf13079..ba3e920 100644 --- a/sahana/pkg +++ b/sahana/pkg @@ -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 diff --git a/sambro/lxcfile b/sambro/lxcfile index 71084e1..5c7a292 100644 --- a/sambro/lxcfile +++ b/sambro/lxcfile @@ -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 diff --git a/sambro/pkg b/sambro/pkg index 52bc8d1..92d3fb4 100644 --- a/sambro/pkg +++ b/sambro/pkg @@ -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 diff --git a/zz-build/build-all.sh b/zz-build/build-all.sh index 4d59a24..c17bc21 100755 --- a/zz-build/build-all.sh +++ b/zz-build/build-all.sh @@ -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