Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Add PGAdmin container for PostgreSQL administration and debugging #75

Merged
merged 6 commits into from
Dec 31, 2023
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 23 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -146,8 +146,30 @@ POSTGRES_PORT=5432 # default "5432", if using docker compose you should use "543
POSTGRES_DB="your_db"
```

For database administration using PGAdmin create the following variables in the .env file

```
# ------------- pgadmin -------------
PGADMIN_DEFAULT_EMAIL="your_email_address"
PGADMIN_DEFAULT_PASSWORD="your_password"
PGADMIN_LISTEN_PORT=80
```

To connect to the database, log into the PGAdmin console with the values specified in `PGADMIN_DEFAULT_EMAIL` and `PGADMIN_DEFAULT_PASSWORD`.

Once in the main PGAdmin screen, click Add Server:

![pgadmin-connect](./assets/pgadmin-connect.png)

1. Hostname/address is `db` (if using containers)
2. Is the value you specified in `POSTGRES_PORT`
3. Leave this value as `postgres`
4. is the value you specified in `POSTGRES_USER`
5. Is the value you specified in `POSTGRES_PASSWORD`

For crypt:
Start by running

```sh
openssl rand -hex 32
```
Expand Down Expand Up @@ -1316,7 +1338,7 @@ poetry run arq src.app.worker.WorkerSettings
In production you may want to run using gunicorn to manage uvicorn workers:
```sh
command: gunicorn app.main:app -w 4 -k uvicorn.workers.UvicornWorker -b 0.0.0.0:8000
```
```
Here it's running with 4 workers, but you should test it depending on how many cores your machine has.

To do this if you are using docker compose, just replace the comment:
Expand Down
Binary file added assets/pgadmin-connect.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
16 changes: 15 additions & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,20 @@ services:
expose:
- "6379"

#-------- uncomment to run with pgadmin --------
# pgadmin:
# container_name: pgadmin4
# image: dpage/pgadmin4:latest
# restart: always
# ports:
# - "5050:80"
# volumes:
# - pgadmin-data:/var/lib/pgadmin
# env_file:
# - ./src/.env
# depends_on:
# - db

#-------- uncomment to run with nginx --------
# nginx:
# image: nginx:latest
Expand Down Expand Up @@ -106,4 +120,4 @@ services:
volumes:
postgres-data:
redis-data:

#pgadmin-data: