Skip to content

Commit f1673e7

Browse files
authored
Merge pull request #182 from Jade-Codes/pg-admin-docker-compose
Add PGAdmin to docker-compose
2 parents eefbd4c + 232dba5 commit f1673e7

File tree

4 files changed

+27
-3
lines changed

4 files changed

+27
-3
lines changed
61.6 KB
Loading

bootcamp/materials/1-dimensional-data-modeling/README.md

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ There are two methods to get Postgres running locally.
5353
3. Set up DataGrip, DBeaver, or your VS Code extension to point at your locally running Postgres instance.
5454
4. Have fun querying!
5555
56-
### 🐳 **Option 2: Run Postgres in Docker**
56+
### 🐳 **Option 2: Run Postgres and PGAdmin in Docker**
5757
5858
- Install Docker Desktop from **[here](https://www.docker.com/products/docker-desktop/)**.
5959
- Copy **`example.env`** to **`.env`**:
@@ -79,6 +79,15 @@ There are two methods to get Postgres running locally.
7979
- You can check that your Docker Compose stack is running by either:
8080
- Going into Docker Desktop: you should see an entry there with a drop-down for each of the containers running in your Docker Compose stack.
8181
- Running **`docker ps -a`** and looking for the containers with the name **`postgres`**.
82+
- If you navigate to **`http://localhost:5050`** you will be able to see the PGAdmin instance up and running and should be able to connect to the following server:
83+
![Image showing the setup for PGAdmin](.attachments/pgadmin-server.png)
84+
Where:
85+
- Host name: host.docker.internal (Or container name i.e my-postgres-container)
86+
- Port: 5432
87+
- Username: postgres
88+
- Password: postgres
89+
90+
8291
- When you're finished with your Postgres instance, you can stop the Docker Compose containers with:
8392

8493
```bash

bootcamp/materials/1-dimensional-data-modeling/docker-compose.yml

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,17 @@ services:
1616
- ./data.dump:/docker-entrypoint-initdb.d/data.dump
1717
- ./scripts/init-db.sh:/docker-entrypoint-initdb.d/init-db.sh
1818
- postgres-data:/var/lib/postgresql/data
19-
19+
pgadmin:
20+
image: dpage/pgadmin4
21+
restart: on-failure
22+
container_name: pgadmin
23+
environment:
24+
- PGADMIN_DEFAULT_EMAIL=${PGADMIN_EMAIL}
25+
- PGADMIN_DEFAULT_PASSWORD=${PGADMIN_PASSWORD}
26+
ports:
27+
- "${PGADMIN_PORT}:80"
28+
volumes:
29+
- pgadmin-data:/var/lib/pgadmin
2030
volumes:
2131
postgres-data:
32+
pgadmin-data:

bootcamp/materials/1-dimensional-data-modeling/example.env

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,8 @@ HOST_PORT=5432
77
CONTAINER_PORT=5432
88

99
DOCKER_CONTAINER=my-postgres-container
10-
DOCKER_IMAGE=my-postgres-image
10+
DOCKER_IMAGE=my-postgres-image
11+
12+
PGADMIN_EMAIL=[email protected]
13+
PGADMIN_PASSWORD=postgres
14+
PGADMIN_PORT=5050

0 commit comments

Comments
 (0)