Fediversity/README.md

82 lines
3.8 KiB
Markdown
Raw Normal View History

2024-03-20 01:39:59 +01:00
# Fediverse VMs
2024-02-22 10:56:31 +01:00
2024-05-25 01:02:12 +02:00
This repo is, for now, an attempt to familiarize myself with NixOS options for Fediverse applications, and build up a configuration layer that will set most of the relevant options for you (in a semi-opinionated way) given some high-level configuration. The goal is something in the same vein as [nixos-mailserver](https://gitlab.com/simple-nixos-mailserver/nixos-mailserver) but for fediversity.
2024-02-22 10:56:31 +01:00
Eventually, this will be tailored to high-throughput multi-machine setups. For now, it's just a small set of configurations to run in VMs.
2024-03-06 10:40:22 +01:00
2024-03-20 01:39:59 +01:00
## Running the VMs
2024-03-06 10:40:22 +01:00
2024-03-20 01:39:59 +01:00
you can build a VM using
2024-03-20 00:43:20 +01:00
```bash
2024-03-20 01:39:59 +01:00
nixos-rebuild build-vm --flake .#<vm_name>
2024-03-20 00:43:20 +01:00
```
2024-03-20 01:39:59 +01:00
where `<vm_name>` is one of `mastodon`, `peertube`, `pixelfed`, or `all`
2024-03-20 00:43:20 +01:00
2024-03-20 01:39:59 +01:00
and then run it with
2024-03-20 00:43:20 +01:00
```bash
2024-03-20 01:39:59 +01:00
./result/bin/run-nixos-vm
2024-03-20 00:43:20 +01:00
```
2024-05-25 01:02:12 +02:00
After the machine boots, you should be dropped into a root shell.
Note that state will be persisted in the `nixos.cqow2` file. Delete that and restart the VM to reset the state.
With the VM running, you can then access the apps on your local machine's web browser (using the magic of port forwarding) at the following addresses
NOTE: it sometimes takes a while for the services to start up, and in the meantime you will get 502 Bad Gateway.
2024-03-20 00:43:20 +01:00
2024-03-20 10:23:57 +01:00
- Mastodon: <http://mastodon.localhost:55001>
2024-05-25 01:02:12 +02:00
- You can also create accounts on the machine itself by running `mastodon-tootctl accounts create test --email test@test.com --confirmed --approve`
2024-03-20 00:43:20 +01:00
2024-03-20 01:39:59 +01:00
- PeerTube: <http://peertube.localhost:9000>
- The root account can be accessed with username "root". The password can be obtained by running the following command on the VM:
```bash
journalctl -u peertube | perl -ne '/password: (.*)/ && print $1'
```
- Creating other accounts has to be enabled via the admin interface. `Administration > Configuration > Basic > Enable Signup` or just add an account directly from `Administration > Create user`. But functionality can also be tested from the root account.
2024-03-20 00:43:20 +01:00
2024-05-25 01:02:12 +02:00
- Pixelfed: <http://pixelfed.localhost:8000>
- Account creation via the web interface won't work until we figure out email
- For now, they can be created on the VM command line
```bash
pixelfed-manage user:create --name=test --username=test --email=test@test.com --password=testtest --confirm_email=1
```
2024-03-20 01:39:59 +01:00
## debugging notes
2024-03-20 00:43:20 +01:00
2024-03-20 01:39:59 +01:00
- it is sometimes useful to `cat result/bin/run-nixos-vm` to see what's really going on (e.g. which ports are getting forwarded)
- relevant systemd services:
- mastodon-web.service
- peertube.service
2024-05-25 01:02:12 +02:00
- the `garage` CLI command gives information about garage storage, but cannot be used to actually inspect the contents. use `mc` (minio) for that
# questions
- what is meant to be shared between instances?
- this is relevant to the security model. If garage is being shared between instances, we have to be careful having configurations depend on each other.
2024-05-25 01:02:12 +02:00
- they are to be shared, BUT the user will have no direct control over configuration.
2024-04-03 14:40:19 +02:00
2024-02-22 10:56:31 +01:00
# resources
- Tutorial for setting up better logging: https://krisztianfekete.org/self-hosting-mastodon-on-nixos-a-proof-of-concept/
2024-05-25 01:02:12 +02:00
- Setting up mastodon development environment: https://docs.joinmastodon.org/dev/setup/
2024-03-20 00:43:20 +01:00
- Tutorial for PeerTube that doesn't use `createLocally`: https://nixos.wiki/wiki/PeerTube
2024-04-03 14:40:19 +02:00
- garage settings for specific apps: https://garagehq.deuxfleurs.fr/documentation/connect/apps/
2024-05-25 01:02:12 +02:00
- pixelfed has terrible / mostly non-existent documentation)
- for when we start worry about scaling up: https://docs.joinmastodon.org/admin/scaling/
# notes
When mastodon is running in production mode, we have a few problems:
- you have to click "accept the security risk"
- it takes a while for the webpage to come online. Until then you see "502 Bad Gateway"
- email sent from the mastodon instance (e.g. for account confirmation) should be accessible at <https://mastodon.localhost:55001/letter_opener>, but it's not working.