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