Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

feat: Add DB GUI accessible from URL #132

Merged
merged 1 commit into from
Sep 16, 2024
Merged
Show file tree
Hide file tree
Changes from all 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
5 changes: 5 additions & 0 deletions .env.template
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,8 @@ APPLICATION_REDIS_HOST=127.0.0.1
# e2e tests are running in parallel, so we need a strict amount of workers,
# so then we can dynamically create the same amount of DBs
JEST_WORKERS_AMOUNT=4

# pgAdmin config
[email protected]
PGADMIN_DEFAULT_PASSWORD=password
PGADMIN_LISTEN_PORT=8001
14 changes: 14 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,26 @@ Now it should be accessible under the port that you defined in the `.env.develop
due to DB connection issues. It's a very rare case, but if this happens,
_**simply run the command again**_.

### Additional services for local development

#### pgAdmin (DB data viewer)

There's a pgAdmin available under the port `8001`. You can modify configuration for email and password of the dashboard in the env file. On the first setup, after logging in on the dashboard you will see "Add new server". Click on it, give it whatever Name you want.

Under the `Connection` tab you will need to fill a few fields:

- Host name/address – `db` (postgres service name from `docker/dev/docker-compose.yml` file)
- Username – value from the `APPLICATION_DB_USERNAME` env variable
- Password - value from the `APPLICATION_DB_PASSWORD` env variable

### Useful command for local development:

1. `npm run docker:dev:down` to stop containers. All the data will still be stored in the DB.
2. `npm run docker:dev:destroy` stops containers, and _**Completely destroys all the images, container and volumes**_. It means all the data will be erased from the DB. Useful when you want to test new migrations, or DB structure was damaged.
3. Use `docker:dev:run-in-container -- <some command>` to run any command inside running docker container. For example `docker:dev:run-in-container -- npm run migrate:dev` to run migrations and `docker:dev:run-in-container -- npm run migrate:dev:undo` to undo them.

<hr>
<hr>
<hr>

### If you don't want to use Docker
Expand Down
9 changes: 9 additions & 0 deletions docker/dev/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,15 @@ services:
volumes: ['redis_data:/data']
ports: ['6379:6379']

pgadmin:
image: dpage/pgadmin4:8.11
environment:
- PGADMIN_DEFAULT_EMAIL=${PGADMIN_DEFAULT_EMAIL}
- PGADMIN_DEFAULT_PASSWORD=${PGADMIN_DEFAULT_PASSWORD}
- PGADMIN_LISTEN_PORT=${PGADMIN_LISTEN_PORT}
ports: ['8001:8001']
depends_on: ['db']

volumes:
db_data:
redis_data:
Loading