1
# nóssa
2
3
Phoenix/LiveView app hosting the [website][nossa] you're looking at.
4
5
I wanted to host my software on my own turf, in my own way. This is the
6
result. I'm hoping to add some nice interop to make collaboration easier;
7
particularly things like [ForgeFed] and [Friendly Forge Format (F3)][f3].
8
9
[nossa]: https://nossa.ee
10
[ForgeFed]: https://forgefed.org/
11
[f3]: https://f3.forgefriends.org/
12
13
14
## recursos / features
15
16
* [git2-rs]-based repository access for web views.
17
* [git-http-backend] interface supporting smart transport/v2.
18
* LiveView frontend, with full support for non-JavaScript clients.
19
* Extensive test coverage.
20
21
See [`TAREAS.md`](TAREAS.md) for a list of things yet to be done!
22
23
[git2-rs]: https://github.com/rust-lang/git2-rs
24
[git-http-backend]: https://git-scm.com/docs/git-http-backend
25
26
27
## desenvolvimento / development
28
29
The development and build process assumes you are able to use Nix flakes[^flakes].
30
31
Use `nix develop` to enter a dev shell. The first time you're getting set up
32
you'll want to do a `mix deps.get`; we use Mix normally in dev, and then use
33
[Mix2nix] to make them reproducible for production builds.
34
35
Then:
36
37
* `make pg` --- starts Postgres with a database stored in `./db`.
38
* `make server` --- runs the Phoenix server in IEx.
39
* `make testwatch` --- runs `mix test` every time a relevant file changes.
40
* `make coverwatch` --- runs `mix test --cover` every time a relevant file changes.
41
42
The last two also can take `ARGS=...`.
43
44
[^flakes]: I am so sorry but I can't find a single good link that would actually
45
just take you through using them. It's true what they say about Nix people.
46
Try the [Nix flakes][z2n-flakes] page from Zero to Nix. It doesn't really
47
get any better than that.
48
49
[mix2nix]: https://github.com/ydlr/mix2nix
50
[z2n-flakes]: https://zero-to-nix.com/concepts/flakes/
51
52
53
## construindo para produção / building for prod
54
55
* `nix build` will produce a Mix release in `result`.
56
* `nix build .#nossa-docker` will create a Docker image which can be run
57
directly, or as part of an orchestration setup.
58
* There's special support for building x86_64 Linux Docker images on arm64 hosts
59
(XXX: reintegrate this :)).
60
61
There's a NixOS module included, which can be used to deploy nóssa with a few
62
lines of configuration. To do this, add the input to your own `flake.nix`:
63
64
```nix
65
nossa = {
66
url = "git+https://nossa.ee/~talya/nossa";
67
# Add as desired:
68
# inputs.nixpkgs.follows = "nixpkgs";
69
# inputs.flake-utils.follows = "flake-utils";
70
# inputs.rust-overlay.follows = "rust-overlay";
71
};
72
```
73
74
Then include the `nossa.nixosModules.${system}.nossa` module. You can now
75
configure a nóssa installation per [`nix/module.nix`](nix/module.nix):
76
77
```nix
78
services.nossa = {
79
enable = true;
80
port = 8000; # for your reverse proxy.
81
metricsPort = 8001; # prometheus-style metrics.
82
host = "your-nossa.ee"; # hostname nóssa runs on.
83
secretKeyBaseFile = somePath; # secret key base for Phoenix.
84
erlangCookieFile = anotherPath; # cookie for Erlang.
85
maxBodyLength = 1000000000; # max push size via HTTP.
86
};
87
```
88
89
nóssa avoids running its own [epmd], so you will want to be running your own:
90
91
```nix
92
services.epmd.enable = true;
93
```
94
95
If you want to be able to connect to your running nóssa service, add the binary
96
to your system path:
97
98
```nix
99
environment.systemPackages = [config.services.nossa.package];
100
```
101
102
Note that you'll need to specify the path to the cookie in the environment to
103
connect successfully. For example:
104
105
```console
106
$ RELEASE_COOKIE="$(cat /run/secrets/erlang-cookie)" nossa remote
107
```
108
109
See the [Distributed Erlang — Security][security] section of the Erlang
110
documentation for more details sobre o biscoito mágico.
111
112
There's also a deprecated module included to deploy it into a NixOS-managed k3s
113
environment, but I'll probably replace this with an actual Helm chart.
114
115
[epmd]: https://www.erlang.org/docs/28/apps/erts/epmd_cmd
116
[security]: https://www.erlang.org/docs/28/system/distributed.html#security
117