mirror of
https://github.com/cwinfo/powerdns-admin.git
synced 2025-01-07 19:05:39 +00:00
Merge remote-tracking branch 'xakraz/master'
This commit is contained in:
commit
d29628a90a
@ -5,7 +5,7 @@ basedir = os.path.abspath(os.path.dirname(__file__))
|
|||||||
WTF_CSRF_ENABLED = True
|
WTF_CSRF_ENABLED = True
|
||||||
SECRET_KEY = 'changeme'
|
SECRET_KEY = 'changeme'
|
||||||
LOG_LEVEL = 'DEBUG'
|
LOG_LEVEL = 'DEBUG'
|
||||||
LOG_FILE = 'log.txt'
|
LOG_FILE = 'logs/log.txt'
|
||||||
|
|
||||||
# TIMEOUT - for large zones
|
# TIMEOUT - for large zones
|
||||||
TIMEOUT = 10
|
TIMEOUT = 10
|
||||||
|
@ -14,8 +14,14 @@ services:
|
|||||||
ports:
|
ports:
|
||||||
- "9191:9191"
|
- "9191:9191"
|
||||||
volumes:
|
volumes:
|
||||||
|
# Code
|
||||||
- .:/powerdns-admin/
|
- .:/powerdns-admin/
|
||||||
- "./configs/${ENVIRONMENT}.py:/powerdns-admin/config.py"
|
- "./configs/${ENVIRONMENT}.py:/powerdns-admin/config.py"
|
||||||
|
# Assets dir volume
|
||||||
|
- powerdns-admin-assets:/powerdns-admin/app/static
|
||||||
|
- powerdns-admin-assets2:/powerdns-admin/node_modules
|
||||||
|
- powerdns-admin-assets3:/powerdns-admin/logs
|
||||||
|
- ./app/static/custom:/powerdns-admin/app/static/custom
|
||||||
logging:
|
logging:
|
||||||
driver: json-file
|
driver: json-file
|
||||||
options:
|
options:
|
||||||
@ -41,8 +47,10 @@ services:
|
|||||||
container_name: powerdns-admin-mysql
|
container_name: powerdns-admin-mysql
|
||||||
mem_limit: 256M
|
mem_limit: 256M
|
||||||
memswap_limit: 256M
|
memswap_limit: 256M
|
||||||
ports:
|
expose:
|
||||||
- "3306:3306"
|
- 3306
|
||||||
|
volumes:
|
||||||
|
- powerdns-admin-mysql-data:/var/lib/mysql
|
||||||
networks:
|
networks:
|
||||||
- default
|
- default
|
||||||
environment:
|
environment:
|
||||||
@ -78,8 +86,10 @@ services:
|
|||||||
container_name: ${PDNS_DB_HOST}
|
container_name: ${PDNS_DB_HOST}
|
||||||
mem_limit: 256M
|
mem_limit: 256M
|
||||||
memswap_limit: 256M
|
memswap_limit: 256M
|
||||||
ports:
|
expose:
|
||||||
- "3307:3306"
|
- 3306
|
||||||
|
volumes:
|
||||||
|
- powerdns-mysql-data:/var/lib/mysql
|
||||||
networks:
|
networks:
|
||||||
- default
|
- default
|
||||||
environment:
|
environment:
|
||||||
@ -96,3 +106,7 @@ networks:
|
|||||||
|
|
||||||
volumes:
|
volumes:
|
||||||
powerdns-mysql-data:
|
powerdns-mysql-data:
|
||||||
|
powerdns-admin-mysql-data:
|
||||||
|
powerdns-admin-assets:
|
||||||
|
powerdns-admin-assets2:
|
||||||
|
powerdns-admin-assets3:
|
||||||
|
@ -1,6 +1,17 @@
|
|||||||
#!/bin/sh
|
#!/bin/bash
|
||||||
|
|
||||||
|
set -o nounset
|
||||||
|
set -o errexit
|
||||||
|
set -o pipefail
|
||||||
|
|
||||||
|
|
||||||
|
# == Vars
|
||||||
|
#
|
||||||
|
DB_MIGRATION_DIR='/powerdns-admin/migrations'
|
||||||
|
|
||||||
|
|
||||||
# Wait for us to be able to connect to MySQL before proceeding
|
# Wait for us to be able to connect to MySQL before proceeding
|
||||||
|
echo "===> Waiting for $PDA_DB_HOST MySQL service"
|
||||||
until nc -zv \
|
until nc -zv \
|
||||||
$PDA_DB_HOST \
|
$PDA_DB_HOST \
|
||||||
3306;
|
3306;
|
||||||
@ -9,20 +20,37 @@ do
|
|||||||
sleep 1
|
sleep 1
|
||||||
done
|
done
|
||||||
|
|
||||||
|
|
||||||
|
echo "===> DB management"
|
||||||
|
# Go in Workdir
|
||||||
cd /powerdns-admin
|
cd /powerdns-admin
|
||||||
|
|
||||||
if [ ! -d "/powerdns-admin/migrations" ]; then
|
if [ ! -d "${DB_MIGRATION_DIR}" ]; then
|
||||||
flask db init --directory /powerdns-admin/migrations
|
echo "---> Running DB Init"
|
||||||
flask db migrate -m "Init DB" --directory /powerdns-admin/migrations
|
flask db init --directory ${DB_MIGRATION_DIR}
|
||||||
flask db upgrade --directory /powerdns-admin/migrations
|
flask db migrate -m "Init DB" --directory ${DB_MIGRATION_DIR}
|
||||||
./init_data.py
|
flask db upgrade --directory ${DB_MIGRATION_DIR}
|
||||||
|
./init_data.py
|
||||||
|
|
||||||
else
|
else
|
||||||
/usr/local/bin/flask db migrate -m "Upgrade BD Schema" --directory /powerdns-admin/migrations
|
echo "---> Running DB Migration"
|
||||||
/usr/local/bin/flask db upgrade --directory /powerdns-admin/migrations
|
set +e
|
||||||
|
flask db migrate -m "Upgrade BD Schema" --directory ${DB_MIGRATION_DIR}
|
||||||
|
flask db upgrade --directory ${DB_MIGRATION_DIR}
|
||||||
|
set -e
|
||||||
fi
|
fi
|
||||||
|
|
||||||
yarn install --pure-lockfile
|
|
||||||
flask assets build
|
|
||||||
|
|
||||||
|
echo "===> Assets management"
|
||||||
|
echo "---> Running Yarn"
|
||||||
|
chown -R www-data:www-data /powerdns-admin/app/static
|
||||||
|
chown -R www-data:www-data /powerdns-admin/node_modules
|
||||||
|
su -s /bin/bash -c 'yarn install --pure-lockfile' www-data
|
||||||
|
|
||||||
|
echo "---> Running Flask assets"
|
||||||
|
chown -R www-data:www-data /powerdns-admin/logs
|
||||||
|
su -s /bin/bash -c 'flask assets build' www-data
|
||||||
|
|
||||||
|
|
||||||
|
echo "===> Start supervisor"
|
||||||
/usr/bin/supervisord -c /etc/supervisord.conf
|
/usr/bin/supervisord -c /etc/supervisord.conf
|
||||||
|
Loading…
Reference in New Issue
Block a user