Hosting instructions

This commit is contained in:
Daniel Krol 2022-07-07 13:58:41 -04:00
parent 55686cb7b5
commit ed8b22363e
3 changed files with 41 additions and 0 deletions

25
hosting/README.md Normal file
View file

@ -0,0 +1,25 @@
These are some simple instructions to get your lbry wallet sync server running. This is mostly a note to self and suggestion to others, but you can host however you want. We use supervisord and the Caddy web server. Ideally we'll probably switch to systemd and we'd include a Caddyfile.
Install the latest version of golang. Check out this repository, and run `go build .` in the repository root.
Insteall the [caddy web server](https://caddyserver.com/). The website has its own debian repos. You can also install from source (golang). Which ever (if either) you feel comfortable with. No specific recommendations here.
You'll need to adjust your firewall to allow http (port 80) for caddy to obtain an SSL cert via ACME (ZeroSSL or LetsEncrypt) and also allow the port you set to have caddy serve on (we use 8091, but it probably also be 80). If you use `ufw`:
```
sudo ufw allow http
sudo ufw allow 8091
```
To avoid running Caddy as root, you'll need to allow it to serve from port 80 ([see here](https://superuser.com/a/892391)):
```
sudo setcap 'cap_net_bind_service=+ep' /home/lbry/caddy/cmd/caddy/caddy
```
Finally, included are a couple quick conf scripts for supervisord to help get lbry.id running. Fill in the `{blank}`s and put under `/etc/supervisor/conf.d/`:
* `{caddy-cmd}`: The command to run caddy. If you're building from source, it will be `{caddy git repo root}/cmd/caddy/caddy`. If you're installing from a debian repo it's probably just `caddy`, but refer to the Caddy docs.
* `{lbry-user}`: The user you're using to run Caddy and the sync server.
* `{lbry-user-home}`: The home directory of `{lbry-user}`.
* `{sync-server-dir}`: The git repo root of the lbry sync server.

8
hosting/caddy.conf Normal file
View file

@ -0,0 +1,8 @@
[program:caddy]
command={caddy-cmd} reverse-proxy --from dev.lbry.id:8091 --to localhost:8090
user={lbry-user}
autostart=true
autorestart=true
stderr_logfile=/var/log/caddy.err.log
stdout_logfile=/var/log/caddy.out.log
environment=HOME={lbry-user-home}

8
hosting/lbry-id.conf Normal file
View file

@ -0,0 +1,8 @@
[program:lbry-id]
directory={sync-server-dir}
command={sync-server-dir}/lbry-id
user={lbry-user}
autostart=true
autorestart=true
stderr_logfile=/var/log/lbry-id.err.log
stdout_logfile=/var/log/lbry-id.out.log