@zigordev/stack 1.2.0 → 1.2.2
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 +18 -17
- package/compose.yaml +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -138,16 +138,17 @@ Traefik warns once at each start that it "can reject some encoded characters in
|
|
|
138
138
|
|
|
139
139
|
The host starts `compose.yaml` with `compose.production.yaml`, through the deploy path of platform: every merge to `main` deploys them as the target `platform`. `docs/cloud-first-deploy.md` in platform says how.
|
|
140
140
|
|
|
141
|
-
| Thing | On the laptop | In production
|
|
142
|
-
| -------------------------------------- | -------------------------------------------------------------------- |
|
|
143
|
-
| The three shared services | From `compose.yaml` | The same file
|
|
144
|
-
| How a request arrives | Port 80 on the laptop itself, over IPv4 and IPv6 | Through Cloudflare's tunnel. `cloudflared`, its connector, runs in production only and hands each request to the ingress
|
|
145
|
-
| How an app outside a container reports | To `127.0.0.1:4318`, the agent's port published on the laptop itself | Every app runs in a container, so the port is not published
|
|
146
|
-
| Where the agent sends | To `lgtm`, with a made-up name and password that nothing checks | To Grafana Cloud, with the secrets that `.env.production.example` names
|
|
147
|
-
| Each container's memory | No file, so the agent reads none | The host's file `/var/lib/platform/metrics/containers.prom`, which a timer writes every minute
|
|
148
|
-
|
|
|
149
|
-
|
|
|
150
|
-
| The
|
|
141
|
+
| Thing | On the laptop | In production |
|
|
142
|
+
| -------------------------------------- | -------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
143
|
+
| The three shared services | From `compose.yaml` | The same file |
|
|
144
|
+
| How a request arrives | Port 80 on the laptop itself, over IPv4 and IPv6 | Through Cloudflare's tunnel. `cloudflared`, its connector, runs in production only and hands each request to the ingress |
|
|
145
|
+
| How an app outside a container reports | To `127.0.0.1:4318`, the agent's port published on the laptop itself | Every app runs in a container, so the port is not published |
|
|
146
|
+
| Where the agent sends | To `lgtm`, with a made-up name and password that nothing checks | To Grafana Cloud, with the secrets that `.env.production.example` names. Traces and metrics go to `${GRAFANA_OTLP_URL}/otlp`, and logs to `${GRAFANA_LOKI_URL}/loki/api/v1/push`, because the stored addresses carry no path |
|
|
147
|
+
| Each container's memory | No file, so the agent reads none | The host's file `/var/lib/platform/metrics/containers.prom`, which a timer writes every minute |
|
|
148
|
+
| The backups' results | No file, so the agent reads none | The host's files `/var/lib/platform/metrics/backup-dump.prom` and `backup-restore-test.prom`, which the backup script writes after each run |
|
|
149
|
+
| Grafana and the mail catcher | `lgtm` and `mailpit` | Grafana Cloud and Amazon SES |
|
|
150
|
+
| The ingress's own pages | At `traefik.localhost` | Off |
|
|
151
|
+
| The proxy's group | 0, which owns the socket on Docker Desktop | The group that owns the socket on the host, which the deploy passes as `DOCKER_SOCKET_GROUP` |
|
|
151
152
|
|
|
152
153
|
## How to use it, with one worked example
|
|
153
154
|
|
|
@@ -168,22 +169,22 @@ pnpm local:reset
|
|
|
168
169
|
| `http://traefik.localhost` | Traefik's own pages: the routes it knows, and why one is missing |
|
|
169
170
|
| `http://alloy.localhost` | Alloy's own pages: each part of its config, and whether it is healthy |
|
|
170
171
|
|
|
171
|
-
The worked example is an app named `
|
|
172
|
+
The worked example is an app named `playground-api`, of a product named `playground`. This is everything its compose file needs for the platform to serve it:
|
|
172
173
|
|
|
173
174
|
```yaml
|
|
174
175
|
services:
|
|
175
|
-
|
|
176
|
-
image: ghcr.io/zigordev/
|
|
176
|
+
playground-api:
|
|
177
|
+
image: ghcr.io/zigordev/playground-api:1f3a9c2
|
|
177
178
|
environment:
|
|
178
179
|
PORT: "3000"
|
|
179
|
-
OTEL_SERVICE_NAME:
|
|
180
|
+
OTEL_SERVICE_NAME: playground-api
|
|
180
181
|
OTEL_EXPORTER_OTLP_ENDPOINT: http://alloy:4318
|
|
181
182
|
healthcheck:
|
|
182
183
|
test: [CMD, node, healthcheck.js]
|
|
183
184
|
labels:
|
|
184
185
|
traefik.enable: "true"
|
|
185
|
-
traefik.http.routers.
|
|
186
|
-
traefik.http.services.
|
|
186
|
+
traefik.http.routers.playground-api.rule: Host(`playground.localhost`) && PathPrefix(`/api`)
|
|
187
|
+
traefik.http.services.playground-api.loadbalancer.server.port: "3000"
|
|
187
188
|
networks: [zigordev]
|
|
188
189
|
|
|
189
190
|
networks:
|
|
@@ -191,7 +192,7 @@ networks:
|
|
|
191
192
|
external: true
|
|
192
193
|
```
|
|
193
194
|
|
|
194
|
-
With the shared services running, `http://
|
|
195
|
+
With the shared services running, `http://playground.localhost/api/…` reaches the app as soon as its health check passes. Its log lines show in Grafana under `playground-api`, and so do its traces and metrics.
|
|
195
196
|
|
|
196
197
|
### From another repo
|
|
197
198
|
|
package/compose.yaml
CHANGED
|
@@ -214,7 +214,7 @@ services:
|
|
|
214
214
|
|
|
215
215
|
rule {
|
|
216
216
|
source_labels = ["__name__", "mode", "fstype"]
|
|
217
|
-
regex = "alloy_build_info;;|node_cpu_seconds_total;idle;|node_memory_(MemTotal|MemAvailable)_bytes;;|node_filesystem_(size|avail)_bytes;;(ext4|xfs)|container_(memory_working_set|spec_memory_limit)_bytes;;"
|
|
217
|
+
regex = "alloy_build_info;;|node_cpu_seconds_total;idle;|node_memory_(MemTotal|MemAvailable)_bytes;;|node_filesystem_(size|avail)_bytes;;(ext4|xfs)|container_(memory_working_set|spec_memory_limit)_bytes;;|platform_backup_(last_success_timestamp_seconds|size_bytes);;|platform_restore_test_(last_success_timestamp_seconds|tables);;"
|
|
218
218
|
action = "keep"
|
|
219
219
|
}
|
|
220
220
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zigordev/stack",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.2",
|
|
4
4
|
"description": "The shared services of the zigordev platform for a laptop: the ingress, the telemetry agent, a local Grafana and a mail catcher, as compose files with one command that starts them",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"type": "module",
|