Simplify hosting details

I sort of did it wrong anyway. Just tell them to use systemd and caddy. If they demand specifics we can supply it later.
This commit is contained in:
Daniel Krol 2022-08-22 17:34:44 -04:00
parent 4843b91ce7
commit 0c22de5186
4 changed files with 16 additions and 55 deletions

View file

@ -1,13 +1,23 @@
# Running
This software is in the pre-testing phase as of now.
# Getting The Binary
## Prebuilt
Get the latest [release](https://github.com/lbryio/wallet-sync-server/releases).
## Building
Install Golang, at least version 1.17. (Please report any dependencies we seemed to have forgotten)
Check out the repo and run:
```
go run .
go build .
```
The binary should show up as `wallet-sync-server`.
# Account Creation Settings
When running the server, we should set some environmental variables. These environmental variables determine how account creation is handled. If we do not set these, no users will be able to create an account.
@ -70,17 +80,10 @@ You'll get this in your Mailgun dashboard.
Whether your sending domain is in the EU. This is related to GDPR stuff I think. Valid values are `true` or `false`, defaulting to `false`.
# You could make a script
# Deployment
For now you could store the stuff in a script:
A setup that works is [Caddy server](https://caddyserver.com) and Systemd.
```
#!/usr/bin/bash
Make sure Caddy is set to port 443, because the LBRY clients will expect that.
export ACCOUNT_WHITELIST="my-email@example.com"
go run .
```
**NOTE**: If you're using Mailgun, set the file permissions on this script such that only the administrator can read it, since it will contain the Mailgun private API key
_Side note: Eventually we'll create systemd configurations, at which point we will be able to put the env vars in an `EnvironmentFile` instead of a script like this._
If you're using Mailgun, take care to keep the environmental vars secure. [See here](https://serverfault.com/questions/413397/how-to-set-environment-variable-in-systemd-service/910655#910655) for how to do this with systemd.

View file

@ -1,25 +0,0 @@
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 https (port 443) to have caddy serve our wallet sync server. If you use `ufw`:
```
sudo ufw allow http
sudo ufw allow https
```
To avoid running Caddy as root, you'll need to allow it to serve from ports 80 and 443 ([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.

View file

@ -1,8 +0,0 @@
[program:caddy]
command={caddy-cmd} reverse-proxy --from dev.lbry.id:443 --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}

View file

@ -1,9 +0,0 @@
[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
environment=ACCOUNT_VERIFICATION_MODE=AllowAll # ONLY FOR DEV ENVIRONMENTS