r/o
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
* `nix build .#packages.x86_64-linux.nossa-docker-jmsingle` uses some
63
special support for building x86_64 Linux Docker images on aarch64
64
Darwin hosts, which (without modification) would normally trap due to
65
attempted double-mapping of JIT. It forces the equivalent of
66
[`+JMsingle true`][JMsingle] by [patching][JMsingle-patch] the Erlang used
67
for nóssa and all dependencies.
68
69
There's a NixOS module included, which can be used to deploy nóssa with a few
70
lines of configuration. To do this, add the input to your own `flake.nix`:
71
72
```nix
73
nossa = {
74
url = "git+https://nossa.ee/~talya/nossa";
75
# Add as desired:
76
# inputs.nixpkgs.follows = "nixpkgs";
77
# inputs.flake-utils.follows = "flake-utils";
78
# inputs.rust-overlay.follows = "rust-overlay";
79
};
80
```
81
82
Then include the `nossa.nixosModules.${system}.nossa` module. You can now
83
configure a nóssa installation per [`nix/module.nix`](nix/module.nix):
84
85
```nix
86
services.nossa = {
87
enable = true;
88
port = 8000; # for your reverse proxy.
89
metricsPort = 8001; # prometheus-style metrics.
90
host = "your-nossa.ee"; # hostname nóssa runs on.
91
secretKeyBaseFile = somePath; # secret key base for Phoenix.
92
erlangCookieFile = anotherPath; # cookie for Erlang.
93
maxBodyLength = 1000000000; # max push size via HTTP.
94
};
95
```
96
97
nóssa avoids running its own [epmd], so you will want to be running your own:
98
99
```nix
100
services.epmd.enable = true;
101
```
102
103
If you want to be able to connect to your running nóssa service, add the binary
104
to your system path:
105
106
```nix
107
environment.systemPackages = [config.services.nossa.package];
108
```
109
110
Note that you'll need to specify the path to the cookie in the environment to
111
connect successfully. For example:
112
113
```console
114
$ RELEASE_COOKIE="$(cat /run/secrets/erlang-cookie)" nossa remote
115
```
116
117
See the [Distributed Erlang — Security][security] section of the Erlang
118
documentation for more details sobre o biscoito mágico.
119
120
There's also a deprecated module included to deploy it into a NixOS-managed k3s
121
environment, but I'll probably replace this with an actual Helm chart.
122
123
[JMsingle]: https://www.erlang.org/doc/apps/erts/erl_cmd.html#+JMsingle
124
[JMsingle-patch]: nix/erlang_beam_jit_main.cpp.patch
125
[epmd]: https://www.erlang.org/docs/28/apps/erts/epmd_cmd
126
[security]: https://www.erlang.org/docs/28/system/distributed.html#security
127