-
Notifications
You must be signed in to change notification settings - Fork 0
/
service.yaml
300 lines (279 loc) · 9.89 KB
/
service.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
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
tosca_definitions_version: tosca_simple_yaml_1_3
imports:
- modules/openstack/openstack_vm.yaml
- modules/docker/docker_host.yaml
- modules/docker/docker_network.yaml
- modules/docker/docker_registry.yaml
- modules/docker/docker_component.yaml
- modules/docker/docker_certificate.yaml
- modules/docker/docker_volume.yaml
- modules/misc/ssh/types.yaml
- modules/misc/tls/types.yaml
- library/config/types.yaml
- library/util/types.yaml
topology_template:
inputs:
ssh-key-name:
type: string
vm-name:
type: string
image-name:
type: string
openstack-network-name:
type: string
security-groups:
type: string
flavor-name:
type: string
docker-network:
type: string
dockerhub-user:
type: string
default: ""
dockerhub-pass:
type: string
default: ""
docker-public-registry-url:
type: string
default: ""
docker-registry-cert-country-name:
type: string
default: ""
docker-registry-cert-organization-name:
type: string
default: ""
docker-registry-cert-email-address:
type: string
default: ""
docker-registry-cert-path:
type: string
default: ""
docker-registry-cert-files-prefix:
type: string
default: ""
postgres_env:
type: map
xopera_env:
type: map
ssh_config:
type: map
username:
type: string
# identity_file:
# type: string
node_templates:
security-rules-sodalite:
type: sodalite.nodes.OpenStack.SecurityRules
properties:
ports:
component_ports:
port_range_max: 8085
remote_ip_prefix: 0.0.0.0/0
port_range_min: 8080
protocol: tcp
http_port:
port_range_min: 80
port_range_max: 80
protocol: tcp
remote_ip_prefix: 0.0.0.0/0
5000_ports:
port_range_min: 5000
port_range_max: 5005
protocol: tcp
remote_ip_prefix: 0.0.0.0/0
https_port:
port_range_min: 443
port_range_max: 444
protocol: tcp
remote_ip_prefix: 0.0.0.0/0
group_name: sodalite-uc
group_description: Sodalite UC security group
sodalite-vm:
type: sodalite.nodes.OpenStack.VM
properties:
name: { get_input: vm-name }
key_name: { get_input: ssh-key-name }
image: { get_input: image-name }
network: { get_input: openstack-network-name }
security_groups: { get_input: security-groups }
flavor: { get_input: flavor-name }
ssh_config: { get_input: ssh_config }
# ssh_config:
# IdentityFile: { get_input: identity_file } # doesn't work due to https://github.com/xlab-si/xopera-opera/issues/102
username: { get_input: username }
requirements:
- protected_by: security-rules-sodalite
docker-host:
type: sodalite.nodes.DockerHost
requirements:
- host: sodalite-vm
docker-network:
type: sodalite.nodes.DockerNetwork
properties:
name: { get_input: docker-network }
requirements:
- host: sodalite-vm
- dependency: docker-host
docker-public-registry:
type: sodalite.nodes.DockerRegistry
properties:
docker_registry_url: { get_input: docker-public-registry-url }
requirements:
- host: sodalite-vm
- dependency: docker-host
# xopera-rest-api
# https://github.com/SODALITE-EU/xopera-rest-api
openstack-keys:
type: sodalite.nodes.ConfigureKeys
requirements:
- host: sodalite-vm
tls-certs:
type: sodalite.nodes.TLS.Certificate
properties:
country_name: { get_input: docker-registry-cert-country-name }
organization_name: { get_input: docker-registry-cert-organization-name }
email_address: { get_input: docker-registry-cert-email-address }
cert_path: /home/nginx/certs
# domain_name: { get_property: [ SELF, host, public_address ] }
requirements:
- host: sodalite-vm
- dependency: docker-host
proxy-tls-config:
type: sodalite.nodes.Configuration.NginxConfig
properties:
cert_files_prefix: { get_attribute: [ SELF, dependency, cert_files_prefix ] }
dir: /home/nginx
filename: certificates.toml
template_name: certificates.toml.tmpl
requirements:
- host: sodalite-vm
- dependency: tls-certs
ui-api-spec:
type: sodalite.nodes.util.File
properties:
path: /home/xopera/openapi-spec.yml
url: https://raw.githubusercontent.com/SODALITE-EU/xopera-rest-api/master/openapi-spec.yml
requirements:
- host: sodalite-vm
postgres:
type: sodalite.nodes.DockerizedComponent
properties:
image_name: library/postgres:13
volumes:
- "/home/postgres:/var/lib/postgresql/data"
alias: xopera-postgres
env: { get_input: postgres_env }
docker_network_name: { get_property: [ SELF, network, name ] }
labels:
traefik.enable: "true"
traefik.tcp.services.postgres.loadbalancer.server.port: "5432"
traefik.tcp.routers.postgres.rule: "HostSNI(`*`)"
traefik.tcp.routers.postgres.entrypoints: "postgres"
requirements:
- host: docker-host
- network: docker-network
- registry: docker-public-registry
api:
type: sodalite.nodes.DockerizedComponent
properties:
alias: xopera-rest-api
docker_network_name: { get_property: [ SELF, network, name ] }
image_name: sodaliteh2020/xopera-rest-api:latest
restart_policy: always
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- /root/.ssh/:/root/.ssh/
labels:
traefik.enable: "true"
traefik.http.services.api.loadbalancer.server.port: "8080"
# http config
traefik.http.routers.api.rule: "PathPrefix(`/`)"
traefik.http.routers.api.entrypoints: "web"
# https config
traefik.http.routers.api-https.rule: "PathPrefix(`/`)"
traefik.http.routers.api-https.entrypoints: "websecure"
traefik.http.routers.api-https.tls: "true"
env: { get_input: xopera_env }
requirements:
- host: docker-host
- registry: docker-public-registry
- network: docker-network
- dependency: openstack-keys
- dependency: postgres
ui:
type: sodalite.nodes.DockerizedComponent
properties:
alias: xopera-ui
docker_network_name: { get_property: [ SELF, network, name ] }
image_name: swaggerapi/swagger-ui:v3.37.0
restart_policy: always
restart: yes
volumes:
- /home/xopera/openapi-spec.yml:/openapi/openapi-spec.yml:ro
env:
SWAGGER_JSON: /openapi/openapi-spec.yml
labels:
traefik.enable: "true"
traefik.http.services.ui.loadbalancer.server.port: "8080"
traefik.http.middlewares.stripprefix-ui.stripprefix.prefixes: "/ui"
# http config
traefik.http.routers.ui.entrypoints: "web"
traefik.http.routers.ui.rule: "PathPrefix(`/ui`)"
traefik.http.routers.ui.middlewares: "stripprefix-ui"
# https config
traefik.http.routers.ui-https.entrypoints: "websecure"
traefik.http.routers.ui-https.tls: "true"
traefik.http.routers.ui-https.rule: "PathPrefix(`/ui`)"
traefik.http.routers.ui-https.middlewares: "stripprefix-ui"
requirements:
- host: docker-host
- registry: docker-public-registry
- network: docker-network
- dependency: api
- dependency: ui-api-spec
proxy:
type: sodalite.nodes.DockerizedComponent
properties:
alias: xopera-proxy
docker_network_name: { get_property: [ SELF, network, name ] }
image_name: library/traefik:v2.3.4
command:
- "--accesslog=true"
- "--log.level=info"
- "--providers.docker=true"
- "--providers.docker.exposedbydefault=false"
# entrypoints
- "--entrypoints.web.address=:5000"
- "--entrypoints.websecure.address=:5001"
- "--entrypoints.postgres.address=:5432"
- "--entrypoints.traefik.address=:8080"
# http certs config
- "--providers.file.directory=/configuration/"
- "--providers.file.watch=true"
# dashboard
- "--api.dashboard=true"
restart_policy: always
restart: yes
ports: ['5001:5001', '5000:5000', '8080:8080', '5432:5432']
volumes:
- /var/run/docker.sock:/var/run/docker.sock:ro
- /home/nginx/certificates.toml:/configuration/certificates.toml:ro
- /home/nginx/certs:/etc/nginx/certs
labels:
traefik.enable: "true"
traefik.http.routers.traefik.rule: "(PathPrefix(`/traefik`) || PathPrefix(`/api`))"
traefik.http.routers.traefik.service: "api@internal"
traefik.http.routers.traefik.entrypoints: "traefik"
traefik.http.routers.traefik.tls: "true"
traefik.http.middlewares.strip.stripprefix.prefixes: "/traefik"
traefik.http.routers.traefik.middlewares: "auth, strip"
traefik.http.middlewares.auth.digestauth.removeheader: "true"
traefik.http.middlewares.auth.digestauth.users: "test:traefik:5200b80022bb7d8e8c8bf2eb34b985cb"
requirements:
- host: docker-host
- registry: docker-public-registry
- network: docker-network
- dependency: api
- dependency: ui
- dependency: postgres
- dependency: proxy-tls-config