feat: Pgadmin (#112)

* feat: added pgadmi

* feat: add pgadmin to nginx config for reverse proxy
This commit is contained in:
Zack 2023-10-12 16:39:13 +08:00 committed by GitHub
parent 8023efae97
commit 119adf53e4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 67 additions and 0 deletions

View File

@ -44,3 +44,7 @@ AWS_S3_BUCKET=appflowy
AWS_REGION=us-east-1
RUST_LOG=info
# PgAdmin
PGADMIN_DEFAULT_EMAIL=admin@example.com
PGADMIN_DEFAULT_PASSWORD=password

View File

@ -21,6 +21,18 @@ services:
volumes:
- ./migrations/before:/docker-entrypoint-initdb.d
pgadmin:
build:
context: .
dockerfile: docker/pgadmin.Dockerfile
depends_on:
- postgres
environment:
- PGADMIN_DEFAULT_EMAIL=${PGADMIN_DEFAULT_EMAIL}
- PGADMIN_DEFAULT_PASSWORD=${PGADMIN_DEFAULT_PASSWORD}
ports:
- 5400:80
redis:
image: redis
ports:

View File

@ -35,6 +35,18 @@ services:
volumes:
- ./migrations/before:/docker-entrypoint-initdb.d
pgadmin:
build:
context: .
dockerfile: docker/pgadmin.Dockerfile
depends_on:
- postgres
environment:
- PGADMIN_DEFAULT_EMAIL=${PGADMIN_DEFAULT_EMAIL}
- PGADMIN_DEFAULT_PASSWORD=${PGADMIN_DEFAULT_PASSWORD}
ports:
- 5400:80
redis:
image: redis
ports:

11
docker/pgadmin.Dockerfile Normal file
View File

@ -0,0 +1,11 @@
FROM dpage/pgadmin4
COPY ./docker/pgadmin/servers.json /pgadmin4/servers.json
COPY ./docker/pgadmin/custom_entrypoint.sh /custom_entrypoint.sh
USER root
RUN chmod +x /custom_entrypoint.sh
USER pgadmin
ENTRYPOINT ["/custom_entrypoint.sh"]

View File

@ -0,0 +1,10 @@
#!/bin/sh
# Call the original entrypoint
/entrypoint.sh "$@"
# Your additional commands to invoke setup.py (example below, adjust accordingly)
python setup.py --load-servers /path/to/your/servers.json
# Keep container running
tail -f /dev/null

View File

@ -0,0 +1,12 @@
{
"Servers": {
"1": {
"Name": "postgres",
"Group": "Servers",
"Host": "postgres",
"Port": 5432,
"MaintenanceDB": "postgres",
"Username": "postgres"
}
}
}

View File

@ -38,6 +38,12 @@ http {
proxy_pass http://appflowy_cloud:8000;
}
# PgAdmin
location /pgadmin/ {
proxy_set_header X-Script-Name /pgadmin;
proxy_pass http://pgadmin:80/;
}
# Admin Frontend
location / {
proxy_pass http://admin_frontend:3000;