Skip to content

Commit 7b710a1

Browse files
committed
Create a postgres DB instance with 'the_simpsons' schema.
1 parent 638fd86 commit 7b710a1

File tree

3 files changed

+24
-8
lines changed

3 files changed

+24
-8
lines changed

debezium/docker-compose.yml

+20-6
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,35 @@
1-
version: '3.8'
21
services:
32
# https://hub.docker.com/_/postgres
3+
# https://codepruner.com/how-to-run-postgresql-and-adminer-or-pgadmin-with-docker-compose/
44
db:
55
container_name: db
6-
image: postgres
6+
image: postgres:latest
77
restart: always
8+
#network_mode: host
89
environment:
910
- POSTGRES_USER=postgres
1011
- POSTGRES_PASSWORD=postgres
1112
ports:
12-
- '5432:5432'
13+
- 5432:5432
1314
volumes:
1415
- ./postgres_data:/var/lib/postgresql/data
15-
- ./src/main/resources/dml/schema.sql:/docker-entrypoint-initdb.d/schema.sql
16+
# https://stackoverflow.com/questions/26598738/how-to-create-user-database-in-script-for-docker-postgres
17+
- ./src/main/resources/dml/schema.sql:/docker-entrypoint-initdb.d/1-schema.sql
1618
command: [ "postgres", "-c", "wal_level=logical" ]
1719
adminer:
18-
image: adminer
20+
container_name: adminer
21+
image: adminer:latest
1922
restart: always
23+
#network_mode: host
24+
depends_on:
25+
- db
2026
ports:
21-
- 8081:8081
27+
- 80:8080
28+
29+
# docker networking!
30+
# https://stackoverflow.com/questions/56582446/how-to-use-host-network-for-docker-compose
31+
# https://stackoverflow.com/questions/70725881/what-is-the-equivalent-of-add-host-host-docker-internalhost-gateway-in-a-comp
32+
# networks:
33+
# mynetwork:
34+
# external: true
35+
# name: host

debezium/readme.md

+3-1
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,6 @@ https://github.com/rayanegouda/medium/tree/main/step1
2424

2525
## postgres
2626

27-
https://debezium.io/documentation/reference/stable/connectors/postgresql.html
27+
https://debezium.io/documentation/reference/stable/connectors/postgresql.html
28+
29+
![img.png](img.png)

debezium/src/main/resources/dml/schema.sql

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ CREATE TABLE IF NOT EXISTS the_simpsons.character (
99
update_ts TIMESTAMP DEFAULT current_timestamp NOT NULL
1010
);
1111
------/*Insertion des données dans la table character.*/
12-
INSERT INTO the_simpsons.character (nom, pays) VALUES
12+
INSERT INTO the_simpsons.character (name, surname) VALUES
1313
('Homer','Simpson'),
1414
('Bart','Simpson'),
1515
('Lisa','Simpson');

0 commit comments

Comments
 (0)