Last active
October 4, 2022 07:33
-
-
Save alldevic/b2a0573e5464fe91fd118024f33bcbaa to your computer and use it in GitHub Desktop.
pgadmin
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pgadmin: | |
env_file: .env | |
image: dpage/pgadmin4:latest | |
ports: | |
- 15432:15432 | |
volumes: | |
- ./pgadmin.json:/pgadmin4/servers.json:ro | |
- pgadmin_data:/var/lib/pgadmin:rw | |
environment: | |
PGADMIN_CONFIG_SERVER_MODE: 0 | |
PGADMIN_CONFIG_MASTER_PASSWORD_REQUIRED: 0 | |
# Default user for desktop mode (SERVER_MODE = False) | |
PGADMIN_DEFAULT_EMAIL: pgadmin4@pgadmin.org | |
# Default password for desktop mode (SERVER_MODE = False) | |
PGADMIN_DEFAULT_PASSWORD: password | |
PGADMIN_LISTEN_ADDRESS: 0.0.0.0 | |
PGADMIN_LISTEN_PORT: 15432 | |
entrypoint: | |
- "/bin/sh" | |
- "-c" | |
- "/bin/echo '${POSTGRES_HOST}:5432:*:${POSTGRES_USER}:${POSTGRES_PASSWORD}' > /tmp/pgpassfile && chmod 600 /tmp/pgpassfile && /entrypoint.sh" | |
networks: | |
private_network: | |
ipv4_address: 12.5.0.16 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/make | |
include .env | |
SHELL = /bin/sh | |
CURRENT_UID := $(shell id -u):$(shell id -g) | |
export CURRENT_UID | |
COMPOSE_FILE := docker-compose.yml | |
PGADMIN_IMAGE := pgadmin | |
define SERVERS_JSON | |
{ | |
"Servers": { | |
"1": { | |
"Name": "Lesboard", | |
"Group": "Servers", | |
"Host": "$(POSTGRES_HOST)", | |
"Port": 5432, | |
"MaintenanceDB": "$(POSTGRES_DB)", | |
"Username": "$(POSTGRES_USER)", | |
"SSLMode": "prefer", | |
"PassFile": "/tmp/pgpassfile" | |
} | |
} | |
} | |
endef | |
export COMPOSE_FILE | |
export SERVERS_JSON | |
export PGADMIN_IMAGE | |
volumes: | |
docker volume create db_data | |
docker volume create pgadmin_data | |
pgadmin4: | |
rm -f ./pgadmin.json | |
echo "$$SERVERS_JSON" > ./pgadmin.json | |
docker volume create pgadmin_data | |
docker volume create db_data | |
docker compose -f $(COMPOSE_FILE) up -d --build --remove-orphans $(PGADMIN_IMAGE) | |
down-pgadmin4: | |
docker compose rm -fsv $(PGADMIN_IMAGE) | |
clean-pgadmin4: | |
rm -rf ./pgadmin.json | |
docker volume rm pgadmin_data | |
links: | |
$(info PgAdmin4 http://localhost:15432) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment