phpPgAdmin in docker with nginx-fpm and multi server support
2.5K
The work was inspired by phpmyadmin/docker and it's ability to support multiple database servers.
The initial driver is from an k8s environment on AWS making use of multiple RDS instances. To provide a phpPgAdmin interface I was forced to roll out the following for each RDS instance
For one or two instances that's fine. For a dozen it's a little tedious.
These files are a lift and shift.
etc/php-fpm.confetc/php.inietc/supervisor.d/nginx.inietc/supervisor.d/php.iniThese files have had only minor modifications from their source.
etc/nginx/conf - Updated the error_log to go to stdout. If you're running
in a container you want to see these logs. This is possibly a concept change
that would benefit from being changed upstream.run.sh - stripped phpmyadmin bits and added phppgadmin ones insteadDockerfile - replaced mysql related bits with psql bitsFiles in this section are a derative of others where the concept has been taken and worked into the target
etc/config.inc.php - Sources
Defining PPA_HOST will put the config into a single server mode
PPA_HOST - Address/Hostname of the PostgreSQL server. eg localhost
No DefaultPPA_DESC - Name of the PostgreSQL server in the left panel.
Defaults to value of PPA_HOSTPPA_PORT - TCP port of the PostgreSQL. Defaults to 5432PPA_SSLMODE - Go read
pgppgadmin config.inc.php-dist
Defaults to allowPPA_DEFAULTDB - Default database to connect to on the server. Defaults to postgresThese are for connecting to multiple servers. To use, do NOT define any of PPA_HOST as that would put the config into a single server mode. PPA_DESC, PPA_PORT, PPA_SSLMODE or PPA_DEFAULTDB are ignored in multi server mode.
Each variable in this section are a comma separated list.
PPA_HOSTSPPA_DESCSPPA_PORTSPPA_SSLMODESPPA_DEFAULTDBSDefaults are the same as single server mode. If you want to define any one value as non default you MUST define the list to that point.
Eg for a non standard port on the 3rd server (but standard on all others)
use PPA_PORTS=5432,5432,1234
See documentation at pgppgadmin config.inc.php-dist
for similar named variables. These variables are uppercase and prepended with
PPA_ unless stated defaults are as per upstream.
PPA_DEFAULT_LANGPPA_AUTOCOMPLETEPPA_EXTRA_LOGIN_SECURITYPPA_OWNED_ONLYPPA_SHOW_COMMENTSPPA_SHOW_ADVANCEDPPA_SHOW_SYSTEMPPA_MIN_PASSWORD_LENGTHPPA_LEFT_WIDTHPPA_THEMEPPA_SHOW_OIDSPPA_MAX_ROWSPPA_MAX_CHARSPPA_USE_XHTML_STRICTPPA_HELP_BASEPPA_AJAX_REFRESHPPA_PLUGINSThis pod binds to port 80 and outputs logs to stdout. Docker, Kubernetes etc has good documentation. Please feel free to refer to that or to create a PR with the sort of documentation you would like.
If you want to make this better, eg by ading tests or better docs. Please feel free to create a Pull Request
If you encounter the following. Collapse the DB trees in the left column and log in again.
rdsadmin, not the user that was created is the superuser. This was encountered when running php7
If you are using this in AWS with RDS instances you may get issues that look like login / session persistance bugs. This happens when you log into a database and the tree expands trying to access all databases. The rdsadmin database is inaccessable and so the login credentials are then reset. From what I can see this is due to the way AWS creates / manages the PostgreSQL instacnes. AWS creates an rdsadmin user which then creates the master user. This master user is NOT a superuser. You cannot get access to the rdsadmin database. As such if you need to collapse the tree on the left and login again. You will probably encounter this elsewhere if you use a user which does not have USAGE on all databases.
Content type
Image
Digest
Size
49 MB
Last updated
over 8 years ago
docker pull timothyclarke/phppgadmin