From 0b210f27a2c9d74f8ee41baa7ac2c1150811774c Mon Sep 17 00:00:00 2001 From: Peter Schiffer <3899107+pschiffe@users.noreply.github.com> Date: Tue, 5 Oct 2021 23:00:49 +0200 Subject: [PATCH] Delete pdns-admin-uwsgi directory This directory contains legacy version of pdns admin backend. --- pdns-admin-uwsgi/Dockerfile | 42 -------------------------- pdns-admin-uwsgi/config.py.tpl | 14 --------- pdns-admin-uwsgi/docker-cmd.sh | 53 --------------------------------- pdns-admin-uwsgi/pdns-admin.ini | 20 ------------- 4 files changed, 129 deletions(-) delete mode 100644 pdns-admin-uwsgi/Dockerfile delete mode 100644 pdns-admin-uwsgi/config.py.tpl delete mode 100755 pdns-admin-uwsgi/docker-cmd.sh delete mode 100644 pdns-admin-uwsgi/pdns-admin.ini diff --git a/pdns-admin-uwsgi/Dockerfile b/pdns-admin-uwsgi/Dockerfile deleted file mode 100644 index fb3effd..0000000 --- a/pdns-admin-uwsgi/Dockerfile +++ /dev/null @@ -1,42 +0,0 @@ -FROM fedora:29 - -RUN dnf -y --setopt=install_weak_deps=False install \ - python-pip \ - python2-mysql \ - python-ldap \ - mariadb \ - uwsgi \ - uwsgi-plugin-python2 \ - && dnf clean all - -RUN mkdir -p /opt/powerdns-admin \ - && curl -sSL https://git.0x97.io/0x97/powerdns-admin/repository/master/archive.tar.gz \ - | tar -xzC /opt/powerdns-admin --strip 1 \ - && sed -i '/MySQL-python/d' /opt/powerdns-admin/requirements.txt \ - && sed -i '/python-ldap/d' /opt/powerdns-admin/requirements.txt \ - && chown -R root: /opt/powerdns-admin \ - && chown -R uwsgi: /opt/powerdns-admin/upload - -WORKDIR /opt/powerdns-admin - -RUN pip3 install --no-cache-dir envtpl \ - && pip install -r requirements.txt --no-cache-dir - -ENV PDNS_ADMIN_LOGIN_TITLE="'PDNS'" \ - PDNS_ADMIN_TIMEOUT=10 \ - PDNS_ADMIN_LOG_LEVEL="'INFO'" \ - PDNS_ADMIN_BASIC_ENABLED=True \ - PDNS_ADMIN_SIGNUP_ENABLED=True \ - PDNS_ADMIN_RECORDS_ALLOW_EDIT="['SOA', 'NS', 'A', 'AAAA', 'CNAME', 'MX', 'TXT', 'SRV']" - -EXPOSE 9494 - -VOLUME [ "/opt/powerdns-admin/upload" ] - -COPY pdns-admin.ini /etc/uwsgi.d/ -RUN chown uwsgi: /etc/uwsgi.d/pdns-admin.ini - -COPY config.py.tpl / -COPY docker-cmd.sh / - -CMD [ "/docker-cmd.sh" ] diff --git a/pdns-admin-uwsgi/config.py.tpl b/pdns-admin-uwsgi/config.py.tpl deleted file mode 100644 index 2e7ed30..0000000 --- a/pdns-admin-uwsgi/config.py.tpl +++ /dev/null @@ -1,14 +0,0 @@ -import os -basedir = os.path.abspath(os.path.dirname(__file__)) - -{% 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' -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-uwsgi/docker-cmd.sh b/pdns-admin-uwsgi/docker-cmd.sh deleted file mode 100755 index b8afa11..0000000 --- a/pdns-admin-uwsgi/docker-cmd.sh +++ /dev/null @@ -1,53 +0,0 @@ -#!/bin/sh - -set -euo pipefail - -# Configure mysql env vars -: "${PDNS_ADMIN_SQLA_DB_HOST:='mysql'}" -: "${PDNS_ADMIN_SQLA_DB_PORT:='3306'}" -: "${PDNS_ADMIN_SQLA_DB_USER:='${MYSQL_ENV_MYSQL_USER:-root}'}" -if [ "${PDNS_ADMIN_SQLA_DB_USER}" = "'root'" ]; then - : "${PDNS_ADMIN_SQLA_DB_PASSWORD:='$MYSQL_ENV_MYSQL_ROOT_PASSWORD'}" -fi -: "${PDNS_ADMIN_SQLA_DB_PASSWORD:='${MYSQL_ENV_MYSQL_PASSWORD:-powerdnsadmin}'}" -: "${PDNS_ADMIN_SQLA_DB_NAME:='${MYSQL_ENV_MYSQL_DATABASE:-powerdnsadmin}'}" - -export PDNS_ADMIN_SQLA_DB_HOST PDNS_ADMIN_SQLA_DB_PORT PDNS_ADMIN_SQLA_DB_USER PDNS_ADMIN_SQLA_DB_PASSWORD PDNS_ADMIN_SQLA_DB_NAME - -# Configure pdns server env vars -: "${PDNS_ADMIN_PDNS_STATS_URL:='http://pdns:${PDNS_ENV_PDNS_webserver_port:-8081}/'}" -: "${PDNS_ADMIN_PDNS_API_KEY:='${PDNS_ENV_PDNS_api_key:-}'}" -: "${PDNS_ADMIN_PDNS_VERSION:='${PDNS_ENV_VERSION:-}'}" - -export PDNS_ADMIN_PDNS_STATS_URL PDNS_ADMIN_PDNS_API_KEY PDNS_ADMIN_PDNS_VERSION - -# Generate secret key -[ -f /root/secret-key ] || tr -dc _A-Z-a-z-0-9 < /dev/urandom | head -c 32 > /root/secret-key || true -PDNS_ADMIN_SECRET_KEY="'$(cat /root/secret-key)'" - -export PDNS_ADMIN_SECRET_KEY - -envtpl < /config.py.tpl > /opt/powerdns-admin/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//\'/}" - -until $MYSQL_COMMAND -e ';' ; do - >&2 echo 'MySQL is unavailable - sleeping' - sleep 1 -done - -$MYSQL_COMMAND -e "CREATE DATABASE IF NOT EXISTS ${PDNS_ADMIN_SQLA_DB_NAME//\'/}" - -MYSQL_CHECK_IF_HAS_TABLE="SELECT COUNT(DISTINCT table_name) FROM information_schema.columns WHERE table_schema = '${PDNS_ADMIN_SQLA_DB_NAME//\'/}';" -MYSQL_NUM_TABLE=$($MYSQL_COMMAND --batch --skip-column-names -e "$MYSQL_CHECK_IF_HAS_TABLE") -if [ "$MYSQL_NUM_TABLE" -eq 0 ]; then - python2 /opt/powerdns-admin/create_db.py -fi - -# python2 /opt/powerdns-admin/db_upgrade.py - -mkdir -p /run/uwsgi -chown uwsgi: /run/uwsgi - -exec /usr/sbin/uwsgi --ini /etc/uwsgi.ini diff --git a/pdns-admin-uwsgi/pdns-admin.ini b/pdns-admin-uwsgi/pdns-admin.ini deleted file mode 100644 index be11863..0000000 --- a/pdns-admin-uwsgi/pdns-admin.ini +++ /dev/null @@ -1,20 +0,0 @@ -[uwsgi] -plugins = python - -uid = uwsgi -gid = uwsgi - -chdir = /opt/powerdns-admin -pythonpath = /opt/powerdns-admin - -mount = /=run.py -manage-script-name = true -callable = app - -vacuum = true -harakiri = 20 -post-buffering = 8192 -socket = 0.0.0.0:9494 -pidfile = /run/uwsgi/%n.pid - -enable-threads = true