This repository has been archived by the owner on Mar 23, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 98
/
docker-compose-splinter.yaml
192 lines (181 loc) · 5.38 KB
/
docker-compose-splinter.yaml
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
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
# Copyright 2019 Cargill Incorporated
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ------------------------------------------------------------------------------
version: '3.6'
volumes:
contracts-shared:
splinter-shared:
services:
gridd:
image: gridd
container_name: gridd
build:
context: .
dockerfile: daemon/Dockerfile
args:
- REPO_VERSION=${REPO_VERSION}
- CARGO_ARGS=${CARGO_ARGS}
expose:
- 8080
ports:
- '8080:8080'
entrypoint: |
bash -c "
# we need to wait for the db to have started.
until PGPASSWORD=grid_example psql -h db -U grid -c '\q'; do
>&2 echo \"Database is unavailable - sleeping\"
sleep 1
done
grid -vv database migrate \
-C postgres://grid:grid_example@db/grid &&
gridd -vv -b gridd:8080 -C splinter:http://splinterd:8085 \
--database-url postgres://grid:grid_example@db/grid
"
pike-contract-builder:
image: pike-contract-builder
container_name: pike-contract-builder
build:
context: .
dockerfile: contracts/pike/Dockerfile
args:
- REPO_VERSION=${REPO_VERSION}
volumes:
- contracts-shared:/usr/share/scar
entrypoint: |
bash -c "
cp /tmp/grid-pike*.scar /usr/share/scar
"
product-contract-builder:
image: product-contract-builder
container_name: product-contract-builder
build:
context: .
dockerfile: contracts/product/Dockerfile
args:
- REPO_VERSION=${REPO_VERSION}
volumes:
- contracts-shared:/usr/share/scar
entrypoint: |
bash -c "
cp /tmp/grid-product*.scar /usr/share/scar
"
schema-contract-builder:
image: schema-contract-builder
container_name: schema-contract-builder
build:
context: .
dockerfile: contracts/schema/Dockerfile
args:
- REPO_VERSION=${REPO_VERSION}
volumes:
- contracts-shared:/usr/share/scar
entrypoint: |
bash -c "
cp /tmp/grid-schema*.scar /usr/share/scar
"
tnt-contract-builder:
image: tnt-contract-builder
container_name: tnt-contract-builder
build:
context: .
dockerfile: contracts/track_and_trace/Dockerfile
args:
- REPO_VERSION=${REPO_VERSION}
volumes:
- contracts-shared:/usr/share/scar
entrypoint: |
bash -c "
cp /tmp/grid-track-and-trace*.scar /usr/share/scar
"
location-contract-builder:
image: location-contract-builder
container_name: location-contract-builder
build:
context: .
dockerfile: contracts/location/Dockerfile
args:
- REPO_VERSION=${REPO_VERSION}
volumes:
- contracts-shared:/usr/share/scar
entrypoint: |
bash -c "
cp /tmp/grid-location*.scar /usr/share/scar
"
purchase-order-contract-builder:
image: purchase-order-contract-builder
container_name: purchase-order-contract-builder
build:
context: .
dockerfile: contracts/purchase_order/Dockerfile
args:
- REPO_VERSION=${REPO_VERSION}
volumes:
- contracts-shared:/usr/share/scar
entrypoint: |
bash -c "
cp /tmp/grid-purchase-order*.scar /usr/share/scar
"
db:
image: postgres
container_name: db
restart: always
expose:
- 5432
ports:
- "5432:5432"
environment:
POSTGRES_USER: grid
POSTGRES_PASSWORD: grid_example
POSTGRES_DB: grid
splinter-cli:
image: splintercommunity/splinter-cli:latest
container_name: splinter-cli
volumes:
- splinter-shared:/splinter_shared
command: |
bash -c "
if [ ! -f /splinter_shared/private/server.key ]
then
splinter-cli cert generate \
-d /splinter_shared/ \
--force
fi
"
splinterd:
image: splintercommunity/splinterd:latest
container_name: splinterd
volumes:
- contracts-shared:/usr/share/scar
- splinter-shared:/splinter_shared
entrypoint: |
bash -c "
while [ ! -f /splinter_shared/private/server.key ]; do \
echo 'waiting for certs and keys'; \
sleep 1; \
done && \
# Copy the generated keys and certificates to its expected location
cp -a /splinter_shared/. /etc/splinter/certs && \
mv /etc/splinter/nodes.yaml.example /etc/splinter/nodes.yaml && \
splinterd -vv \
--rest-api-endpoint 0.0.0.0:8085 \
--network-endpoints tcps://0.0.0.0:8044 \
--node-id splinter-node \
--service-endpoint tcp://0.0.0.0:8043 \
--storage yaml \
--tls-client-cert /etc/splinter/certs/client.crt \
--tls-client-key /etc/splinter/certs/private/client.key \
--tls-server-cert /etc/splinter/certs/server.crt \
--tls-server-key /etc/splinter/certs/private/server.key \
--tls-insecure
"