From 0d4b9c979f37f0d9993d2e42ca9ade46a494fc0a Mon Sep 17 00:00:00 2001 From: Urban Guacamole Date: Fri, 3 Dec 2021 12:29:54 +0100 Subject: [PATCH] Update documentation --- README.md | 6 ++++-- server-setup.md | 51 +++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 55 insertions(+), 2 deletions(-) create mode 100644 server-setup.md diff --git a/README.md b/README.md index 38743df..4f7b8fd 100644 --- a/README.md +++ b/README.md @@ -11,13 +11,15 @@ Maybe, open an issue. Be sure to demonstrate an effort that you tried to solve t # Setup Here's what the setup looks like rn: -- VPS, Debian Buster, 4 GB RAM +- VPS, Debian Bullseye, 8 GB RAM - user with username nextgen on the server - my laptop w/ Linux - Go toolchain installed - - node v10.15 & npm + - node & npm - Python 3 (required only for index-generator/fix-metajson.py) +Read the server-setup.md file for more precise info. + The programs create their own tables in the DB that they need. Database name is "nextgen". You need to create the materialized views (fresh and search). You can find some useful SQL code in snippets.sql. Each of the daemons (api, crawl-rss, seedleech-daemon) is its own standalone Go package and resulting binary. You have to compile the binaries yourself. There are systemd .service files available for each of the daemons. diff --git a/server-setup.md b/server-setup.md new file mode 100644 index 0000000..9a3d766 --- /dev/null +++ b/server-setup.md @@ -0,0 +1,51 @@ + + +# Run as root + +Assumming Debian 11 Bullseye + +```apt update +apt upgrade +apt install -y htop kitty-terminfo screenfetch postgresql-13 mosh nload +apt install -y debian-keyring debian-archive-keyring apt-transport-https +curl -1sLf 'https://dl.cloudsmith.io/public/caddy/stable/gpg.key' | tee /etc/apt/trusted.gpg.d/caddy-stable.asc +curl -1sLf 'https://dl.cloudsmith.io/public/caddy/stable/debian.deb.txt' | tee /etc/apt/sources.list.d/caddy-stable.list +apt update +apt install caddy + +mkdir /www +adduser nextgen +``` + +### /etc/caddy/Caddyfile + +``` +http://torrentparadise.ml, http://torrent-paradise.ml { + reverse_proxy /api/* http://localhost:8000 + root * /www/torrent-paradise.ml/ + file_server +} +``` + +### /etc/postgresql/13/main/postgresql.conf + +Use https://pgtune.leopard.in.ua/ + +Just get the optimal settings and paste them at the end of the file, they override the defaults. + +### Set up nextgen user and database in Postgres + +``` +postgres $ createuser -d nextgen +nextgen $ createdb nextgen +``` + +### Ship compiled static executables to server + +You can either build it on the server or just ship the binaries to the server via scp. In the end, you need binaries in /home/nextgen and .service files in /etc/systemd/system/. + +Might come in handy: a way to build go binaries truly statically (incl glibc) `CGO_ENABLED=0 GOOS=linux go build -a -ldflags '-extldflags "-static"' .` + +### Ship contents of static/ to /www/torrent-paradise.ml + +Use scp. \ No newline at end of file