This repository has been archived by the owner on Jan 3, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathdocker-compose.frontend-test.yml
158 lines (148 loc) · 4.04 KB
/
docker-compose.frontend-test.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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
version: "3.8"
services:
cypress:
image: cypress/included
volumes:
- ./e2e:/e2e
working_dir: /e2e
environment:
CYPRESS_BASE_URL: http://nginx
depends_on:
wca_registration_handler:
condition: service_healthy
wca_registration_worker:
condition: service_healthy
nginx:
condition: service_healthy
networks:
- wca-registration
wca_registration_handler:
container_name: wca_registration_handler
build:
context: .
dockerfile: dockerfile.dev
ports:
- "3001:3000"
environment:
LOCALSTACK_ENDPOINT: "http://localstack:4566"
PROMETHEUS_EXPORTER: "prometheus_exporter"
REDIS_URL: "redis://redis:6379"
RAILS_ENV: development
volumes:
- .:/app
- gems_volume_handler:/usr/local/bundle
tty: true
# First, install Ruby and Node dependencies
# Start the server and bind to 0.0.0.0 (vs 127.0.0.1) so Docker's port mappings work correctly
command: >
bash -c 'bundle install && yarn install && bin/rake db:seed &&
bin/rails server -b 0.0.0.0'
networks:
- wca-registration
depends_on:
- localstack
- prometheus_exporter
- redis
healthcheck:
test: curl --fail http://localhost:3000/healthcheck || exit 1
prometheus_exporter:
container_name: prometheus_exporter
build:
context: .
dockerfile: dockerfile.metrics
tty: true
ports:
- "9091:9091"
networks:
- wca-registration
wca_registration_worker:
container_name: wca_registration_worker
build:
context: .
dockerfile: dockerfile.dev
environment:
LOCALSTACK_ENDPOINT: "http://localstack:4566"
AWS_REGION: "us-east-1"
AWS_ACCESS_KEY_ID: "fake-key"
AWS_SECRET_ACCESS_KEY: "fake-access-key"
PROMETHEUS_EXPORTER: "prometheus_exporter"
DYNAMO_REGISTRATIONS_TABLE: "registrations-development"
volumes:
- .:/app
- gems_volume_worker:/usr/local/bundle
tty: true
# First, install Ruby and Node dependencies
# Start the server and bind to 0.0.0.0 (vs 127.0.0.1) so Docker's port mappings work correctly
command: >
bash -c 'bundle install &&
while ! curl http://wca_registration_handler:3000/healthcheck >/dev/null 2>&1; do
echo "Waiting for Handler to be ready" && sleep 5 ;
done && ruby -r "/app/app/worker/queue_poller.rb" -e "QueuePoller.perform"'
networks:
- wca-registration
depends_on:
- wca_registration_handler
healthcheck:
test: pgrep ruby || exit 1
# Emulate AWS Services Locally
localstack:
container_name: "localstack"
image: localstack/localstack
ports:
- "127.0.0.1:4566:4566" # LocalStack Gateway
- "127.0.0.1:4510-4559:4510-4559" # external services port range
environment:
- DEBUG=${DEBUG-}
- DOCKER_HOST=unix:///var/run/docker.sock
volumes:
- "./localstack/volume:/var/lib/localstack"
- "/var/run/docker.sock:/var/run/docker.sock"
networks:
- wca-registration
# Frontend
frontend:
container_name: frontend
build:
context: Frontend
tty:
true
command: bash -c "npm run watch"
networks:
- wca-registration
volumes:
- ./Frontend/src:/app/src
- ./swagger/v1/swagger.yaml:/swagger/v1/swagger.yaml
healthcheck:
test: curl --fail http://localhost:3000 || exit 1
nginx:
container_name: nginx
image: nginx:latest
ports:
- "3002:80"
networks:
- wca-registration
volumes:
- ./Frontend/frontend_local.conf:/etc/nginx/conf.d/default.conf
depends_on:
- frontend
healthcheck:
test: curl --fail http://localhost || exit 1
redis:
container_name: redis
image: redis:latest
ports:
- '6379:6379'
volumes:
- cache:/data
networks:
- wca-registration
volumes:
gems_volume_handler:
driver: local
gems_volume_worker:
driver: local
cache:
driver: local
networks:
wca-registration:
name: wca-registration