4REPO="ilyakooo0/skrepka"
5INSTALL_BIN="/usr/local/bin/skrepka-server"
6UNIT_DEST="/etc/systemd/system/skrepka.service"
8DOMAIN="${DOMAIN:-${1:-}}"
10if [ -z "$DOMAIN" ]; then
11 echo "error: DOMAIN is required" >&2
12 echo "usage: DOMAIN=skrepka.example.com sh install.sh" >&2
16if [ "$(id -u)" -ne 0 ]; then
17 echo "error: must be run as root" >&2
26 Linux) os_name="linux" ;;
27 Darwin) os_name="macos" ;;
28 *) echo "error: unsupported OS: $os" >&2; exit 1 ;;
32 x86_64|amd64) arch_name="x86_64" ;;
33 aarch64|arm64) arch_name="arm64" ;;
34 *) echo "error: unsupported architecture: $arch" >&2; exit 1 ;;
37 echo "${os_name}-${arch_name}"
40PLATFORM=$(detect_platform)
41ASSET="server-${PLATFORM}"
43echo "Detected platform: ${PLATFORM}"
44echo "Downloading latest release..."
46DOWNLOAD_URL="https://github.com/${REPO}/releases/latest/download/${ASSET}"
48if command -v curl >/dev/null 2>&1; then
49 curl -fSL "$DOWNLOAD_URL" -o "$INSTALL_BIN"
50elif command -v wget >/dev/null 2>&1; then
51 wget -q "$DOWNLOAD_URL" -O "$INSTALL_BIN"
53 echo "error: curl or wget required" >&2
57chmod 755 "$INSTALL_BIN"
58echo "Installed binary to ${INSTALL_BIN}"
62 cat > "$UNIT_DEST" <<'EOF'
64Description=Skrepka relay server
65After=network-online.target
66Wants=network-online.target
70ExecStart=/usr/local/bin/skrepka-server
76WorkingDirectory=/var/lib/skrepka
84WantedBy=multi-user.target
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
93 apt-get install -y caddy
97 cat > /etc/caddy/Caddyfile <<CADDYEOF
99 reverse_proxy localhost:8080
103 if command -v ufw >/dev/null 2>&1 && ufw status | grep -q "active"; then
104 echo "Opening ports 80, 443 (ufw)..."
107 elif command -v firewall-cmd >/dev/null 2>&1 && systemctl is-active --quiet firewalld; then
108 echo "Opening ports 80, 443 (firewalld)..."
109 firewall-cmd --add-port=80/tcp --permanent
110 firewall-cmd --add-port=443/tcp --permanent
111 firewall-cmd --reload
114 systemctl daemon-reload
115 if systemctl is-active --quiet skrepka; then
116 echo "Restarting existing service..."
117 systemctl restart skrepka
118 echo "Service restarted with updated binary."
120 systemctl enable --now skrepka
121 echo "Service enabled and started."
124 systemctl restart caddy
125 echo "Caddy configured for https://${DOMAIN}"
126 echo "Check status with: systemctl status skrepka"
129 echo "Binary installed. Systemd service setup skipped (not Linux)."
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list