Merge pull request #1434 from subbink/improve-psql-docs

PostgreSQL Support Improvement
This commit is contained in:
Matt Scott 2023-03-17 15:17:41 -04:00 committed by GitHub
commit 92be9567de
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 32 additions and 13 deletions

View File

@ -27,6 +27,7 @@ CAPTCHA_SESSION_KEY = 'captcha_image'
SESSION_TYPE = 'sqlalchemy' SESSION_TYPE = 'sqlalchemy'
### DATABASE - MySQL ### DATABASE - MySQL
## Don't forget to uncomment the import in the top
#SQLALCHEMY_DATABASE_URI = 'mysql://{}:{}@{}/{}'.format( #SQLALCHEMY_DATABASE_URI = 'mysql://{}:{}@{}/{}'.format(
# urllib.parse.quote_plus(SQLA_DB_USER), # urllib.parse.quote_plus(SQLA_DB_USER),
# urllib.parse.quote_plus(SQLA_DB_PASSWORD), # urllib.parse.quote_plus(SQLA_DB_PASSWORD),
@ -34,6 +35,15 @@ SESSION_TYPE = 'sqlalchemy'
# SQLA_DB_NAME # SQLA_DB_NAME
#) #)
### DATABASE - PostgreSQL
## Don't forget to uncomment the import in the top
#SQLALCHEMY_DATABASE_URI = 'postgres://{}:{}@{}/{}'.format(
# urllib.parse.quote_plus(SQLA_DB_USER),
# urllib.parse.quote_plus(SQLA_DB_PASSWORD),
# SQLA_DB_HOST,
# SQLA_DB_NAME
#)
### DATABASE - SQLite ### DATABASE - SQLite
SQLALCHEMY_DATABASE_URI = 'sqlite:///' + os.path.join(basedir, 'pdns.db') SQLALCHEMY_DATABASE_URI = 'sqlite:///' + os.path.join(basedir, 'pdns.db')

View File

@ -11,6 +11,7 @@ RUN apt-get update -y \
libffi-dev \ libffi-dev \
libldap2-dev \ libldap2-dev \
libmariadb-dev-compat \ libmariadb-dev-compat \
libpq-dev \
libsasl2-dev \ libsasl2-dev \
libssl-dev \ libssl-dev \
libxml2-dev \ libxml2-dev \

View File

@ -2,6 +2,7 @@ FROM alpine:3.17 AS builder
ARG BUILD_DEPENDENCIES="build-base \ ARG BUILD_DEPENDENCIES="build-base \
libffi-dev \ libffi-dev \
libpq-dev \
libxml2-dev \ libxml2-dev \
mariadb-connector-c-dev \ mariadb-connector-c-dev \
openldap-dev \ openldap-dev \

View File

@ -15,10 +15,9 @@ The below will create a database called powerdnsadmindb and a user of powerdnsad
``` ```
$ sudo su - postgres $ sudo su - postgres
$ createuser powerdnsadmin $ createuser powerdnsadmin
$ createdb powerdnsadmindb $ createdb -E UTF8 -l en_US.UTF-8 -O powerdnsadmin -T template0 powerdnsadmindb 'The database for PowerDNS-Admin'
$ psql $ psql
postgres=# alter user powerdnsadmin with encrypted password 'powerdnsadmin'; postgres=# ALTER ROLE powerdnsadmin WITH PASSWORD 'powerdnsadmin_password';
postgres=# grant all privileges on database powerdnsadmindb to powerdnsadmin;
``` ```
Note: Note:
@ -51,18 +50,14 @@ On debian based systems these files are located in:
## Install required packages: ## Install required packages:
### Red-hat based systems: ### Red-hat based systems:
TODO: confirm this is correct
``` ```
sudo yum install postgresql-libs sudo yum install postgresql-libs
``` ```
### Debian based systems: ### Debian based systems:
``` ```
apt install libpq-dev python-dev apt install python3-psycopg2
```
### Install python packages:
```
pip3 install psycopg2
``` ```
## Known Issues: ## Known Issues:

View File

@ -7,19 +7,30 @@ First setup your database accordingly:
### Install required packages for building python libraries from requirements.txt file ### Install required packages for building python libraries from requirements.txt file
For Debian 11 (bullseye) and above:
```bash ```bash
sudo apt install -y python3-dev git libsasl2-dev libldap2-dev libssl-dev libxml2-dev libxslt1-dev libxmlsec1-dev libffi-dev pkg-config apt-transport-https virtualenv build-essential curl sudo apt install -y python3-dev git libsasl2-dev libldap2-dev python3-venv libmariadb-dev pkg-config build-essential curl libpq-dev
```
Older systems might also need the following:
```bash
sudo apt install -y libssl-dev libxml2-dev libxslt1-dev libxmlsec1-dev libffi-dev apt-transport-https virtualenv
``` ```
### Install NodeJs ### Install NodeJs
```bash ```bash
curl -sL https://deb.nodesource.com/setup_14.x | bash - curl -sL https://deb.nodesource.com/setup_14.x | sudo bash -
apt install -y nodejs sudo apt install -y nodejs
``` ```
### Install yarn to build asset files ### Install yarn to build asset files
For Debian 11 (bullseye) and above:
```bash
curl -sL https://dl.yarnpkg.com/debian/pubkey.gpg | gpg --dearmor | sudo tee /usr/share/keyrings/yarnkey.gpg >/dev/null
echo "deb [signed-by=/usr/share/keyrings/yarnkey.gpg] https://dl.yarnpkg.com/debian stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
sudo apt update && sudo apt install -y yarn
```
For older Debian systems:
```bash ```bash
sudo curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - sudo curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add -
echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list

View File

@ -43,3 +43,4 @@ webcolors==1.12
werkzeug==2.1.2 werkzeug==2.1.2
zipp==3.11.0 zipp==3.11.0
rcssmin==1.1.1 rcssmin==1.1.1
psycopg2==2.9.5