-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
109 lines (98 loc) · 3.33 KB
/
docker-compose.yml
File metadata and controls
109 lines (98 loc) · 3.33 KB
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
services:
static_hosting:
image: nginx
volumes:
- ./frontend/dist:/usr/share/nginx/html:ro
- ./settings/nginx.conf:/etc/nginx/conf.d/default.conf:ro
ports:
- 80:80
depends_on:
create_indexes:
condition: service_completed_successfully
backend:
image: couchdb:3
ports:
- 5984:5984
environment:
- COUCHDB_USER
- COUCHDB_PASSWORD
volumes:
- couchdb-data:/opt/couchdb/data
healthcheck:
test: curl -f http://localhost:5984/_up || exit 1
start_period: 10s
start_interval: 2s
accessible_backend:
image: curlimages/curl
environment:
- COUCHDB_USER
- COUCHDB_PASSWORD
entrypoint: ["/bin/sh", "-c"]
command:
- |
alias put="curl -X PUT -u '$${COUCHDB_USER}:$${COUCHDB_PASSWORD}'"
put backend:5984/_node/nonode@nohost/_config/chttpd/enable_cors --data '"true"'
put backend:5984/_node/nonode@nohost/_config/cors/origins --data '"*"'
put backend:5984/users
put backend:5984/users/_security --data '{"members":{"roles":[]},"admins":{"roles":["_admin"]}}'
put backend:5984/trips
put backend:5984/trips/_security --data '{"members":{"roles":[]},"admins":{"roles":["_admin"]}}'
put backend:5984/bookings
put backend:5984/bookings/_security --data '{"members":{"roles":[]},"admins":{"roles":["_admin"]}}'
depends_on:
backend:
condition: service_healthy
updated_samples:
image: curlimages/curl
environment:
- COUCHDB_USER
- COUCHDB_PASSWORD
volumes:
- ./public:/data:ro
entrypoint: ["/bin/sh", "-c"]
command:
- |
curl -X POST -u "$${COUCHDB_USER}:$${COUCHDB_PASSWORD}" \
http://backend:5984/users/_bulk_docs \
-H "Content-Type: application/json" \
-d @/data/users_data.json
curl -X POST -u "$${COUCHDB_USER}:$${COUCHDB_PASSWORD}" \
http://backend:5984/trips/_bulk_docs \
-H "Content-Type: application/json" \
-d @/data/trips_data.json
curl -X POST -u "$${COUCHDB_USER}:$${COUCHDB_PASSWORD}" \
http://backend:5984/bookings/_bulk_docs \
-H "Content-Type: application/json" \
-d @/data/bookings_data.json
depends_on:
accessible_backend:
condition: service_completed_successfully
create_indexes:
image: curlimages/curl
environment:
- COUCHDB_USER
- COUCHDB_PASSWORD
volumes:
- ./backend:/indexes:ro
entrypoint: ["/bin/sh", "-c"]
command:
- |
echo "Creating indexes..."
curl -X POST -u "$${COUCHDB_USER}:$${COUCHDB_PASSWORD}" \
http://backend:5984/trips/_index \
-H "Content-Type: application/json" \
-d @/indexes/trips_search_index.json
curl -X POST -u "$${COUCHDB_USER}:$${COUCHDB_PASSWORD}" \
http://backend:5984/trips/_index \
-H "Content-Type: application/json" \
-d @/indexes/trips_by_conductor.json
curl -X POST -u "$${COUCHDB_USER}:$${COUCHDB_PASSWORD}" \
http://backend:5984/bookings/_index \
-H "Content-Type: application/json" \
-d @/indexes/bookings_by_trip.json
echo "✅ Indexes created successfully!"
depends_on:
updated_samples:
condition: service_completed_successfully
volumes:
couchdb-data: