@zigordev/stack 1.2.0 → 1.2.1
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 -17
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -138,16 +138,16 @@ 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
|
-
| Grafana and the mail catcher | `lgtm` and `mailpit` | Grafana Cloud and Amazon SES
|
|
149
|
-
| The ingress's own pages | At `traefik.localhost` | Off
|
|
150
|
-
| 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`
|
|
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
|
+
| Grafana and the mail catcher | `lgtm` and `mailpit` | Grafana Cloud and Amazon SES |
|
|
149
|
+
| The ingress's own pages | At `traefik.localhost` | Off |
|
|
150
|
+
| 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
151
|
|
|
152
152
|
## How to use it, with one worked example
|
|
153
153
|
|
|
@@ -168,22 +168,22 @@ pnpm local:reset
|
|
|
168
168
|
| `http://traefik.localhost` | Traefik's own pages: the routes it knows, and why one is missing |
|
|
169
169
|
| `http://alloy.localhost` | Alloy's own pages: each part of its config, and whether it is healthy |
|
|
170
170
|
|
|
171
|
-
The worked example is an app named `
|
|
171
|
+
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
172
|
|
|
173
173
|
```yaml
|
|
174
174
|
services:
|
|
175
|
-
|
|
176
|
-
image: ghcr.io/zigordev/
|
|
175
|
+
playground-api:
|
|
176
|
+
image: ghcr.io/zigordev/playground-api:1f3a9c2
|
|
177
177
|
environment:
|
|
178
178
|
PORT: "3000"
|
|
179
|
-
OTEL_SERVICE_NAME:
|
|
179
|
+
OTEL_SERVICE_NAME: playground-api
|
|
180
180
|
OTEL_EXPORTER_OTLP_ENDPOINT: http://alloy:4318
|
|
181
181
|
healthcheck:
|
|
182
182
|
test: [CMD, node, healthcheck.js]
|
|
183
183
|
labels:
|
|
184
184
|
traefik.enable: "true"
|
|
185
|
-
traefik.http.routers.
|
|
186
|
-
traefik.http.services.
|
|
185
|
+
traefik.http.routers.playground-api.rule: Host(`playground.localhost`) && PathPrefix(`/api`)
|
|
186
|
+
traefik.http.services.playground-api.loadbalancer.server.port: "3000"
|
|
187
187
|
networks: [zigordev]
|
|
188
188
|
|
|
189
189
|
networks:
|
|
@@ -191,7 +191,7 @@ networks:
|
|
|
191
191
|
external: true
|
|
192
192
|
```
|
|
193
193
|
|
|
194
|
-
With the shared services running, `http://
|
|
194
|
+
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
195
|
|
|
196
196
|
### From another repo
|
|
197
197
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zigordev/stack",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.1",
|
|
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",
|