From 15b607a98e92d87f083d4ca406c7d795fc373cd5 Mon Sep 17 00:00:00 2001 From: Jan Zmeskal Date: Tue, 13 Oct 2020 14:48:39 +0200 Subject: [PATCH] local-dev: add pgadmin4 container Signed-off-by: Jan Zmeskal --- Documentation/howto/testing.md | 5 +++++ Makefile | 13 +++++++++++-- docker-compose.yaml | 15 +++++++++++++++ local-dev/pgadmin/passfile.txt | 2 ++ local-dev/pgadmin/servers.json | 14 ++++++++++++++ 5 files changed, 47 insertions(+), 2 deletions(-) create mode 100644 local-dev/pgadmin/passfile.txt create mode 100644 local-dev/pgadmin/servers.json diff --git a/Documentation/howto/testing.md b/Documentation/howto/testing.md index 5e687113e4..08f9f6b9f1 100644 --- a/Documentation/howto/testing.md +++ b/Documentation/howto/testing.md @@ -50,6 +50,11 @@ localhost:5433 --- Quay's Postgres DB username: quay database: quay +localhost:8081 --- Postgres GUI (pgadmin4) + Login: + username: clair@clair.com + password: clair + localhost:8082 --- OpenAPI Swagger Editor. You can view ClairV4's public API here. diff --git a/Makefile b/Makefile index 8616b445ee..5a21999ed8 100644 --- a/Makefile +++ b/Makefile @@ -40,6 +40,7 @@ local-dev-up: vendor $(docker-compose) up -d activemq $(docker-compose) up -d clair-db $(docker) exec -it clair-db bash -c 'while ! pg_isready; do echo "waiting for postgres"; sleep 2; done' + $(docker-compose) up -d pgadmin $(docker-compose) up -d indexer $(docker-compose) up -d matcher $(docker-compose) up -d notifier @@ -55,6 +56,7 @@ local-dev-up-with-quay: vendor $(docker-compose) up -d activemq $(docker-compose) up -d clair-db $(docker) exec -it clair-db bash -c 'while ! pg_isready; do echo "waiting for clair postgres"; sleep 2; done' + $(docker-compose) up -d pgadmin $(docker-compose) up -d indexer-quay $(docker-compose) up -d matcher $(docker-compose) up -d notifier @@ -125,10 +127,17 @@ local-dev-matcher-restart: local-dev-notifier-restart: $(docker-compose) up -d --force-recreate notifier +# restart all clair instances +.PHONY: local-dev-clair-restart +local-dev-clair-restart: + $(docker-compose) up -d --force-recreate indexer + $(docker-compose) up -d --force-recreate matcher + $(docker-compose) up -d --force-recreate notifier + # restart the local development rabbitmq -.PHONY: local-dev-notifier-restart +.PHONY: local-dev-rabbitmq-restart local-dev-rabbitmq-restart: - $(docker-compose) up -d --force-recreate notifier + $(docker-compose) up -d --force-recreate rabbitmq # restart the local development swagger-ui, any local code changes will take effect .PHONY: local-dev-swagger-ui-restart diff --git a/docker-compose.yaml b/docker-compose.yaml index 45e9c40627..12db95b8b1 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -24,6 +24,21 @@ services: retries: 3 start_period: 10s + pgadmin: + container_name: pgadmin + image: dpage/pgadmin4:latest + environment: + PGADMIN_DEFAULT_EMAIL: clair@clair.com + PGADMIN_DEFAULT_PASSWORD: clair + PGADMIN_SERVER_JSON_FILE: /pgadmin4/config/servers.json + PGADMIN_LISTEN_PORT: 8081 + ports: + - "8081:8081" + volumes: + - "./local-dev/pgadmin:/pgadmin4/config" + depends_on: + - clair-db + traefik: container_name: clair-traefik image: traefik:v2.2 diff --git a/local-dev/pgadmin/passfile.txt b/local-dev/pgadmin/passfile.txt new file mode 100644 index 0000000000..7105af22d3 --- /dev/null +++ b/local-dev/pgadmin/passfile.txt @@ -0,0 +1,2 @@ +# hostname:port:database:username:password +clair-db:5432:clair-db:clair:clair \ No newline at end of file diff --git a/local-dev/pgadmin/servers.json b/local-dev/pgadmin/servers.json new file mode 100644 index 0000000000..266b0e91f6 --- /dev/null +++ b/local-dev/pgadmin/servers.json @@ -0,0 +1,14 @@ +{ + "Servers": { + "1": { + "Name": "clair-db", + "Group": "Servers", + "Port": 5432, + "Username": "clair", + "Host": "clair-db", + "SSLMode": "disable", + "MaintenanceDB": "postgres", + "PassFile": "/pgadmin4/config/passfile.txt" + } + } +} \ No newline at end of file