From b79323b4b7112a030792de5c19afc121688aabde Mon Sep 17 00:00:00 2001 From: Disassembler Date: Sun, 22 Mar 2020 13:44:46 +0100 Subject: [PATCH] Make Pandora SPOC-compatible --- lxc-apps/opendatakit/uninstall.sh | 1 + lxc-apps/pandora/app | 34 ++++++++++ lxc-apps/pandora/{lxcfile => image} | 24 ++++--- .../{lxc => image.d}/etc/nginx/nginx.conf | 0 .../etc/services.d/.s6-svscan/finish | 0 .../{lxc => image.d}/etc/services.d/nginx/run | 0 .../etc/services.d/pandora-cron/run | 0 .../etc/services.d/pandora-encoding/run | 0 .../etc/services.d/pandora-tasks/run | 0 .../etc/services.d/pandora/run | 0 .../pandora/static/json/locale.0xdb.cs.json | 0 .../static/json/locale.pandora.cs.json | 0 .../static/oxjs/source/Ox/js/Constants.js | 0 .../static/oxjs/source/Ox/json/locale.cs.json | 0 .../static/oxjs/source/UI/json/locale.cs.json | 0 lxc-apps/pandora/install.sh | 63 +++++++++---------- lxc-apps/pandora/meta | 34 ---------- lxc-apps/pandora/uninstall.sh | 2 +- .../install/{ => sahana_data}/masterUsers.csv | 0 19 files changed, 78 insertions(+), 80 deletions(-) create mode 100644 lxc-apps/pandora/app rename lxc-apps/pandora/{lxcfile => image} (76%) rename lxc-apps/pandora/{lxc => image.d}/etc/nginx/nginx.conf (100%) rename lxc-apps/pandora/{lxc => image.d}/etc/services.d/.s6-svscan/finish (100%) rename lxc-apps/pandora/{lxc => image.d}/etc/services.d/nginx/run (100%) rename lxc-apps/pandora/{lxc => image.d}/etc/services.d/pandora-cron/run (100%) rename lxc-apps/pandora/{lxc => image.d}/etc/services.d/pandora-encoding/run (100%) rename lxc-apps/pandora/{lxc => image.d}/etc/services.d/pandora-tasks/run (100%) rename lxc-apps/pandora/{lxc => image.d}/etc/services.d/pandora/run (100%) rename lxc-apps/pandora/{lxc => image.d}/srv/pandora/static/json/locale.0xdb.cs.json (100%) rename lxc-apps/pandora/{lxc => image.d}/srv/pandora/static/json/locale.pandora.cs.json (100%) rename lxc-apps/pandora/{lxc => image.d}/srv/pandora/static/oxjs/source/Ox/js/Constants.js (100%) rename lxc-apps/pandora/{lxc => image.d}/srv/pandora/static/oxjs/source/Ox/json/locale.cs.json (100%) rename lxc-apps/pandora/{lxc => image.d}/srv/pandora/static/oxjs/source/UI/json/locale.cs.json (100%) delete mode 100644 lxc-apps/pandora/meta rename lxc-apps/sambro/install/{ => sahana_data}/masterUsers.csv (100%) diff --git a/lxc-apps/opendatakit/uninstall.sh b/lxc-apps/opendatakit/uninstall.sh index a29fe04..7ce82d7 100755 --- a/lxc-apps/opendatakit/uninstall.sh +++ b/lxc-apps/opendatakit/uninstall.sh @@ -6,3 +6,4 @@ rm -rf "${VOLUMES_DIR}/opendatakit" # Unregister application vmmgr unregister-app opendatakit +vmmgr unregister-app opendatakit-build diff --git a/lxc-apps/pandora/app b/lxc-apps/pandora/app new file mode 100644 index 0000000..e06ca8a --- /dev/null +++ b/lxc-apps/pandora/app @@ -0,0 +1,34 @@ +{ + "version": "0.0.1-200313", + "meta": { + "title": "Pan.do/ra", + "desc-cs": "Archiv mediĆ­", + "desc-en": "Media archive", + "license": "GPL" + }, + "containers": { + "pandora": { + "image": "pandora_0.0.1-200313", + "depends": [ + "pandora-postgres", + "pandora-rabbitmq" + ], + "mounts": { + "pandora/pandora_conf": "srv/pandora/conf", + "pandora/pandora_data": "srv/pandora/data" + } + }, + "pandora-postgres": { + "image": "postgres_12.2.0-200313", + "mounts": { + "pandora/postgres_data": "var/lib/postgresql" + } + }, + "pandora-rabbitmq": { + "image": "rabbitmq_3.7.18-200313", + "mounts": { + "pandora/rabbitmq_data": "var/lib/rabbitmq/mnesia" + } + } + } +} diff --git a/lxc-apps/pandora/lxcfile b/lxc-apps/pandora/image similarity index 76% rename from lxc-apps/pandora/lxcfile rename to lxc-apps/pandora/image index 60dce0d..d2c85b3 100644 --- a/lxc-apps/pandora/lxcfile +++ b/lxc-apps/pandora/image @@ -1,25 +1,23 @@ -IMAGE pandora_0.0.1-190620 -FROM alpine3.9-python3.6_3.6.8-190620 +IMAGE pandora_0.0.1-200313 +FROM alpine3.11-python3.8_3.8.2-200313 RUN EOF # Install runtime dependencies - apk --no-cache add ffmpeg imagemagick imlib2 libogg libtheora libvpx mkvtoolnix nginx poppler-utils py3-geoip py3-lxml py3-numpy py3-pillow py3-psycopg2 + apk --no-cache add ffmpeg imagemagick imlib2 libogg libtheora libvpx mkvtoolnix nginx poppler-utils py3-lxml py3-numpy py3-pillow py3-psycopg2 pip3 install pyinotify # Install build dependencies apk --no-cache add --virtual .deps autoconf automake build-base flac-dev git imlib2-dev libogg-dev libtheora-dev libtool libvpx-dev libvorbis-dev python3-dev # Compile liboggz - wget https://ftp.osuosl.org/pub/xiph/releases/liboggz/liboggz-1.1.1.tar.gz -O /tmp/liboggz.tgz - tar xf /tmp/liboggz.tgz -C /tmp + wget https://ftp.osuosl.org/pub/xiph/releases/liboggz/liboggz-1.1.1.tar.gz -O - | tar xzf - -C /tmp cd /tmp/liboggz-1.1.1 ./configure make -j $(getconf _NPROCESSORS_ONLN) make install # Compile libfishsound - wget https://ftp.osuosl.org/pub/xiph/releases/libfishsound/libfishsound-1.0.0.tar.gz -O /tmp/libfishsound.tgz - tar xf /tmp/libfishsound.tgz -C /tmp/ + wget https://ftp.osuosl.org/pub/xiph/releases/libfishsound/libfishsound-1.0.0.tar.gz -O - | tar xzf - -C /tmp cd /tmp/libfishsound-1.0.0 ./configure make -j $(getconf _NPROCESSORS_ONLN) @@ -34,17 +32,17 @@ RUN EOF make install # Compile Oxframe - git clone --depth 1 https://code.0x2620.org/0x2620/oxframe /tmp/oxframe + git clone --depth 1 https://code.0x2620.org/0x2620/oxframe.git /tmp/oxframe cd /tmp/oxframe sed -i '/man\/oxframe/d' Makefile make make install # Clone Pandora git repositories - git clone --depth 1 https://git.0x2620.org/pandora.git /srv/pandora - git clone --depth 1 https://git.0x2620.org/oxjs.git /srv/pandora/static/oxjs - git clone --depth 1 https://git.0x2620.org/python-ox.git /srv/pandora/src/python-ox - git clone --depth 1 https://git.0x2620.org/oxtimelines.git /srv/pandora/src/oxtimelines + git clone --depth 1 https://code.0x2620.org/0x2620/pandora.git /srv/pandora + git clone --depth 1 https://code.0x2620.org/0x2620/oxjs.git /srv/pandora/static/oxjs + git clone --depth 1 https://code.0x2620.org/0x2620/python-ox.git /srv/pandora/src/python-ox + git clone --depth 1 https://code.0x2620.org/0x2620/oxtimelines.git /srv/pandora/src/oxtimelines pip3 install -e /srv/pandora/src/python-ox pip3 install -e /srv/pandora/src/oxtimelines pip3 install -r /srv/pandora/requirements.txt @@ -61,7 +59,7 @@ RUN EOF adduser -S -u 8080 -h /srv/pandora -s /bin/false -g pandora -G pandora pandora EOF -COPY lxc +COPY image.d RUN EOF # Update static files for Czech translation diff --git a/lxc-apps/pandora/lxc/etc/nginx/nginx.conf b/lxc-apps/pandora/image.d/etc/nginx/nginx.conf similarity index 100% rename from lxc-apps/pandora/lxc/etc/nginx/nginx.conf rename to lxc-apps/pandora/image.d/etc/nginx/nginx.conf diff --git a/lxc-apps/pandora/lxc/etc/services.d/.s6-svscan/finish b/lxc-apps/pandora/image.d/etc/services.d/.s6-svscan/finish similarity index 100% rename from lxc-apps/pandora/lxc/etc/services.d/.s6-svscan/finish rename to lxc-apps/pandora/image.d/etc/services.d/.s6-svscan/finish diff --git a/lxc-apps/pandora/lxc/etc/services.d/nginx/run b/lxc-apps/pandora/image.d/etc/services.d/nginx/run similarity index 100% rename from lxc-apps/pandora/lxc/etc/services.d/nginx/run rename to lxc-apps/pandora/image.d/etc/services.d/nginx/run diff --git a/lxc-apps/pandora/lxc/etc/services.d/pandora-cron/run b/lxc-apps/pandora/image.d/etc/services.d/pandora-cron/run similarity index 100% rename from lxc-apps/pandora/lxc/etc/services.d/pandora-cron/run rename to lxc-apps/pandora/image.d/etc/services.d/pandora-cron/run diff --git a/lxc-apps/pandora/lxc/etc/services.d/pandora-encoding/run b/lxc-apps/pandora/image.d/etc/services.d/pandora-encoding/run similarity index 100% rename from lxc-apps/pandora/lxc/etc/services.d/pandora-encoding/run rename to lxc-apps/pandora/image.d/etc/services.d/pandora-encoding/run diff --git a/lxc-apps/pandora/lxc/etc/services.d/pandora-tasks/run b/lxc-apps/pandora/image.d/etc/services.d/pandora-tasks/run similarity index 100% rename from lxc-apps/pandora/lxc/etc/services.d/pandora-tasks/run rename to lxc-apps/pandora/image.d/etc/services.d/pandora-tasks/run diff --git a/lxc-apps/pandora/lxc/etc/services.d/pandora/run b/lxc-apps/pandora/image.d/etc/services.d/pandora/run similarity index 100% rename from lxc-apps/pandora/lxc/etc/services.d/pandora/run rename to lxc-apps/pandora/image.d/etc/services.d/pandora/run diff --git a/lxc-apps/pandora/lxc/srv/pandora/static/json/locale.0xdb.cs.json b/lxc-apps/pandora/image.d/srv/pandora/static/json/locale.0xdb.cs.json similarity index 100% rename from lxc-apps/pandora/lxc/srv/pandora/static/json/locale.0xdb.cs.json rename to lxc-apps/pandora/image.d/srv/pandora/static/json/locale.0xdb.cs.json diff --git a/lxc-apps/pandora/lxc/srv/pandora/static/json/locale.pandora.cs.json b/lxc-apps/pandora/image.d/srv/pandora/static/json/locale.pandora.cs.json similarity index 100% rename from lxc-apps/pandora/lxc/srv/pandora/static/json/locale.pandora.cs.json rename to lxc-apps/pandora/image.d/srv/pandora/static/json/locale.pandora.cs.json diff --git a/lxc-apps/pandora/lxc/srv/pandora/static/oxjs/source/Ox/js/Constants.js b/lxc-apps/pandora/image.d/srv/pandora/static/oxjs/source/Ox/js/Constants.js similarity index 100% rename from lxc-apps/pandora/lxc/srv/pandora/static/oxjs/source/Ox/js/Constants.js rename to lxc-apps/pandora/image.d/srv/pandora/static/oxjs/source/Ox/js/Constants.js diff --git a/lxc-apps/pandora/lxc/srv/pandora/static/oxjs/source/Ox/json/locale.cs.json b/lxc-apps/pandora/image.d/srv/pandora/static/oxjs/source/Ox/json/locale.cs.json similarity index 100% rename from lxc-apps/pandora/lxc/srv/pandora/static/oxjs/source/Ox/json/locale.cs.json rename to lxc-apps/pandora/image.d/srv/pandora/static/oxjs/source/Ox/json/locale.cs.json diff --git a/lxc-apps/pandora/lxc/srv/pandora/static/oxjs/source/UI/json/locale.cs.json b/lxc-apps/pandora/image.d/srv/pandora/static/oxjs/source/UI/json/locale.cs.json similarity index 100% rename from lxc-apps/pandora/lxc/srv/pandora/static/oxjs/source/UI/json/locale.cs.json rename to lxc-apps/pandora/image.d/srv/pandora/static/oxjs/source/UI/json/locale.cs.json diff --git a/lxc-apps/pandora/install.sh b/lxc-apps/pandora/install.sh index 3636e59..3021f44 100755 --- a/lxc-apps/pandora/install.sh +++ b/lxc-apps/pandora/install.sh @@ -1,59 +1,58 @@ #!/bin/sh set -ev +# Volumes +POSTGRES_DATA="${VOLUMES_DIR}/pandora/postgres_data" +RABBITMQ_DATA="${VOLUMES_DIR}/pandora/rabbitmq_data" +PANDORA_CONF="${VOLUMES_DIR}/pandora/pandora_conf" +PANDORA_DATA="${VOLUMES_DIR}/pandora/pandora_data" + # Create Postgres instance -mkdir -p /srv/pandora/postgres_data -chown -R 105432:105432 /srv/pandora/postgres_data -chmod 700 /srv/pandora/postgres_data -lxc-execute -n pandora-postgres -- initdb -D /var/lib/postgresql +install -o 105432 -g 105432 -m 700 -d ${POSTGRES_DATA} +spoc-container exec pandora-postgres -- initdb -D /var/lib/postgresql # Configure Postgres -cp postgres_data/postgresql.conf /srv/pandora/postgres_data/postgresql.conf -cp postgres_data/pg_hba.conf /srv/pandora/postgres_data/pg_hba.conf +install -o 105432 -g 105432 -m 600 postgres_data/postgresql.conf ${POSTGRES_DATA}/postgresql.conf +install -o 105432 -g 105432 -m 600 postgres_data/pg_hba.conf ${POSTGRES_DATA}/pg_hba.conf # Create PostgreSQL user and database export PANDORA_PWD=$(head -c 18 /dev/urandom | base64 | tr -d '+/=') -service lxc-pandora-postgres start -envsubst /srv/pandora/pandora_conf/local_settings.py -chown -R 108080:108080 /srv/pandora/pandora_conf +install -o 108080 -g 108080 -m 750 -d ${PANDORA_CONF} +install -o 108080 -g 108080 -m 750 -d ${PANDORA_DATA} +install -o 108080 -g 108080 -m 640 pandora_conf/config.jsonc ${PANDORA_CONF}/config.jsonc +install -o 108080 -g 108080 -m 640 pandora_conf/gunicorn_config.py ${PANDORA_CONF}/gunicorn_config.py +envsubst