on master help sign in
Require DOMAIN in install script, add Caddy reverse proxy with automatic TLS, add servers.json
commitac03169c562a0163f3adae83e17a7a853d486fcd authoriko <mail@iko.soy> dateSun 22 Mar 2026, 06:42 (7 months ago) parent052c578
3 files changed+40−6
README.md+2−2 install.sh+33−4 servers.json+5
README.md+2−2
@@ -5,7 +5,7 @@ Decentralized, end-to-end encrypted messaging with no accounts and no home serve
55## Install the relay server
66
77```sh
8−curl -fsSL https://raw.githubusercontent.com/ilyakooo0/skrepka/master/install.sh | sudo sh
8+curl -fsSL https://raw.githubusercontent.com/ilyakooo0/skrepka/master/install.sh | sudo DOMAIN=skrepka.example.com sh
99```
1010
11−This downloads the latest binary for your platform, installs it to `/usr/local/bin/skrepka-server`, and on Linux sets up a systemd service. Re-running the same command will update the binary and restart the service.
11+This installs the server binary, sets up a systemd service, and configures [Caddy](https://caddyserver.com) as a reverse proxy with automatic TLS. Re-running the same command will update the binary and restart the service.
install.sh+33−4
@@ -5,6 +5,14 @@ REPO="ilyakooo0/skrepka"
55INSTALL_BIN="/usr/local/bin/skrepka-server"
66UNIT_DEST="/etc/systemd/system/skrepka.service"
77
8+DOMAIN="${DOMAIN:-${1:-}}"
9+
10+if [ -z "$DOMAIN" ]; then
11+ echo "error: DOMAIN is required" >&2
12+ echo "usage: DOMAIN=skrepka.example.com sh install.sh" >&2
13+ exit 1
14+fi
15+
816if [ "$(id -u)" -ne 0 ]; then
917 echo "error: must be run as root" >&2
1018 exit 1
@@ -76,12 +84,30 @@ NoNewPrivileges=yes
7684WantedBy=multi-user.target
7785EOF
7886
87+ if ! command -v caddy >/dev/null 2>&1; then
88+ echo "Installing Caddy..."
89+ apt-get install -y debian-keyring debian-archive-keyring apt-transport-https curl
90+ curl -1sLf 'https://dl.cloudsmith.io/public/caddy/stable/gpg.key' | gpg --dearmor -o /usr/share/keyrings/caddy-stable-archive-keyring.gpg
91+ curl -1sLf 'https://dl.cloudsmith.io/public/caddy/stable/debian.deb.txt' | tee /etc/apt/sources.list.d/caddy-stable.list
92+ apt-get update
93+ apt-get install -y caddy
94+ fi
95+
96+ mkdir -p /etc/caddy
97+ cat > /etc/caddy/Caddyfile <<CADDYEOF
98+${DOMAIN} {
99+ reverse_proxy localhost:8080
100+}
101+CADDYEOF
102+
79103 if command -v ufw >/dev/null 2>&1 && ufw status | grep -q "active"; then
80− echo "Opening port 8080 (ufw)..."
81− ufw allow 8080/tcp
104+ echo "Opening ports 80, 443 (ufw)..."
105+ ufw allow 80/tcp
106+ ufw allow 443/tcp
82107 elif command -v firewall-cmd >/dev/null 2>&1 && systemctl is-active --quiet firewalld; then
83− echo "Opening port 8080 (firewalld)..."
84− firewall-cmd --add-port=8080/tcp --permanent
108+ echo "Opening ports 80, 443 (firewalld)..."
109+ firewall-cmd --add-port=80/tcp --permanent
110+ firewall-cmd --add-port=443/tcp --permanent
85111 firewall-cmd --reload
86112 fi
87113
@@ -94,6 +120,9 @@ EOF
94120 systemctl enable --now skrepka
95121 echo "Service enabled and started."
96122 fi
123+
124+ systemctl restart caddy
125+ echo "Caddy configured for https://${DOMAIN}"
97126 echo "Check status with: systemctl status skrepka"
98127 ;;
99128 *)
servers.jsonnew file+5
@@ -0,0 +1,5 @@
1+[
2+ "https://178.72.170.73",
3+ "https://45.66.117.187",
4+ "https://158.160.236.107"
5+]