-
Notifications
You must be signed in to change notification settings - Fork 4
/
docker-compose.backend-test.yml
105 lines (98 loc) · 2.7 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
105
version: "3.8"
services:
wca_registration_test:
build:
context: .
dockerfile: dockerfile.dev
ports:
- "3001:3000"
environment:
LOCALSTACK_ENDPOINT: "http://localstack:4566"
REDIS_URL: "redis://redis:6379"
RAILS_ENV: test
QUEUE_NAME: "registrations.fifo"
volumes:
- .:/app
- gems_volume_handler:/usr/local/bundle
tty: true
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
- redis
- wca_registration_worker
healthcheck:
test: curl --fail http://localhost:3000/healthcheck || exit 1
dns:
# Set the DNS server to be the LocalStack container
- 10.0.2.20
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"
DYNAMO_REGISTRATIONS_TABLE: "registrations-development"
QUEUE_NAME: "registrations.fifo"
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 && bundle exec shoryuken -R -q registrations.fifo'
networks:
- wca-registration
dns:
# Set the DNS server to be the LocalStack container
- 10.0.2.20
# 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:
ipv4_address: 10.0.2.20
# Use redis for tests that enable redis
redis:
container_name: redis
image: redis:latest
ports:
- '6379:6379'
volumes:
- cache:/data
networks:
- wca-registration
healthcheck:
test: redis-cli ping || exit 1
volumes:
gems_volume_handler:
driver: local
gems_volume_worker:
driver: local
cache:
driver: local
networks:
wca-registration:
name: wca-registration
ipam:
config:
# Specify the subnet range for IP address allocation
- subnet: 10.0.2.0/24