Add e2e script to the repo, Dockerfile, and a Nix flake with a NixOS module
- scripts/e2e.sh (+ scripts/e2e/*.ts): the two-node end-to-end test, now self-contained and cleaning up after itself; `make e2e`, part of `make check` - Dockerfile/.dockerignore: static Go build in a non-root alpine image, data in /data, defaults to region u1j; `make docker` - flake.nix, nix/: package (buildGoModule), dev shell, NixOS module services.allmende (hardened systemd unit that waits for `allmende-admin init`), and a NixOS VM test run by `nix flake check` - README: running a node with Docker and NixOS Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -30,4 +30,48 @@ listings can be edited, renewed (30 days, manually) or deleted there.
|
||||
A second node on the same network finds this one automatically (mDNS); across
|
||||
networks, pass `--bootstrap /ip4/<addr>/tcp/<port>/p2p/<peer id>`.
|
||||
|
||||
## Running a node for real
|
||||
|
||||
A node needs to stay up to receive messages and keep your listings alive. Make
|
||||
targets: `make build run test check e2e docker` (`make help` lists them).
|
||||
|
||||
**Docker**
|
||||
|
||||
```
|
||||
docker build -t allmende . # or: make docker
|
||||
docker run --rm -it -v allmende-data:/data allmende init # once; write down the phrase
|
||||
docker run -d --name allmende -v allmende-data:/data \
|
||||
-p 127.0.0.1:8080:8080 -p 4001:4001 allmende # Bonn (u1j) by default
|
||||
docker logs allmende | grep -A1 'Owner login' # the sign-in link
|
||||
```
|
||||
|
||||
The image runs as a non-root user and keeps its data in the `/data` volume.
|
||||
To change regions or add peers, replace the command (see the end of the
|
||||
`Dockerfile`). Publish port 8080 on `127.0.0.1` only: it also serves the owner
|
||||
API. For public use put a TLS reverse proxy in front.
|
||||
|
||||
**NixOS** (flake)
|
||||
|
||||
```nix
|
||||
{
|
||||
inputs.allmende.url = "git+ssh://git@git.stinnesbeck.com:2222/nils/allmende.git";
|
||||
outputs = { nixpkgs, allmende, ... }: {
|
||||
nixosConfigurations.myhost = nixpkgs.lib.nixosSystem {
|
||||
modules = [
|
||||
allmende.nixosModules.default
|
||||
{ services.allmende = { enable = true; regions = [ "u1j" ]; openFirewall = true; }; }
|
||||
];
|
||||
};
|
||||
};
|
||||
}
|
||||
```
|
||||
|
||||
After `nixos-rebuild switch`, do the one-time setup (it shows the recovery
|
||||
phrase, so it is not part of the service): `sudo allmende-admin init && sudo
|
||||
systemctl start allmende`. The sign-in link is in `journalctl -u allmende`.
|
||||
Without NixOS, from a checkout: `nix run . -- run --region u1j`, or
|
||||
`nix develop` for a shell with Go, Node.js and the other tools `make check`
|
||||
needs. `nix flake check` builds the package and boots a NixOS VM that tests the
|
||||
module. After changing `go.mod`, update `vendorHash` in `nix/package.nix`.
|
||||
|
||||
Licensed under the [GNU AGPL-3.0](LICENSE): free for everyone, and it stays free.
|
||||
|
||||
Reference in New Issue
Block a user