-
Notifications
You must be signed in to change notification settings - Fork 14
/
docker-compose.yml
53 lines (49 loc) · 1.53 KB
/
docker-compose.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
version: "3.7"
x-base-service: &default-app
image: node:20-alpine
restart: always
ports:
- "3000"
environment:
- VIRTUAL_HOST=proxy
- VIRTUAL_PORT=3000
volumes:
- "./service.js:/service.js:ro"
services:
# This is a reverse proxy using Jason Wilder's nginx image. You can read
# more about it at his blog:
#
# http://jasonwilder.com/blog/2014/03/25/automated-nginx-reverse-proxy-for-docker/
proxy:
image: jwilder/nginx-proxy:1.3-alpine
restart: always
ports:
- "8000:80"
volumes:
- "/var/run/docker.sock:/tmp/docker.sock:ro"
# One version of a service
service_a:
<<: *default-app
command: |
node /service.js Service-A
# A second instance to emulate an updated version of the service. This is
# just a copy of the first version to keep it simple.
service_b:
<<: *default-app
command: |
node /service.js Service-B
# This simulates multiple client requests coming in continuously to the proxy.
# Apache ab (http://httpd.apache.org/docs/current/programs/ab.html) is used
# for simplicity's sake, and it will report the number of successful requests,
# as well as the number of non-2xx requests, which is what we are trying to
# keep to zero.
ab:
image: httpd
depends_on:
- proxy
# Use a long timeout for ab so that it doesn't die
# when the connection to the backend dies. We want
# it to run to for 120s with whatever number of
# requests, thus -n10000000.
command: |
ab -s600 -t120 -n10000000 -c1 http://proxy/