Delete pdns-admin-uwsgi directory

This directory contains legacy version of pdns admin backend.
This commit is contained in:
Peter Schiffer 2021-10-05 23:00:49 +02:00 committed by GitHub
parent 8640fd15f0
commit 0b210f27a2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 0 additions and 129 deletions

View file

@ -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" ]

View file

@ -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

View file

@ -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

View file

@ -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