Move preparation to database-setup.

This commit is contained in:
David Mc Ken
2022-12-08 21:44:52 -04:00
parent 2dec2ad204
commit dc495ce426
2 changed files with 9 additions and 12 deletions

View File

@ -0,0 +1,24 @@
# Setup MySQL database for PowerDNS-Admin
This guide will show you how to prepare a MySQL or MariaDB database for PowerDNS-Admin.
### Step-by-step instructions
1. ivan@ubuntu:~$ `mysql -u root -p` (then enter your MySQL/MariaDB root users password)
2. mysql> `CREATE DATABASE powerdnsadmin CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;`
3. mysql> `GRANT ALL PRIVILEGES ON powerdnsadmin.* TO 'pdnsadminuser'@'%' IDENTIFIED BY 'p4ssw0rd';`
4. mysql> `FLUSH PRIVILEGES;`
5. mysql> `quit`
**NOTE:**
If you plan to manage large zones, you may encounter some issues while applying changes.
This is due to PowerDNS-Admin trying to insert the entire modified zone into the column history.detail.
Using MySQL/MariaDB, this column is created by default as TEXT and thus limited to 65,535 characters.
_Solution_:
Convert the column to MEDIUMTEXT:
* `USE powerdnsadmin;`
* `ALTER TABLE history MODIFY detail MEDIUMTEXT;`

View File

@ -0,0 +1,33 @@
# Setup Postgres database for PowerDNS-Admin
We assume you already have a postgres database software installed for your platform.
### Create database
```
$ sudo su - postgres
$ createuser powerdnsadmin
$ createdb powerdnsadmindb
$ psql
postgres=# alter user powerdnsadmin with encrypted password 'powerdnsadmin';
postgres=# grant all privileges on database powerdnsadmindb to powerdnsadmin;
```
Note:
- Please change the information above (db, user, password) to fit your setup.
### Setup Remote access to database:
If your database is on a different server
- You might need to adjust your PostgreSQL's `pg_hba.conf` config file to allow password authentication for networks.
## Docker
```
docker run --name pdnsadmin-test -e BIND_ADDRESS=0.0.0.0
-e SECRET_KEY='a-very-secret-key'
-e PORT='9191'
-e SQLA_DB_USER='powerdns_admin_user'
-e SQLA_DB_PASSWORD='exceptionallysecure'
-e SQLA_DB_HOST='192.168.0.100'
-e SQLA_DB_NAME='powerdns_admin_test'
-v /data/node_modules:/var/www/powerdns-admin/node_modules -d -p 9191:9191 ixpict/powerdns-admin-pgsql:latest
```