[GH-ISSUE #22] postgresql? #17

Closed
opened 2026-02-26 10:35:33 +03:00 by kerem · 14 comments
Owner

Originally created by @piwats on GitHub (Apr 13, 2016).
Original GitHub issue: https://github.com/PowerDNS-Admin/PowerDNS-Admin/issues/22

Hello,

could you please provide install instructions for use with postgresql?

I got the app running (via uwsgi/nginx), also I got it to run under postgresql, unfortunately it does not show any dns records at all. I have to assume that the db setup I did is somehow wrong.

pdns logs say it transmits the json data.

Many thanks

Originally created by @piwats on GitHub (Apr 13, 2016). Original GitHub issue: https://github.com/PowerDNS-Admin/PowerDNS-Admin/issues/22 Hello, could you please provide install instructions for use with postgresql? I got the app running (via uwsgi/nginx), also I got it to run under postgresql, unfortunately it does not show any dns records at all. I have to assume that the db setup I did is somehow wrong. pdns logs say it transmits the json data. Many thanks
kerem 2026-02-26 10:35:33 +03:00
Author
Owner

@ngoduykhanh commented on GitHub (Apr 14, 2016):

hi @piwats ,

It looks like that you completed the setup for running PowerDNS-Admin with Posgresql. Your issue is a bug actually. I've fixed it at commit a9cd4911b9. Please checkout the new code and let me know if it fixes your issue.

<!-- gh-comment-id:209782107 --> @ngoduykhanh commented on GitHub (Apr 14, 2016): hi @piwats , It looks like that you completed the setup for running PowerDNS-Admin with Posgresql. Your issue is a bug actually. I've fixed it at commit a9cd4911b98bcbecc337a6beb00a54b75db8c811. Please checkout the new code and let me know if it fixes your issue.
Author
Owner

@piwats commented on GitHub (Apr 14, 2016):

Hello there,

unfortunately I still cannot see any records.

<!-- gh-comment-id:209955015 --> @piwats commented on GitHub (Apr 14, 2016): Hello there, unfortunately I still cannot see any records.
Author
Owner

@piwats commented on GitHub (Apr 14, 2016):

Could it be because I run in a subdirectory? e.g. server.com/pdns?

<!-- gh-comment-id:209960408 --> @piwats commented on GitHub (Apr 14, 2016): Could it be because I run in a subdirectory? e.g. server.com/pdns?
Author
Owner

@ngoduykhanh commented on GitHub (Apr 14, 2016):

hi @piwats

It works for me on Ubuntu 14.04 and Postgresql 9.4. What are you environment? I don't think the subdirectory can cause this issue, but have you tried removing it?
Can you show me your config.py file also ?

<!-- gh-comment-id:210070554 --> @ngoduykhanh commented on GitHub (Apr 14, 2016): hi @piwats It works for me on Ubuntu 14.04 and Postgresql 9.4. What are you environment? I don't think the subdirectory can cause this issue, but have you tried removing it? Can you show me your `config.py` file also ?
Author
Owner

@piwats commented on GitHub (Apr 14, 2016):

import os
basedir = os.path.abspath(os.path.dirname(__file__))

# BASIC APP CONFIG
WTF_CSRF_ENABLED = True
SECRET_KEY = 'verylongsecret'
#PORT = 9393

# TIMEOUT - for large zones
TIMEOUT = 10

# LOG CONFIG 
LOG_LEVEL = 'DEBUG'
LOG_FILE = '/var/log/dns/logfile.log'

# Upload
UPLOAD_DIR = os.path.join(basedir, 'upload')

# DATABASE CONFIG
SQLALCHEMY_DATABASE_URI = 'postgresql://pdns:nothing-to-see-here@localhost/pdns'
SQLALCHEMY_MIGRATE_REPO = os.path.join(basedir, 'db_repository')
SQLALCHEMY_TRACK_MODIFICATIONS = True

# LDAP CONFIG
#LDAP_URI = 'ldaps://your-ldap-server:636'
#LDAP_USERNAME = 'cn=dnsuser,ou=users,ou=services,dc=duykhanh,dc=me'
#LDAP_PASSWORD = 'dnsuser'
#LDAP_SEARCH_BASE = 'ou=System Admins,ou=People,dc=duykhanh,dc=me'
#LDAP_TYPE = 'ldap' // or 'ad'
LDAP_URI = ''                                                                                                                                                           
LDAP_USERNAME = ''                                                                                                                                                      
LDAP_PASSWORD = ''                                                                                                                                                      
LDAP_SEARCH_BASE = ''                                                                                                                                                   
LDAP_TYPE = ''                                                                                                                                                          


# POWERDNS CONFIG                                                                                                                                                       
PDNS_STATS_URL = 'http://127.0.0.1:8081/'                                                                                                                               
PDNS_API_KEY = 'whao,some,secret,key,in,here'

# RECORDS ALLOWED TO EDIT
RECORDS_ALLOW_EDIT = ['A', 'AAAA', 'CNAME', 'SPF', 'PTR', 'MX', 'TXT']

I'm on gentoo wit pgsql-9.5.2, to be precisely.

<!-- gh-comment-id:210118239 --> @piwats commented on GitHub (Apr 14, 2016): ``` import os basedir = os.path.abspath(os.path.dirname(__file__)) # BASIC APP CONFIG WTF_CSRF_ENABLED = True SECRET_KEY = 'verylongsecret' #PORT = 9393 # TIMEOUT - for large zones TIMEOUT = 10 # LOG CONFIG LOG_LEVEL = 'DEBUG' LOG_FILE = '/var/log/dns/logfile.log' # Upload UPLOAD_DIR = os.path.join(basedir, 'upload') # DATABASE CONFIG SQLALCHEMY_DATABASE_URI = 'postgresql://pdns:nothing-to-see-here@localhost/pdns' SQLALCHEMY_MIGRATE_REPO = os.path.join(basedir, 'db_repository') SQLALCHEMY_TRACK_MODIFICATIONS = True # LDAP CONFIG #LDAP_URI = 'ldaps://your-ldap-server:636' #LDAP_USERNAME = 'cn=dnsuser,ou=users,ou=services,dc=duykhanh,dc=me' #LDAP_PASSWORD = 'dnsuser' #LDAP_SEARCH_BASE = 'ou=System Admins,ou=People,dc=duykhanh,dc=me' #LDAP_TYPE = 'ldap' // or 'ad' LDAP_URI = '' LDAP_USERNAME = '' LDAP_PASSWORD = '' LDAP_SEARCH_BASE = '' LDAP_TYPE = '' # POWERDNS CONFIG PDNS_STATS_URL = 'http://127.0.0.1:8081/' PDNS_API_KEY = 'whao,some,secret,key,in,here' # RECORDS ALLOWED TO EDIT RECORDS_ALLOW_EDIT = ['A', 'AAAA', 'CNAME', 'SPF', 'PTR', 'MX', 'TXT'] ``` I'm on gentoo wit pgsql-9.5.2, to be precisely.
Author
Owner

@piwats commented on GitHub (Apr 14, 2016):

Ah, I forgot to mention, that I also tried to run it in /. Same behavior, no changes.

<!-- gh-comment-id:210119683 --> @piwats commented on GitHub (Apr 14, 2016): Ah, I forgot to mention, that I also tried to run it in /. Same behavior, no changes.
Author
Owner

@piwats commented on GitHub (Apr 19, 2016):

Could you please change the create_db.py script so I can try it with postgresql?

Last time I had to create the db structure by hand, maybe I did something wrong?

<!-- gh-comment-id:211866042 --> @piwats commented on GitHub (Apr 19, 2016): Could you please change the create_db.py script so I can try it with postgresql? Last time I had to create the db structure by hand, maybe I did something wrong?
Author
Owner

@ngoduykhanh commented on GitHub (Apr 19, 2016):

@piwats : didn't create_db.py work for you? I works fine for me with Postgresql. Can you create new bank database and rerun the script?

<!-- gh-comment-id:211878363 --> @ngoduykhanh commented on GitHub (Apr 19, 2016): @piwats : didn't `create_db.py` work for you? I works fine for me with Postgresql. Can you create new bank database and rerun the script?
Author
Owner

@piwats commented on GitHub (Apr 19, 2016):

I've got it now:

Somehow the app won't work if the venv (aka 'flask' directory) is not inside of PowerDNS-Admin...

<!-- gh-comment-id:212002781 --> @piwats commented on GitHub (Apr 19, 2016): I've got it now: Somehow the app won't work if the venv (aka 'flask' directory) is not inside of PowerDNS-Admin...
Author
Owner

@ivanfilippov commented on GitHub (Apr 19, 2016):

Hi @piwats

The flask directory contains all the dependencies (Flask, SQLAlchemy, etc), but you can install the dependencies into your system Python packages without the virtualenv and avoid needing it there. 😄

<!-- gh-comment-id:212076838 --> @ivanfilippov commented on GitHub (Apr 19, 2016): Hi @piwats The flask directory contains all the dependencies (Flask, SQLAlchemy, etc), but you can install the dependencies into your system Python packages without the `virtualenv` and avoid needing it there. :smile:
Author
Owner

@ivanfilippov commented on GitHub (Apr 19, 2016):

I should mention that virtualenv is the recommended way of doing it, unless you're building a docker image or something that will only ever run PowerDNS-Admin.

<!-- gh-comment-id:212077102 --> @ivanfilippov commented on GitHub (Apr 19, 2016): I should mention that `virtualenv` is the recommended way of doing it, unless you're building a docker image or something that will only ever run PowerDNS-Admin.
Author
Owner

@piwats commented on GitHub (Apr 19, 2016):

My initial setup as described in #23 was:

../PowerDNS-Admin
../venv

Now it is

../PowerDNS-Admin
../PowerDNS-Admin/flask

where venv = flask, meaning virtualenv flask

<!-- gh-comment-id:212103981 --> @piwats commented on GitHub (Apr 19, 2016): My initial setup as described in #23 was: ../PowerDNS-Admin ../venv Now it is ../PowerDNS-Admin ../PowerDNS-Admin/flask where venv = flask, meaning `virtualenv flask`
Author
Owner

@ngoduykhanh commented on GitHub (Apr 20, 2016):

For you description #23, they are:

pythonpath = /the_place_of/PowerDNS-Admin/
virtualenv = /the_place_of/venv/

Yes. you need the env (flask) directory in inside PowerDNS-Admin to make it work.

<!-- gh-comment-id:212216877 --> @ngoduykhanh commented on GitHub (Apr 20, 2016): For you description #23, they are: ``` pythonpath = /the_place_of/PowerDNS-Admin/ virtualenv = /the_place_of/venv/ ``` Yes. you need the `env` (flask) directory in inside `PowerDNS-Admin` to make it work.
Author
Owner

@piwats commented on GitHub (Apr 20, 2016):

That I have already changed. I think it is safe to close this issue.

<!-- gh-comment-id:212217898 --> @piwats commented on GitHub (Apr 20, 2016): That I have already changed. I think it is safe to close this issue.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/PowerDNS-Admin-PowerDNS-Admin#17
No description provided.