+9
.dockerignore
+9
.dockerignore
+16
Dockerfile
+16
Dockerfile
···
···
1
+
FROM ghcr.io/gleam-lang/gleam:v1.11.1-erlang-alpine
2
+
3
+
# Set working directory
4
+
WORKDIR /app
5
+
6
+
# Copy source code
7
+
COPY . .
8
+
9
+
# Install dependencies
10
+
RUN gleam deps download
11
+
12
+
# Compile project
13
+
RUN gleam build
14
+
15
+
# Command to run the Gleam application
16
+
CMD ["gleam", "run"]
+28
config/nginx.conf
+28
config/nginx.conf
···
···
1
+
events {
2
+
worker_connections 1000;
3
+
}
4
+
5
+
http {
6
+
access_log off;
7
+
error_log /dev/null;
8
+
sendfile off;
9
+
10
+
upstream api {
11
+
server api1:8000;
12
+
server api2:8000;
13
+
keepalive 32;
14
+
}
15
+
16
+
server {
17
+
listen 9999;
18
+
19
+
location / {
20
+
proxy_buffering off;
21
+
proxy_set_header Connection "";
22
+
proxy_http_version 1.1;
23
+
proxy_set_header Keep-Alive "";
24
+
proxy_set_header Proxy-Connection "keep-alive";
25
+
proxy_pass http://api;
26
+
}
27
+
}
28
+
}
+48
-1
docker-compose.yml
+48
-1
docker-compose.yml
···
1
services:
2
valkey:
3
image: valkey/valkey:alpine
4
restart: unless-stopped
5
networks:
6
- backend
···
11
limits:
12
cpus: "0.15"
13
memory: "30MB"
14
+
volumes:
15
+
- redis-data:/data
16
+
17
+
api1: &app
18
+
build:
19
+
context: .
20
+
container_name: api1
21
+
networks:
22
+
- backend
23
+
- payment-processor
24
+
restart: always
25
+
environment:
26
+
REDIS_CONN: valkey
27
+
PROCESSOR: true
28
+
depends_on:
29
+
- valkey
30
+
deploy:
31
+
resources:
32
+
limits:
33
+
cpus: "0.6"
34
+
memory: "155MB"
35
+
36
+
api2:
37
+
<<: *app
38
+
environment:
39
+
REDIS_CONN: valkey
40
+
PROCESSOR: false
41
+
container_name: api2
42
+
43
+
nginx:
44
+
image: nginx:1.29.0-alpine
45
+
volumes:
46
+
- $PWD/config/nginx.conf:/etc/nginx/nginx.conf:ro
47
+
ports:
48
+
- 9999:9999
49
+
depends_on:
50
+
- api1
51
+
- api2
52
+
networks:
53
+
- backend
54
+
deploy:
55
+
resources:
56
+
limits:
57
+
cpus: "0.15"
58
+
memory: "10MB"
59
+
60
+
volumes:
61
+
redis-data:
62
63
networks:
64
backend: