Skip to content

Commit

Permalink
Add pgadmin for easy local database access (#558)
Browse files Browse the repository at this point in the history
* Add pgadmin to dev docker compose

* Add pgadmin configuration

* Fix pgadmin config file docker binding

* Fix unwanted env comment
  • Loading branch information
Splines authored Nov 12, 2023
1 parent 2df937a commit 1f5828d
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 0 deletions.
12 changes: 12 additions & 0 deletions config/db-pgadmin.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"Servers": {
"1": {
"Name": "mampf-postgres",
"Group": "Servers",
"Host": "db",
"Port": 5432,
"MaintenanceDB": "mampf",
"Username": "mampf"
}
}
}
20 changes: 20 additions & 0 deletions docker/development/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,23 @@ services:
source: db-data
target: /var/lib/postgresql/data

pgadmin:
image: dpage/pgadmin4
ports:
- "5050:80"
environment:
PGADMIN_DEFAULT_EMAIL: [email protected]
PGADMIN_DEFAULT_PASSWORD: pgmampf
volumes:
- pgadmin:/var/lib/pgadmin
# Pre-load server definition into pgAdmin (so that no manual setup via
# the web interface is required). See "pgadmin4/servers.json" here:
# -> https://www.pgadmin.org/docs/pgadmin4/latest/container_deployment.html#mapped-files-and-directories
# -> https://forums.docker.com/t/automatically-connect-pgadmin-to-a-postgresql-volume-on-which-there-is-a-database-and-automatically-load-a-schema-present-on-a-sql-file-with-docker-compose/124647/2
- type: bind
source: ../../config/db-pgadmin.json
target: /pgadmin4/servers.json

mailcatcher:
restart: on-failure:10
image: dockage/mailcatcher:latest
Expand All @@ -56,6 +73,8 @@ services:
image: mampf:development
environment:
RAILS_ENV: docker_development
# If you change these variables, make sure to adapt accordingly in
# config/db-pgadmin-config.json
DEVELOPMENT_DATABASE_ADAPTER: postgresql
DEVELOPMENT_DATABASE_DATABASE: mampf
DEVELOPMENT_DATABASE_INTERACTIONS: interactions
Expand Down Expand Up @@ -164,5 +183,6 @@ volumes:
submissions:
public:
db-data:
pgadmin:
solr-data:
sprockets-cache:

0 comments on commit 1f5828d

Please sign in to comment.