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.backend-test.yml
104 lines (95 loc) · 2.61 KB
/
docker-compose.backend-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
version: "3.8"
services:
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: test
volumes:
- .:/app
- gems_volume_handler:/usr/local/bundle
tty: true
command: >
bash -c 'bundle install && yarn install && bin/rake db:seed &&
RAILS_ENV=test bundle exec rspec --exclude-pattern spec/cache'
networks:
- wca-registration
depends_on:
- localstack
- prometheus_exporter
- redis
prometheus_exporter:
build:
context: .
dockerfile: dockerfile.metrics
tty: true
ports:
- "9090:9090"
networks:
- wca-registration
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"
DYNAMO_REGISTRATIONS_TABLE: "registrations-test"
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
# 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
# Use redis for tests that enable redis
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