Skip to content

Commit 1fe4601

Browse files
authored
docker-compose(-next).yml: Improve docker compose recipe (#1771)
Dont use host mode for networking Dont expose ports to external, unless necessary Change to unified .env file Rename container name to not clash with production Expose dashboard directly, without proxy docker-compose-next.yml: Dont expose unnecessary ports to world Signed-off-by: Denys Fedoryshchenko <denys.f@collabora.com>
1 parent 868835d commit 1fe4601

2 files changed

Lines changed: 34 additions & 70 deletions

File tree

docker-compose-next.yml

Lines changed: 5 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,6 @@ services:
2626
- dashboard-db-data:/var/lib/postgresql/data
2727
networks:
2828
- private
29-
ports:
30-
- "${DB_PORT:-5434}:5432"
3129
healthcheck:
3230
test: ["CMD-SHELL", "pg_isready -U ${DB_USER:-admin}"]
3331
interval: 5s
@@ -40,8 +38,6 @@ services:
4038
restart: always
4139
networks:
4240
- private
43-
ports:
44-
- 6379:6379
4541

4642
backend:
4743
image: ${IMAGE_REGISTRY:-ghcr.io}/${IMAGE_OWNER:-kernelci}/${IMAGE_REPOSITORY:-dashboard}/dashboard-backend:${IMAGE_TAG:-latest}
@@ -63,12 +59,7 @@ services:
6359
- private
6460
- public
6561
ports:
66-
- target: 8000
67-
published: 8000
68-
protocol: tcp
69-
- target: 8001
70-
published: 8001
71-
protocol: tcp
62+
- 2001:2001
7263
depends_on:
7364
- redis
7465

@@ -87,10 +78,11 @@ services:
8778
- public
8879
volumes:
8980
- static-data:/data/static
81+
- ${SSL_CHAIN_FILE:-/etc/letsencrypt/live/d.kernelci.org/fullchain.pem}:/etc/nginx/ssl/fullchain.pem
82+
- ${SSL_KEY_FILE:-/etc/letsencrypt/live/d.kernelci.org/privkey.pem}:/etc/nginx/ssl/privkey.pem
9083
ports:
91-
- target: 80
92-
published: 80
93-
protocol: tcp
84+
- 80:80
85+
- 443:443
9486
env_file: .env
9587
environment:
9688
PROXY_TARGET: ${PROXY_TARGET:-http://backend:8000}
@@ -115,10 +107,6 @@ services:
115107
networks:
116108
- private
117109
- public
118-
ports:
119-
- target: ${INGESTER_METRICS_PORT:-8002}
120-
published: ${INGESTER_METRICS_PORT:-8002}
121-
protocol: tcp
122110
depends_on:
123111
- redis
124112
profiles: ["with_commands"]

docker-compose.yml

Lines changed: 29 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -8,22 +8,20 @@ networks:
88
public:
99
private:
1010

11-
secrets:
12-
postgres_password_secret:
13-
file: ./backend/runtime/secrets/postgres_password_secret
14-
1511
services:
1612
backend:
17-
container_name: dashboard_backend_service
13+
container_name: dashboard_backend_service_staging
1814
build:
1915
context: ./backend
2016
volumes:
2117
- backend-data:${BACKEND_VOLUME_DIR:-/volume_data}
2218
env_file:
23-
- .env.backend
19+
- .env
2420
networks:
2521
- private
2622
- public
23+
ports:
24+
- 8000:8000
2725
restart: always
2826
image: ${IMAGE_REGISTRY:-ghcr.io}/${IMAGE_REPOSITORY:-local}/dashboard-backend:${IMAGE_TAG:-latest}
2927
environment:
@@ -38,30 +36,19 @@ services:
3836
- --bind=0.0.0.0:8000
3937
- --timeout=250
4038
entrypoint: "./utils/docker/backend_entrypoint.sh"
41-
secrets:
42-
- postgres_password_secret
4339
depends_on:
4440
- redis
4541
- dashboard_db
46-
ports:
47-
- target: 8000
48-
published: 8000
49-
protocol: tcp
50-
mode: host
51-
- target: 8001
52-
published: 8001
53-
protocol: tcp
54-
mode: host
5542

5643
ingester:
57-
container_name: dashboard_ingester_service
44+
container_name: dashboard_ingester_service_staging
5845
build:
5946
context: ./backend
6047
volumes:
6148
- backend-data:${BACKEND_VOLUME_DIR:-/volume_data} # Directory of the tree names file and other data
6249
- ${INGESTER_SPOOL_DIR}:/app/spool # Directory for ingester to monitor
6350
env_file:
64-
- .env.ingester
51+
- .env
6552
networks:
6653
- private
6754
- public
@@ -80,18 +67,15 @@ services:
8067
depends_on:
8168
- dashboard_db
8269
ports:
83-
- target: ${INGESTER_METRICS_PORT:-8002}
84-
published: ${INGESTER_METRICS_PORT:-8002}
85-
protocol: tcp
86-
mode: host
70+
- 8002:8002
8771
profiles: ["with_commands"]
88-
72+
8973
pending_aggregations_processor:
90-
container_name: pending_aggregations_processor_service
74+
container_name: pending_aggregations_processor_service_staging
9175
build:
9276
context: ./backend
9377
env_file:
94-
- .env.pending_aggregations
78+
- .env
9579
networks:
9680
- private
9781
- public
@@ -110,30 +94,23 @@ services:
11094
depends_on:
11195
- dashboard_db
11296
ports:
113-
- target: 8001
114-
published: ${PENDING_AGGREGATIONS_METRICS_PORT:-8003}
115-
protocol: tcp
116-
mode: host
97+
- 8003:8001
11798
profiles: ["with_commands"]
11899

119100
dashboard_db:
120101
image: postgres:17
121102
env_file:
122-
- .env.db
103+
- .env
123104
volumes:
124105
- dashboard-db-data:/var/lib/postgresql/data
125106
networks:
126107
- private
127-
ports:
128-
- "${DB_PORT:-5434}:5432"
129108

130109
redis:
131110
image: redis:8.0-M04-alpine
132111
restart: always
133112
networks:
134113
- private
135-
ports:
136-
- 6379:6379
137114

138115
dashboard:
139116
build:
@@ -143,21 +120,20 @@ services:
143120
volumes:
144121
- static-data:/data/static
145122

146-
proxy:
147-
build: ./proxy
148-
image: ${IMAGE_REGISTRY:-ghcr.io}/${IMAGE_REPOSITORY:-local}/dashboard-proxy:${IMAGE_TAG:-latest}
149-
restart: always
150-
depends_on:
151-
- backend
152-
- dashboard
153-
networks:
154-
- public
155-
volumes:
156-
- static-data:/data/static
157-
ports:
158-
- target: 80
159-
published: 80
160-
protocol: tcp
161-
mode: host
162-
env_file:
163-
- .env.proxy
123+
# proxy:
124+
# build: ./proxy
125+
# image: ${IMAGE_REGISTRY:-ghcr.io}/${IMAGE_REPOSITORY:-local}/dashboard-proxy:${IMAGE_TAG:-latest}
126+
# restart: always
127+
# depends_on:
128+
# - backend
129+
# - dashboard
130+
# networks:
131+
# - public
132+
# volumes:
133+
# - static-data:/data/static
134+
# - /etc/letsencrypt/live/staging.dashboard.kernelci.org/fullchain.pem:/etc/nginx/ssl/fullchain.pem
135+
# - /etc/letsencrypt/live/staging.dashboard.kernelci.org/privkey.pem:/etc/nginx/ssl/privkey.pem
136+
# ports:
137+
# - 9000:9000
138+
# env_file:
139+
# - .env

0 commit comments

Comments
 (0)