-
Notifications
You must be signed in to change notification settings - Fork 1
/
service.yaml
206 lines (187 loc) · 6.7 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
tosca_definitions_version: tosca_simple_yaml_1_3
imports:
- 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/misc/tls/types.yaml
- library/config/types.yaml
node_types:
sodalite.nodes.SodaliteVM:
derived_from: tosca.nodes.Compute
properties:
username:
type: string
name:
type: string
description: Name of machine. Used to write into registry certificate
topology_template:
inputs:
username:
type: string
docker-network:
type: string
docker-public-registry-url:
type: string
default: ""
docker-private-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: ""
image_builder_env:
type: map
node_templates:
sodalite-vm:
type: sodalite.nodes.SodaliteVM
properties:
username: { get_input: username }
name: localhost
attributes:
private_address: localhost
public_address: localhost
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-private-registry-certificate:
type: sodalite.nodes.RegistryCertificate
properties:
registry_ip: { get_input: docker-private-registry-url }
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 }
requirements:
- host: sodalite-vm
- dependency: docker-host
docker-private-registry:
type: sodalite.nodes.DockerRegistry
properties:
docker_registry_url: { get_input: docker-private-registry-url }
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
docker-buildx-builder-config:
type: sodalite.nodes.BuildxConfig
properties:
registry_ip: { get_input: docker-private-registry-url }
requirements:
- host: sodalite-vm
- dependency: docker-host
- dependency: docker-private-registry-certificate
# image-builder-api
# https://github.com/SODALITE-EU/image-builder
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
api:
type: sodalite.nodes.DockerizedComponent
properties:
alias: image-builder-api
docker_network_name: { get_property: [ SELF, network, name ] }
image_name: sodaliteh2020/image-builder-api
restart_policy: always
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- ~/.docker:/root/.docker
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:
REGISTRY_IP: { get_input: docker-private-registry-url }
DEBUG: "false"
LOG_LEVEL: debug
AUTH_API_KEY: test
requirements:
- host: docker-host
- registry: docker-public-registry
- network: docker-network
proxy:
type: sodalite.nodes.DockerizedComponent
properties:
alias: image-builder-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.traefik.address=:8888"
# http certs config
- "--providers.file.directory=/configuration/"
- "--providers.file.watch=true"
# dashboard
- "--api.dashboard=true"
restart_policy: always
ports: ['5001:5001', '5000:5000', '8888:8888']
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: proxy-tls-config