You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Jul 20, 2026. It is now read-only.
Copy file name to clipboardExpand all lines: README.md
+40-13Lines changed: 40 additions & 13 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -8,10 +8,15 @@
8
8
|`frontend-dev`| Custom (dev target) | Runs `ng serve` on port 4200. Mounts local `src/` and `public/` for hot reload. |
9
9
|`backend`| Custom (prod target) | Runs compiled Node app on port 3000. Reads secrets from `.env` via `env_file`. |
10
10
|`backend-dev`| Custom (dev target) | Runs `npm run dev` (`tsx watch`) on port 3000. Mounts local `backend/` for hot reload. |
11
-
|`postgres`|`postgres:16-alpine`| Persists DB files in `postgres-data` volume. Exposes port 5432. |
12
-
|`mongo`|`mongo:7`| Persists DB files in `mongodb-data` volume. Exposes port 27017. |
11
+
|`postgres`|`postgres:16-alpine`| Persists DB files in `postgres-data` volume. |
12
+
|`mongo`|`mongo:7`| Persists DB files in `mongodb-data` volume. |
13
+
|`flyway`|`flyway:latest`| Runs migrations before starting the backend. |
13
14
14
-
Container names are prefixed `efes-` (e.g. `frontend` -> `efes-frontend`).
15
+
> [!NOTE]
16
+
> Container names are prefixed `efes-` (e.g. `frontend` -> `efes-frontend`).
17
+
18
+
> [!CAUTION]
19
+
> Starting both production and development containers will result in undefined behavior. Please make sure you stop containers with the command `docker compose --profile <profile_name> stop`.
15
20
16
21
## Ports
17
22
@@ -22,26 +27,35 @@ Host ports are set in your `.env` as `DOCKER_PORT_*` variables. Container-side p
> **Note:** Inside the Docker network, services talk to each other by service name (e.g. `http://backend:3000`), not `localhost`.
31
+
> [!NOTE]
32
+
> Inside the Docker network, services talk to each other by service name (e.g. `http://backend:3000`), not `localhost`.
33
+
34
+
> [!IMPORTANT]
35
+
> Both `postgres` and `mongo` are not exposed as it having those programs already installed onto the host may interfere if not configured properly. If you want to access the shell or run commands, please use `docker compose exec <service_name> <bash|cmd>`.
29
36
30
37
## Volumes
31
38
32
39
| Volume | Mounted to | Purpose |
33
40
|---|---|---|
34
41
|`postgres-data`|`/var/lib/postgresql/data`| Persist Postgres DB files |
35
42
|`mongodb-data`|`/data/db`| Persist Mongo DB files |
36
-
|`backend_node_modules`|`/app/node_modules`| Preserve node_modules across dev rebuilds |
43
+
|`mongodb-configdb`|`/data/configdb`| Persist Mongo DB config files |
44
+
|`backend-node-modules`|`/app/node_modules`| Preserve node_modules across dev rebuilds |
| Local path | Container path | Service | Purpose |
49
+
|---|---|---|---|
50
+
|`./frontend/src`|`/app/src`|`frontend-dev`| Mount app source for `ng serve` so code edits are reflected immediately |
51
+
|`./frontend/public`|`/app/public`|`frontend-dev`| Mount static assets |
52
+
|`./backend`|`/app`|`backend-dev`| Mount backend source for `tsx watch` so the server restarts in code changes |
53
+
|`./backend/db/init`|`/docker-entrypoint-initdb.d`|`postgres`| Bootstrap SQL/shell scripts executed once on a fresh postgres volume |
54
+
|`./backend/db/mongo`|`/docker-entrypoint-initdb.d`|`mongo`| JavaScript init scripts executed once on a fresh mongo volume |
55
+
|`./backend/db/migrations`|`/flyway/sql`|`flyway`| Versioned SQL migration files read by Flyway |
56
+
57
+
> [!NOTE]
58
+
> In production, those folders are not mounted. Instead the service the files it has within its image.
45
59
46
60
## Network
47
61
@@ -51,6 +65,7 @@ All services share the custom bridge network `app-network`. Cross-container DNS
51
65
52
66
-**Postgres** - `pg_isready` healthcheck (see `docker-compose.yml`)
53
67
-**Mongo** - `mongosh ping` healthcheck
68
+
-**Flyway** - runs once to migrate the database
54
69
-`backend` and `backend-dev` both declare `depends_on` with `condition: service_healthy`, so Compose waits for DB readiness before starting them.
55
70
56
71
## How the frontend reaches the API
@@ -73,6 +88,12 @@ Browser JS should always call same-origin paths like `/api/health`. The dev serv
73
88
# Commands
74
89
Open a terminal window from the project root and make sure Docker Desktop is started.
75
90
91
+
> [!NOTE]
92
+
> The default profile is `prod`. Thus the following commands are equivalent: `docker compose --profile prod <...>` and `docker compose <...>`.
93
+
94
+
> [!IMPORTANT]
95
+
> When you enter a command for a given profile, the "counter-command" should also include the profile. Failure to do so may yield networking errors or containers may fail to stop/remove themselves.
96
+
76
97
## Start
77
98
78
99
| Description | Command |
@@ -111,8 +132,14 @@ Open a terminal window from the project root and make sure Docker Desktop is sta
111
132
112
133
| Description | Command |
113
134
|---|---|
114
-
| Open a shell in a container |`docker compose exec frontend-dev sh`|
135
+
| Open a shell in a container |`docker compose exec -it frontend-dev sh`|
115
136
| Run a command in a container |`docker compose exec frontend-dev <cmd>`|
0 commit comments