@meistrari/mise-en-place 2.20.0 → 2.21.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +17 -1
- package/mise/tasks/tela-proxy/traefik.yml +16 -3
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -74,7 +74,23 @@ A service gets `http://{service}.{project}.localhost`, where `project` is the Co
|
|
|
74
74
|
- A service named after the project prefix drops it: service `auth-api` in project `auth` is `api.auth.localhost`.
|
|
75
75
|
- A service named exactly like the project is `{project}.localhost`.
|
|
76
76
|
- Traefik uses the port the image exposes (`EXPOSE`).
|
|
77
|
-
- A service opts out with the `traefik.enable=false` label
|
|
77
|
+
- A service opts out with the `traefik.enable=false` label.
|
|
78
|
+
|
|
79
|
+
A `tela-proxy.host` label replaces a service's host. `{project}` in the value becomes the project's domain, including the worktree suffix, so a worktree keeps its own host:
|
|
80
|
+
|
|
81
|
+
```yaml
|
|
82
|
+
services:
|
|
83
|
+
web:
|
|
84
|
+
labels:
|
|
85
|
+
tela-proxy.host: '{project}.localhost' # service.localhost, or service-feat-x.localhost in a worktree
|
|
86
|
+
admin:
|
|
87
|
+
labels:
|
|
88
|
+
tela-proxy.host: 'painel.{project}.localhost'
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
A value without `{project}` is the same in every worktree, so the main checkout and its worktrees answer on one host.
|
|
92
|
+
|
|
93
|
+
`{project}.localhost` is the value of `TELA_LOCAL_DOMAIN` (see [Worktrees](#worktrees)), so the URL for the `admin` service above is `http://painel.${TELA_LOCAL_DOMAIN:-service.localhost}`.
|
|
78
94
|
|
|
79
95
|
Only HTTP is routed. Databases keep their published ports.
|
|
80
96
|
|
|
@@ -9,8 +9,13 @@
|
|
|
9
9
|
# service auth-api, project auth_feat-x -> api.auth-feat-x.localhost
|
|
10
10
|
#
|
|
11
11
|
# The `_` in a project name separates the base from a worktree label, set by
|
|
12
|
-
# `mise run tela-proxy:worktree`. A container opts out with traefik.enable=false
|
|
13
|
-
#
|
|
12
|
+
# `mise run tela-proxy:worktree`. A container opts out with traefik.enable=false.
|
|
13
|
+
#
|
|
14
|
+
# A tela-proxy.host label replaces the host. `{project}` in it becomes the
|
|
15
|
+
# project's domain, worktree suffix included:
|
|
16
|
+
#
|
|
17
|
+
# tela-proxy.host: '{project}.localhost', project auth_feat-x -> auth-feat-x.localhost
|
|
18
|
+
# tela-proxy.host: 'app.{project}.localhost', project auth -> app.auth.localhost
|
|
14
19
|
|
|
15
20
|
entryPoints:
|
|
16
21
|
web:
|
|
@@ -23,8 +28,13 @@ providers:
|
|
|
23
28
|
defaultRule: |-
|
|
24
29
|
{{- $project := index .Labels "com.docker.compose.project" -}}
|
|
25
30
|
{{- $service := index .Labels "com.docker.compose.service" -}}
|
|
31
|
+
{{- $override := index .Labels "tela-proxy.host" -}}
|
|
26
32
|
{{- if or (not $project) (not $service) -}}
|
|
27
|
-
|
|
33
|
+
{{- if $override -}}
|
|
34
|
+
Host(`{{ $override }}`)
|
|
35
|
+
{{- else -}}
|
|
36
|
+
Host(`{{ normalize .Name }}.localhost`)
|
|
37
|
+
{{- end -}}
|
|
28
38
|
{{- else -}}
|
|
29
39
|
{{- $parts := splitList "_" $project -}}
|
|
30
40
|
{{- $base := first $parts -}}
|
|
@@ -36,6 +46,9 @@ providers:
|
|
|
36
46
|
{{- else if hasPrefix (printf "%s-" $base) $service -}}
|
|
37
47
|
{{- $host = printf "%s.%s.localhost" (trimPrefix (printf "%s-" $base) $service) $domain -}}
|
|
38
48
|
{{- end -}}
|
|
49
|
+
{{- if $override -}}
|
|
50
|
+
{{- $host = replace "{project}" $domain $override -}}
|
|
51
|
+
{{- end -}}
|
|
39
52
|
Host(`{{ $host }}`)
|
|
40
53
|
{{- end -}}
|
|
41
54
|
|