From c8f3785b1de8342c573ebc567ac516f272c997ce Mon Sep 17 00:00:00 2001 From: Peter Schiffer Date: Wed, 8 Jan 2020 01:07:16 +0100 Subject: [PATCH] Update pdns admin to match the latest upstream --- pdns-admin-base-ngoduykhanh/Dockerfile | 5 ++--- pdns-admin-base-ngoduykhanh/config.py.tpl | 15 +++++++++------ pdns-admin-base-ngoduykhanh/run.py | 5 +++++ pdns-admin-static-ngoduykhanh/pdns-nginx.conf | 2 +- pdns-admin-uwsgi-ngoduykhanh/Dockerfile | 4 ---- pdns-admin-uwsgi-ngoduykhanh/docker-entrypoint.sh | 2 +- 6 files changed, 18 insertions(+), 15 deletions(-) create mode 100644 pdns-admin-base-ngoduykhanh/run.py diff --git a/pdns-admin-base-ngoduykhanh/Dockerfile b/pdns-admin-base-ngoduykhanh/Dockerfile index 3acfefb..a538284 100644 --- a/pdns-admin-base-ngoduykhanh/Dockerfile +++ b/pdns-admin-base-ngoduykhanh/Dockerfile @@ -22,11 +22,10 @@ WORKDIR /opt/powerdns-admin RUN pip3 install --no-cache-dir envtpl python-dotenv \ && pip3 install -r requirements.txt --no-cache-dir -ENV FLASK_APP=/opt/powerdns-admin/powerdnsadmin/__init__.py \ - PDNS_ADMIN_LOG_LEVEL="'INFO'" \ - PDNS_ADMIN_SAML_ENABLED=False +ENV FLASK_APP=/opt/powerdns-admin/powerdnsadmin/__init__.py COPY config.py.tpl / +COPY run.py . RUN envtpl < /config.py.tpl > /opt/powerdns-admin/config.py \ && sed -i '/SQLALCHEMY_DATABASE_URI/d' /opt/powerdns-admin/config.py diff --git a/pdns-admin-base-ngoduykhanh/config.py.tpl b/pdns-admin-base-ngoduykhanh/config.py.tpl index 2e7ed30..15e9b69 100644 --- a/pdns-admin-base-ngoduykhanh/config.py.tpl +++ b/pdns-admin-base-ngoduykhanh/config.py.tpl @@ -1,14 +1,17 @@ import os basedir = os.path.abspath(os.path.dirname(__file__)) +### BASIC APP CONFIG +BIND_ADDRESS = '0.0.0.0' +PORT = 9191 +HSTS_ENABLED = False + +# SAML Authnetication +SAML_ENABLED = False + {% for key, value in environment('PDNS_ADMIN_') %}{{ key }} = {{ value }} {% endfor %} -WTF_CSRF_ENABLED = True -BIND_ADDRESS = '0.0.0.0' -PORT = 9393 -LOG_FILE = '' -UPLOAD_DIR = '/opt/powerdns-admin/upload' +### DATABASE CONFIG SQLALCHEMY_DATABASE_URI = 'mysql://' + SQLA_DB_USER + ':' + SQLA_DB_PASSWORD + '@' + SQLA_DB_HOST + ':' + SQLA_DB_PORT + '/' + SQLA_DB_NAME -SQLALCHEMY_MIGRATE_REPO = os.path.join(basedir, 'db_repository') SQLALCHEMY_TRACK_MODIFICATIONS = True diff --git a/pdns-admin-base-ngoduykhanh/run.py b/pdns-admin-base-ngoduykhanh/run.py new file mode 100644 index 0000000..820233a --- /dev/null +++ b/pdns-admin-base-ngoduykhanh/run.py @@ -0,0 +1,5 @@ +#!/usr/bin/env python3 + +from powerdnsadmin import create_app + +app = create_app() diff --git a/pdns-admin-static-ngoduykhanh/pdns-nginx.conf b/pdns-admin-static-ngoduykhanh/pdns-nginx.conf index 4643de7..08be5a3 100644 --- a/pdns-admin-static-ngoduykhanh/pdns-nginx.conf +++ b/pdns-admin-static-ngoduykhanh/pdns-nginx.conf @@ -36,7 +36,7 @@ http { server_name _; location /static/ { - alias /opt/powerdns-admin/app/static/; + alias /opt/powerdns-admin/powerdnsadmin/static/; } location / { diff --git a/pdns-admin-uwsgi-ngoduykhanh/Dockerfile b/pdns-admin-uwsgi-ngoduykhanh/Dockerfile index 1927a11..33f7a92 100644 --- a/pdns-admin-uwsgi-ngoduykhanh/Dockerfile +++ b/pdns-admin-uwsgi-ngoduykhanh/Dockerfile @@ -7,14 +7,10 @@ RUN dnf -y --setopt=install_weak_deps=False install \ EXPOSE 9494 -VOLUME [ "/opt/powerdns-admin/upload" ] - COPY docker-entrypoint.sh / COPY pdns-admin.ini /etc/uwsgi.ini RUN chown uwsgi: /etc/uwsgi.ini -ENV FLASK_APP=/opt/powerdns-admin/app/__init__.py - ENTRYPOINT [ "/docker-entrypoint.sh" ] CMD [ "/usr/sbin/uwsgi", "--ini", "/etc/uwsgi.ini" ] diff --git a/pdns-admin-uwsgi-ngoduykhanh/docker-entrypoint.sh b/pdns-admin-uwsgi-ngoduykhanh/docker-entrypoint.sh index 5c62ae7..0d6c750 100755 --- a/pdns-admin-uwsgi-ngoduykhanh/docker-entrypoint.sh +++ b/pdns-admin-uwsgi-ngoduykhanh/docker-entrypoint.sh @@ -25,7 +25,7 @@ PDNS_ADMIN_SECRET_KEY="'$(cat /root/secret-key)'" export PDNS_ADMIN_SECRET_KEY -envtpl < /config.py.tpl > /opt/powerdns-admin/config.py +envtpl < /config.py.tpl > /opt/powerdns-admin/powerdnsadmin/default_config.py # Initialize DB if needed MYSQL_COMMAND="mysql -h ${PDNS_ADMIN_SQLA_DB_HOST//\'/} -P ${PDNS_ADMIN_SQLA_DB_PORT//\'/} -u ${PDNS_ADMIN_SQLA_DB_USER//\'/} -p${PDNS_ADMIN_SQLA_DB_PASSWORD//\'/}"