From 629e2475706d31cfc1811ea4574f192c590e0ccc Mon Sep 17 00:00:00 2001 From: Disassembler Date: Thu, 13 Sep 2018 14:15:22 +0200 Subject: [PATCH] LXCize Pandora build --- pandora/Dockerfile | 86 ---------------- pandora/{docker => lxc}/etc/nginx/nginx.conf | 0 .../etc/services.d/.s6-svscan/finish | 0 .../{docker => lxc}/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 pandora/lxcfile | 98 +++++++++++++++++++ pandora/{build.sh => setup.sh} | 0 pandora/{ => setup}/adminpwd.sql | 0 pandora/{ => setup}/createdb.sql | 0 pandora/{ => setup}/etc/init.d/pandora | 0 .../{ => setup}/srv/pandora/conf/config.jsonc | 0 .../srv/pandora/conf/gunicorn_config.py | 0 .../srv/pandora/conf/local_settings.py | 0 21 files changed, 98 insertions(+), 86 deletions(-) delete mode 100644 pandora/Dockerfile rename pandora/{docker => lxc}/etc/nginx/nginx.conf (100%) rename pandora/{docker => lxc}/etc/services.d/.s6-svscan/finish (100%) rename pandora/{docker => lxc}/etc/services.d/nginx/run (100%) rename pandora/{docker => lxc}/etc/services.d/pandora-cron/run (100%) rename pandora/{docker => lxc}/etc/services.d/pandora-encoding/run (100%) rename pandora/{docker => lxc}/etc/services.d/pandora-tasks/run (100%) rename pandora/{docker => lxc}/etc/services.d/pandora/run (100%) rename pandora/{docker => lxc}/srv/pandora/static/json/locale.0xdb.cs.json (100%) rename pandora/{docker => lxc}/srv/pandora/static/json/locale.pandora.cs.json (100%) rename pandora/{docker => lxc}/srv/pandora/static/oxjs/source/Ox/js/Constants.js (100%) rename pandora/{docker => lxc}/srv/pandora/static/oxjs/source/Ox/json/locale.cs.json (100%) rename pandora/{docker => lxc}/srv/pandora/static/oxjs/source/UI/json/locale.cs.json (100%) create mode 100644 pandora/lxcfile rename pandora/{build.sh => setup.sh} (100%) rename pandora/{ => setup}/adminpwd.sql (100%) rename pandora/{ => setup}/createdb.sql (100%) rename pandora/{ => setup}/etc/init.d/pandora (100%) rename pandora/{ => setup}/srv/pandora/conf/config.jsonc (100%) rename pandora/{ => setup}/srv/pandora/conf/gunicorn_config.py (100%) rename pandora/{ => setup}/srv/pandora/conf/local_settings.py (100%) diff --git a/pandora/Dockerfile b/pandora/Dockerfile deleted file mode 100644 index 956322e..0000000 --- a/pandora/Dockerfile +++ /dev/null @@ -1,86 +0,0 @@ -FROM python3 -LABEL maintainer="Disassembler " - -RUN \ - # 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 \ - && pip3 install pyinotify - -RUN \ - # 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 \ - && 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/ \ - && cd /tmp/libfishsound-1.0.0 \ - && ./configure \ - && make -j $(getconf _NPROCESSORS_ONLN) \ - && make install \ - # Compile liboggplay - && git clone --depth 1 git://git.xiph.org/liboggplay.git /tmp/liboggplay \ - && cd /tmp/liboggplay \ - && ./autogen.sh \ - && ./configure \ - && make -j $(getconf _NPROCESSORS_ONLN) \ - && make install \ - # Compile Oxframe - && git clone --depth 1 https://code.0x2620.org/0x2620/oxframe /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 \ - && pip3 install -e /srv/pandora/src/python-ox \ - && pip3 install -e /srv/pandora/src/oxtimelines \ - && pip3 install -r /srv/pandora/requirements.txt \ - # Compile pyc and static files - && cd /srv/pandora/pandora \ - && ln -s config.pandora.jsonc config.jsonc \ - && ./manage.py update_static \ - && ./manage.py compile_pyc -p /srv/pandora/pandora \ - && ./manage.py collectstatic -l --noinput \ - # Create OS user - && addgroup -S -g 8002 pandora \ - && adduser -S -u 8002 -h /srv/pandora -s /bin/false -g pandora -G pandora pandora \ - && chown -R 8002:8002 /srv/pandora \ - # Cleanup - && apk --no-cache del .deps \ - && find /srv/pandora -name '.git*' -exec rm -rf {} + \ - && rm -rf /tmp/lib* /tmp/oxframe \ - && rm -rf /root/.cache /root/.ox - -COPY --chown=8002:8002 docker/srv/ /srv/ - -RUN \ - # Update static files for Czech translation - cd /srv/pandora/pandora \ - && ./manage.py update_static \ - # Hackfix missing virtualenv - && mkdir /srv/pandora/bin \ - && ln -s /usr/bin/oxtimelines /srv/pandora/bin/oxtimelines \ - # Create mount with dummy conf files - && mkdir /srv/pandora/conf \ - && rm config.jsonc \ - && ln -s /srv/pandora/conf/config.jsonc config.jsonc \ - && ln -s /srv/pandora/conf/gunicorn_config.py gunicorn_config.py \ - && ln -s /srv/pandora/conf/local_settings.py local_settings.py \ - && chown -R 8002:8002 /srv/pandora - -COPY docker/etc/ /etc/ - -VOLUME ["/srv/pandora/conf", "/srv/pandora/data"] -EXPOSE 8080 - -WORKDIR /srv/pandora -CMD ["s6-svscan", "/etc/services.d"] diff --git a/pandora/docker/etc/nginx/nginx.conf b/pandora/lxc/etc/nginx/nginx.conf similarity index 100% rename from pandora/docker/etc/nginx/nginx.conf rename to pandora/lxc/etc/nginx/nginx.conf diff --git a/pandora/docker/etc/services.d/.s6-svscan/finish b/pandora/lxc/etc/services.d/.s6-svscan/finish similarity index 100% rename from pandora/docker/etc/services.d/.s6-svscan/finish rename to pandora/lxc/etc/services.d/.s6-svscan/finish diff --git a/pandora/docker/etc/services.d/nginx/run b/pandora/lxc/etc/services.d/nginx/run similarity index 100% rename from pandora/docker/etc/services.d/nginx/run rename to pandora/lxc/etc/services.d/nginx/run diff --git a/pandora/docker/etc/services.d/pandora-cron/run b/pandora/lxc/etc/services.d/pandora-cron/run similarity index 100% rename from pandora/docker/etc/services.d/pandora-cron/run rename to pandora/lxc/etc/services.d/pandora-cron/run diff --git a/pandora/docker/etc/services.d/pandora-encoding/run b/pandora/lxc/etc/services.d/pandora-encoding/run similarity index 100% rename from pandora/docker/etc/services.d/pandora-encoding/run rename to pandora/lxc/etc/services.d/pandora-encoding/run diff --git a/pandora/docker/etc/services.d/pandora-tasks/run b/pandora/lxc/etc/services.d/pandora-tasks/run similarity index 100% rename from pandora/docker/etc/services.d/pandora-tasks/run rename to pandora/lxc/etc/services.d/pandora-tasks/run diff --git a/pandora/docker/etc/services.d/pandora/run b/pandora/lxc/etc/services.d/pandora/run similarity index 100% rename from pandora/docker/etc/services.d/pandora/run rename to pandora/lxc/etc/services.d/pandora/run diff --git a/pandora/docker/srv/pandora/static/json/locale.0xdb.cs.json b/pandora/lxc/srv/pandora/static/json/locale.0xdb.cs.json similarity index 100% rename from pandora/docker/srv/pandora/static/json/locale.0xdb.cs.json rename to pandora/lxc/srv/pandora/static/json/locale.0xdb.cs.json diff --git a/pandora/docker/srv/pandora/static/json/locale.pandora.cs.json b/pandora/lxc/srv/pandora/static/json/locale.pandora.cs.json similarity index 100% rename from pandora/docker/srv/pandora/static/json/locale.pandora.cs.json rename to pandora/lxc/srv/pandora/static/json/locale.pandora.cs.json diff --git a/pandora/docker/srv/pandora/static/oxjs/source/Ox/js/Constants.js b/pandora/lxc/srv/pandora/static/oxjs/source/Ox/js/Constants.js similarity index 100% rename from pandora/docker/srv/pandora/static/oxjs/source/Ox/js/Constants.js rename to pandora/lxc/srv/pandora/static/oxjs/source/Ox/js/Constants.js diff --git a/pandora/docker/srv/pandora/static/oxjs/source/Ox/json/locale.cs.json b/pandora/lxc/srv/pandora/static/oxjs/source/Ox/json/locale.cs.json similarity index 100% rename from pandora/docker/srv/pandora/static/oxjs/source/Ox/json/locale.cs.json rename to pandora/lxc/srv/pandora/static/oxjs/source/Ox/json/locale.cs.json diff --git a/pandora/docker/srv/pandora/static/oxjs/source/UI/json/locale.cs.json b/pandora/lxc/srv/pandora/static/oxjs/source/UI/json/locale.cs.json similarity index 100% rename from pandora/docker/srv/pandora/static/oxjs/source/UI/json/locale.cs.json rename to pandora/lxc/srv/pandora/static/oxjs/source/UI/json/locale.cs.json diff --git a/pandora/lxcfile b/pandora/lxcfile new file mode 100644 index 0000000..1b01a2f --- /dev/null +++ b/pandora/lxcfile @@ -0,0 +1,98 @@ +IMAGE pandora +LAYER shared/alpine +LAYER shared/libxml +LAYER shared/python3 +LAYER pandora/pandora + +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 + 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 + 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/ + cd /tmp/libfishsound-1.0.0 + ./configure + make -j $(getconf _NPROCESSORS_ONLN) + make install + + # Compile liboggplay + git clone --depth 1 git://git.xiph.org/liboggplay.git /tmp/liboggplay + cd /tmp/liboggplay + ./autogen.sh + ./configure + make -j $(getconf _NPROCESSORS_ONLN) + make install + + # Compile Oxframe + git clone --depth 1 https://code.0x2620.org/0x2620/oxframe /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 + pip3 install -e /srv/pandora/src/python-ox + pip3 install -e /srv/pandora/src/oxtimelines + pip3 install -r /srv/pandora/requirements.txt + + # Compile pyc and static files + cd /srv/pandora/pandora + ln -s config.pandora.jsonc config.jsonc + ./manage.py update_static + ./manage.py compile_pyc -p /srv/pandora/pandora + ./manage.py collectstatic -l --noinput + + # Create OS user + addgroup -S -g 8002 pandora + adduser -S -u 8002 -h /srv/pandora -s /bin/false -g pandora -G pandora pandora + chown -R 8002:8002 /srv/pandora + + # Cleanup + apk --no-cache del .deps + find /srv/pandora -name '.git*' -exec rm -rf {} + + rm -rf /tmp/lib* /tmp/oxframe + rm -rf /root/.cache /root/.ox +EOF + +COPY lxc + +RUN EOF + # Update static files for Czech translation + cd /srv/pandora/pandora + ./manage.py update_static + + # Hackfix missing virtualenv + mkdir /srv/pandora/bin + ln -s /usr/bin/oxtimelines /srv/pandora/bin/oxtimelines + + # Create mount with dummy conf files + mkdir /srv/pandora/conf + rm config.jsonc + ln -s /srv/pandora/conf/config.jsonc config.jsonc + ln -s /srv/pandora/conf/gunicorn_config.py gunicorn_config.py + ln -s /srv/pandora/conf/local_settings.py local_settings.py + chown -R 8002:8002 /srv/pandora +EOF + +MOUNT /srv/pandora/conf srv/pandora/conf +MOUNT /srv/pandora/data srv/pandora/data + +WORKDIR /srv/pandora +CMD /bin/s6-svscan /etc/services.d diff --git a/pandora/build.sh b/pandora/setup.sh similarity index 100% rename from pandora/build.sh rename to pandora/setup.sh diff --git a/pandora/adminpwd.sql b/pandora/setup/adminpwd.sql similarity index 100% rename from pandora/adminpwd.sql rename to pandora/setup/adminpwd.sql diff --git a/pandora/createdb.sql b/pandora/setup/createdb.sql similarity index 100% rename from pandora/createdb.sql rename to pandora/setup/createdb.sql diff --git a/pandora/etc/init.d/pandora b/pandora/setup/etc/init.d/pandora similarity index 100% rename from pandora/etc/init.d/pandora rename to pandora/setup/etc/init.d/pandora diff --git a/pandora/srv/pandora/conf/config.jsonc b/pandora/setup/srv/pandora/conf/config.jsonc similarity index 100% rename from pandora/srv/pandora/conf/config.jsonc rename to pandora/setup/srv/pandora/conf/config.jsonc diff --git a/pandora/srv/pandora/conf/gunicorn_config.py b/pandora/setup/srv/pandora/conf/gunicorn_config.py similarity index 100% rename from pandora/srv/pandora/conf/gunicorn_config.py rename to pandora/setup/srv/pandora/conf/gunicorn_config.py diff --git a/pandora/srv/pandora/conf/local_settings.py b/pandora/setup/srv/pandora/conf/local_settings.py similarity index 100% rename from pandora/srv/pandora/conf/local_settings.py rename to pandora/setup/srv/pandora/conf/local_settings.py