pschiffe / docker-pdns

Docker images for PowerDNS
MIT License
271 stars 80 forks source link

uwsgi image error: invalid request block size: #9

Closed fenice2 closed 6 years ago

fenice2 commented 6 years ago

Hii

First I'd like to thank you for producing the docker image for pdns-admin-uwsgi. :) I'm a complete novice about anything to do with docker but I wanted to run this for managing my PowerDNS server(s).

My first attempt was to install powerdns-admin directly on a CentOS7 VM to see how it worked, that was OK but the following problem arose. I currently run several powerdns server and the datebase in use is mysql (Percon XtraDB) cluster, I normally access them through proxysql as a HA interface to the cluster, it's working quite well. The first problem is that powerdns-admin doesn't seem to like accessing the DB through proxysql and appears to get no response.

To get round that I connected directly to the DB via one of the cluster members, that seems to be no problem. I know this isn't specifically a problem with your container but thought I'd mention it.

Anyway onto the specific problem, the container starts OK with the following command:

docker run -dt -p 9494:9494 --name pdns-admin-uwsgi \ --privileged \ -v pdns-admin-upload:/opt/powerdns-admin/upload \ -e SECRET_KEY="'asecretkey'" \ -e PDNS_ADMIN_SQLA_DB_USER="'pdns_admin'" \ -e PDNS_ADMIN_SQLA_DB_PASSWORD="'asecurepassword'" \ -e PDNS_ADMIN_SQLA_DB_HOST="'192.168.1.10'" \ -e PDNS_ADMIN_SQLA_DB_PORT="'3306'" \ -e PDNS_ADMIN_SQLA_DB_NAME="'powerdnsadmin'" \ -e PDNS_ADMIN_PDNS_STATS_URL="'http://192.168.1.10:8081/'" \ -e PDNS_ADMIN_PDNS_API_KEY="'asecurekey" \ -e PDNS_ADMIN_PDNS_VERSION="'4.1.0'" \ pschiffe/pdns-admin-uwsgi

At this point it appears to be listening only on the ipv6 port 9494:

netstat -tulnp | grep 94 tcp6 0 0 :::9494 :::* LISTEN 28378/docker-proxy-

If I try to access the port 9494 I see the following error:

Thu Dec 28 15:41:58 2017 - [emperor] vassal pdns-admin.ini has been spawned spawned uWSGI worker 1 (pid: 19, cores: 1) Thu Dec 28 15:41:58 2017 - [emperor] vassal pdns-admin.ini is ready to accept requests invalid request block size: 21573 (max 4096)...skip invalid request block size: 21573 (max 4096)...skip

Have a missed something glaringly obvious or is this a problem with the container? As I mentioned earlier this container is running on a centos7 VM in VMware Workstation 14 (just for testing).

If there's anything else I need to provide, just let me know.

Regards

Bill

pschiffe commented 6 years ago

Hi @fenice2 . I've never tried running uwsgi container standalone. You should use pdns-admin-static container as a frontend for the uwsgi. Also uwsgi container should not need --privileged and -t flags. Try to run your uwsgi container as:

docker run -d --name pdns-admin-uwsgi
-v pdns-admin-upload:/opt/powerdns-admin/upload
-e SECRET_KEY="'asecretkey'"
-e PDNS_ADMIN_SQLA_DB_USER="'pdns_admin'"
-e PDNS_ADMIN_SQLA_DB_PASSWORD="'asecurepassword'"
-e PDNS_ADMIN_SQLA_DB_HOST="'192.168.1.10'"
-e PDNS_ADMIN_SQLA_DB_PORT="'3306'"
-e PDNS_ADMIN_SQLA_DB_NAME="'powerdnsadmin'"
-e PDNS_ADMIN_PDNS_STATS_URL="'http://192.168.1.10:8081/'"
-e PDNS_ADMIN_PDNS_API_KEY="'asecurekey"
-e PDNS_ADMIN_PDNS_VERSION="'4.1.0'"
pschiffe/pdns-admin-uwsgi

And the frontend as:

docker run -d -p 8080:80 --name pdns-admin-static
--link pdns-admin-uwsgi:pdns-admin-uwsgi
pschiffe/pdns-admin-static

Then access port 8080 on your workstation and let me know if it works.

fenice2 commented 6 years ago

Hi @pschiffe

Thanks for your quick reply. I've tried your suggest but it gives me this error "Sorry, the page you are looking for is currently unavailable." and the following in the log files:

2017/12/28 19:03:09 [error] 5#5: 1 connect() failed (111: Connection refused) while connecting to upstream, client: 192.168.1.40, server: localhost, request: "GET /favicon.ico HTTP/1.1", upstream: "uwsgi://172.17.0.2:9494", host: "192.168.1.195:8080"
192.168.1.40 - - [28/Dec/2017:19:09:53 +0000] "GET / HTTP/1.1" 502 537 "-" "Mozilla/5.0 (X11; Linux x86_64; rv:57.0) Gecko/20100101 Firefox/57.0" "-"
2017/12/28 19:09:53 [error] 5#5:
5 connect() failed (111: Connection refused) while connecting to upstream, client: 192.168.1.40, server: localhost, request: "GET / HTTP/1.1", upstream: "uwsgi://172.17.0.2:9494", host: "192.168.1.195:8080"

Regards

Bill

fenice2 commented 6 years ago

I think you can ignore my last message, I seem to have made a mistake in the command to start the uwsgi container and I can't get to check that again until tomorrow. Hopefully I'll be able to have another attempt at this sometime later tomorrow afternoon.

Thanks for your help so far. :)

fenice2 commented 6 years ago

Hi @pschiffe

I managed to get another test in yesterday evening but no luck I'm afraid. I created test installs of PDNS Server & Percona sql server on two separate servers, configured those with the correct settings including the powerdnsadmin user and empty database on the servers.

The attemtps to connect to the container gave an error indicating that there was a missing table in the db, the following is the error:

sqlalchemy.exc.ProgrammingError: (_mysql_exceptions.ProgrammingError) (1146, "Table 'powerdnsadmin.setting' doesn't exist") [SQL: u'SELECT setting.id AS setting_id, setting.name AS setting_name, setting.value AS setting_value \nFROM setting \nWHERE setting.name = %s \n LIMIT %s'] [parameters: ('maintenance', 1)] [pid: 19|app: 0|req: 4/4] 192.168.1.40 () {48 vars in 1078 bytes} [Fri Dec 29 20:55:52 2017] GET /dashboard => generated 0 bytes in 8 msecs (HTTP/1.1 500) 0 headers in 0 bytes (0 switches on core 0)

When I checked the db it only had the domain, language and index ix_domain_name created - strange or what? At this point I went to bed and left the VM powered on and the containers active, this morning I tried to connect again but both of the containers appeared dead, not was being produced in the logs.

Unless you have any suggestions I'm completely stuck on what I should do at this point so I've decided to leave it for the moment and return to it in the new year.

I'll leave this issue open for the moment and see what happens in my investigations, I'll update it (or close it) if I find anything useful.

Thanks again for your help and best wishes for the New Year. :)

Regards

Bill

pschiffe commented 6 years ago

@fenice2 that's weird. Try to empty the powerdnsadmin database (drop all tables) and start the uwsgi container again, it should recreate all tables as necessary.

pschiffe commented 6 years ago

Feel free to reopen if you have further questions.