@openmeet/snowglobe 0.3.0 → 0.5.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 +36 -38
- package/bin/snowglobe.mjs +1 -1
- package/lib/certs.mjs +12 -9
- package/lib/commands/account.mjs +5 -7
- package/lib/commands/down.mjs +11 -2
- package/lib/commands/ls.mjs +18 -4
- package/lib/commands/run.mjs +17 -46
- package/lib/commands/up.mjs +57 -33
- package/lib/config.mjs +25 -10
- package/lib/env.mjs +39 -27
- package/lib/render.mjs +13 -9
- package/lib/router.mjs +214 -0
- package/lib/up.mjs +14 -1
- package/package.json +3 -3
- package/snowglobe.default.yml +9 -10
- package/stack/docker-compose.test.yml +2 -1
- package/stack/docker-compose.yml +17 -9
- package/stack/https/app-names.cjs +6 -5
- package/stack/jetstream/Dockerfile +12 -0
- package/stack/page/snowglobe.conf +1 -1
- package/lib/hosts.mjs +0 -36
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
// Preloaded into each PDS (NODE_OPTIONS=--require, in the globe bin/snowglobe.mjs render writes), so a PDS can
|
|
2
|
-
// reach an app at https://<name>.app.<domain
|
|
3
|
-
//
|
|
2
|
+
// reach an OAuth client under the globe's domain, an app at https://<name>.app.<domain> or
|
|
3
|
+
// PDSls at https://pdsls.<domain>: it fetches the client's metadata and keys from there.
|
|
4
|
+
// Docker's DNS has no wildcard names, so every such name is
|
|
4
5
|
// looked up as nginx instead, which routes it by name (stack/https/nginx.conf.template). Only
|
|
5
6
|
// the address lookup changes: the request still carries the app's name, and TLS still
|
|
6
7
|
// checks the certificate for it against the snowglobe CA. Every other name resolves as usual.
|
|
7
8
|
//
|
|
8
|
-
// SG_RESOLVE_DOMAIN sets the domain whose names, itself included, go to nginx. Each PDS
|
|
9
|
-
//
|
|
10
|
-
// not know.
|
|
9
|
+
// SG_RESOLVE_DOMAIN sets the domain whose names, itself included, go to nginx. Each PDS and
|
|
10
|
+
// each group host sets it to the globe's domain; a group host also resolves its members'
|
|
11
|
+
// handles there, which Docker's DNS does not know.
|
|
11
12
|
'use strict';
|
|
12
13
|
const dns = require('dns');
|
|
13
14
|
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
# Jetstream (github.com/bluesky-social/jetstream), the firehose as JSON for apps. It serves v2,
|
|
2
|
+
# /xrpc/network.bsky.jetstream.subscribeEvents, which contrail and @bsky/jetstream read, and the
|
|
3
|
+
# older /subscribe, which Slingshot, PDSls and the network page read.
|
|
4
|
+
# To move to another Jetstream, change the second FROM line. snowglobe up builds the new image,
|
|
5
|
+
# since the image's tag is a hash of this file.
|
|
6
|
+
# The image has no shell, so busybox comes along for the health check. It runs as root so it can
|
|
7
|
+
# write the jetstream-data volume, which Docker makes root's.
|
|
8
|
+
FROM busybox:1.37.0-musl@sha256:f6a95d611e0a8780fabdb2aec43e31275b2720dfefa3e41b16835bfc42454478 AS tools
|
|
9
|
+
|
|
10
|
+
FROM ghcr.io/bluesky-social/jetstream:v0.4.6@sha256:38e927566ed2aca19ffd2e9f3c440db74ffb404000aaf493b215dfefc6c7e54c
|
|
11
|
+
COPY --from=tools /bin/busybox /busybox
|
|
12
|
+
USER 0:0
|
|
@@ -37,7 +37,7 @@ location = /health/relay { proxy_pass $relay/xrpc/_health; }
|
|
|
37
37
|
location = /health/jetstream { proxy_pass $jetstream/; }
|
|
38
38
|
location = /health/slingshot { proxy_pass $slingshot/; }
|
|
39
39
|
location = /health/sync { proxy_pass $tap/health; }
|
|
40
|
-
location = /health/mail { proxy_pass $maildev/healthz; }
|
|
40
|
+
location = /health/mail { proxy_pass $maildev/api/healthz; }
|
|
41
41
|
location = /health/pdsls { proxy_pass $pdsls/_health; }
|
|
42
42
|
|
|
43
43
|
# Health and accounts for each account server (/health/<name>, /people/<name>/listRepos and
|
package/lib/hosts.mjs
DELETED
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
// The names snowglobe run maps to nginx, and the hosts file it binds over /etc/hosts. Pure:
|
|
2
|
-
// lib/commands/run.mjs reads the files and runs the command.
|
|
3
|
-
|
|
4
|
-
const NAME_RE = /^[A-Za-z0-9.-]+$/;
|
|
5
|
-
const words = (text) => (text ?? '').split(/\s+/).filter(Boolean);
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* Every name a process under run should reach nginx at: the rendered globe's leaf names that are
|
|
9
|
-
* not wildcards (its page, each PDS, its services, plc.directory), each handle in `handles`
|
|
10
|
-
* (data/https/names), <name>.app.<domain> for each app in `apps`, and `extra`
|
|
11
|
-
* (HTTPS_RUN_EXTRA_NAMES, space-separated). In that order, each once.
|
|
12
|
-
*/
|
|
13
|
-
export function runNames({ leafNames, handles, apps, domain, extra }) {
|
|
14
|
-
return [
|
|
15
|
-
...new Set([
|
|
16
|
-
...words(leafNames).filter((n) => !n.startsWith('*')),
|
|
17
|
-
// One per line; a line that is not a name is skipped whole.
|
|
18
|
-
...(handles ?? '').split('\n').filter((n) => NAME_RE.test(n)),
|
|
19
|
-
...apps.map((a) => `${a.name}.app.${domain}`),
|
|
20
|
-
...words(extra),
|
|
21
|
-
]),
|
|
22
|
-
];
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
/**
|
|
26
|
-
* The hosts file: `etcHosts` (the machine's) without any line naming one of `names`, then each
|
|
27
|
-
* name on `bind`.
|
|
28
|
-
*/
|
|
29
|
-
export function hostsFile(etcHosts, names, bind) {
|
|
30
|
-
const ours = new Set(names);
|
|
31
|
-
const kept = etcHosts
|
|
32
|
-
.split('\n')
|
|
33
|
-
.filter((l, i, all) => i < all.length - 1 || l !== '')
|
|
34
|
-
.filter((l) => !l.trim().split(/\s+/).slice(1).some((n) => ours.has(n)));
|
|
35
|
-
return [...kept, '# snowglobe (bin/snowglobe.mjs run)', ...names.map((n) => `${bind} ${n}`), ''].join('\n');
|
|
36
|
-
}
|