]> Untitled Git - awful.systems.git/blob - README.md
docs: add database information
[awful.systems.git] / README.md
1 # awful.systems infrastructure flake
2
3 This is the Nix flake that deploys the awful.systems server infrastructure. It
4 provides a set of files and commands that allow you to deploy the full set of
5 awful.systems software and configuration for each host to anything running NixOS
6 (though the provided commands default to the static IPs of the current
7 awful.systems machines).
8
9 ## Requirements
10
11 To use this flake, you'll want a [Nix evaluator](https://nixos.org/download) --
12 that is, you'll want the Nix package manager (either on NixOS or in an
13 environment where it's installed). This is a
14 [dependency-free](https://www.haskellforall.com/2023/01/announcing-nixos-rebuild-new-deployment.html)
15 stateless deployment mechanism, so this git repo and an authorized ssh key are
16 all you need to deploy the whole stack.
17
18 This flake builds everything locally for speed and then uploads it, so you'll
19 want a fair bit of available disk space (20GB is safe) and the ability to upload
20 a lot of data.
21
22 *If you're not on x86_64-linux or you're limited on disk or upload*: you should
23 use the deployment hosts to build. First, use `df -h` to make sure they've got
24 enough disk space, then use the deployment command with the argument
25 `--build-host root@<hostname>`, where `<hostname>` is the full domain name of
26 the host you want to deploy to.
27
28 ## Optional Dependencies
29
30 [nix-direnv](https://github.com/nix-community/nix-direnv) is convenient, since
31 it'll make all of the awful.systems commands available in your shell with no
32 other setup, and I use that to cache some larger dependencies as well.
33
34 ## Hosts
35 ### `more.awful.systems`
36 - Hosts the production Lemmy server at https://awful.systems (`lemmy-prod`).
37 - Proxies https://awful.systems/git and https://awful.systems/archives to
38   `these.awful.systems`.
39 - Assumes it's running being a load balancer that terminates SSL, so it doesn't
40   handle anything related to HTTPS itself.
41
42 ### `these.awful.systems`
43 - Hosts the development Lemmy server at https://making.awful.systems (`lemmy-dev`).
44 - Hosts the r/SneerClub archive (`sneer-archive`).
45 - Stores git repos in `/home/git/repos`.
46 - Hosts `gitweb`.
47 - Runs a git daemon for pull-only access to the git repos.
48
49 ## Commands
50
51 If you have `nix-direnv`, these commands will be available in your shell after
52 it finishes a build. Otherwise, run `nix develop` to kick off a build, and the
53 resulting shell will have all of these commands available.
54
55 Deployment hosts are very thin and don't have a lot of commands available, so
56 use `nix run nixpkgs#<command>` in an SSH session where `<command>` is the
57 command you'd like to run in order to have Nix pull in and run a command line
58 program.
59
60 - `deploy-these`: Kick off a deployment to the host `these`. Any arguments are
61   passed to `nixos-rebuild`.
62 - `deploy-more`: Same as above for `more`.
63 - `go-these`: Use your SSH key to log into `these` as `root`. Any arguments are
64   treated as commands for SSH to run; IE `go-these df -h` will run `df -h` on
65   `these`, display its output, and exit.
66 - `go-more`: Same as above for `more`.
67 - `rekey-secrets`: With a file argument, tells `sops` to re-encrypt the secrets
68   in that file with the currently configured encryption keys. Will definitely
69   need to be run by someone who previously has access to the secrets in order to
70   succeed.
71
72 ## Services
73
74 These can be administrated via `systemctl` and monitored via `journalctl` or
75 your chosen log monitoring software.
76
77 - `lemmy-prod`: The production Lemmy server.
78 - `lemmy-ui-prod`: The Web frontend to the production Lemmy server.
79 - `lemmy-dev`: The development Lemmy server.
80 - `lemmy-ui-dev`: The Web frontend to the development Lemmy server.
81
82 ## Databases
83
84 - For development, the database user is `lemmy_dev` and the Postgres database is
85   `lemmy_dev` on `these.awful.systems`. Use `sudo -u lemmy_dev psql` on that
86   host to access the database. 
87 - For production, the database user is `lemmy` and the Postgres database is
88   `lemmy` on `more.awful.systems`. Use `sudo -u lemmy_dev psql` on that host to
89   access the database.