2026-05-10 05:12:14 +03:00
|
|
|
#!/bin/bash
|
2026-05-26 21:14:51 +03:00
|
|
|
# Montana VPS full install — Montana node + companion VPN endpoint on one Linux VPS.
|
2026-05-10 05:12:14 +03:00
|
|
|
#
|
2026-05-26 21:14:51 +03:00
|
|
|
# What it does:
|
|
|
|
|
# 1. Runs scripts/install-vps.sh — Montana node (systemd + identity + start)
|
|
|
|
|
# 2. Runs montana-vpn/install.sh — VPN endpoint (xray Reality + nginx decoy)
|
2026-05-10 05:12:14 +03:00
|
|
|
#
|
2026-05-26 21:14:51 +03:00
|
|
|
# The node and the VPN are two independent systemd services. Either can be
|
|
|
|
|
# stopped without affecting the other. Each service has its own README.
|
2026-05-10 05:12:14 +03:00
|
|
|
#
|
2026-05-26 21:14:51 +03:00
|
|
|
# Usage:
|
2026-05-10 05:12:14 +03:00
|
|
|
# sudo bash scripts/install-vps-full.sh
|
|
|
|
|
#
|
2026-05-26 21:14:51 +03:00
|
|
|
# Optional environment overrides:
|
|
|
|
|
# DECOY_HOST=www.cloudflare.com Reality dest SNI (default googletagmanager)
|
|
|
|
|
# CLIENT_EMAIL=alice xray client email label
|
|
|
|
|
# SKIP_NODE=1 install VPN only (skip node)
|
|
|
|
|
# SKIP_VPN=1 install node only (skip VPN)
|
2026-05-10 05:12:14 +03:00
|
|
|
|
|
|
|
|
set -euo pipefail
|
|
|
|
|
|
|
|
|
|
SCRIPT_PATH="${BASH_SOURCE[0]}"
|
|
|
|
|
if [ -L "$SCRIPT_PATH" ]; then
|
|
|
|
|
SCRIPT_PATH="$(readlink "$SCRIPT_PATH")"
|
|
|
|
|
fi
|
|
|
|
|
SCRIPT_DIR="$(cd "$(dirname "$SCRIPT_PATH")" && pwd)"
|
|
|
|
|
CODE_DIR="$(cd "$SCRIPT_DIR/.." && pwd)"
|
|
|
|
|
|
|
|
|
|
INSTALL_VPS="$SCRIPT_DIR/install-vps.sh"
|
|
|
|
|
INSTALL_VPN="$CODE_DIR/montana-vpn/install.sh"
|
|
|
|
|
|
|
|
|
|
log() { printf '\033[1;32m[install-vps-full]\033[0m %s\n' "$*"; }
|
2026-05-26 21:14:51 +03:00
|
|
|
die() { printf '\033[1;31m[install-vps-full] ERROR:\033[0m %s\n' "$*" >&2; exit 1; }
|
2026-05-10 05:12:14 +03:00
|
|
|
|
2026-05-26 21:14:51 +03:00
|
|
|
[ "$(id -u)" = "0" ] || die "root privileges required"
|
2026-05-10 05:12:14 +03:00
|
|
|
|
2026-05-26 21:14:51 +03:00
|
|
|
[ -f "$INSTALL_VPS" ] || die "missing: $INSTALL_VPS"
|
|
|
|
|
[ -f "$INSTALL_VPN" ] || die "missing: $INSTALL_VPN"
|
2026-05-10 05:12:14 +03:00
|
|
|
|
|
|
|
|
if [ "${SKIP_NODE:-0}" != "1" ]; then
|
|
|
|
|
log ""
|
|
|
|
|
log "================================================================"
|
2026-05-26 21:14:51 +03:00
|
|
|
log " STEP 1/2 — Montana node install"
|
2026-05-10 05:12:14 +03:00
|
|
|
log "================================================================"
|
|
|
|
|
log ""
|
|
|
|
|
bash "$INSTALL_VPS"
|
|
|
|
|
else
|
2026-05-26 21:14:51 +03:00
|
|
|
log "SKIP_NODE=1 — skipping node install"
|
2026-05-10 05:12:14 +03:00
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
if [ "${SKIP_VPN:-0}" != "1" ]; then
|
|
|
|
|
log ""
|
|
|
|
|
log "================================================================"
|
2026-05-26 21:14:51 +03:00
|
|
|
log " STEP 2/2 — VPN endpoint install"
|
2026-05-10 05:12:14 +03:00
|
|
|
log "================================================================"
|
|
|
|
|
log ""
|
|
|
|
|
bash "$INSTALL_VPN"
|
|
|
|
|
else
|
2026-05-26 21:14:51 +03:00
|
|
|
log "SKIP_VPN=1 — skipping VPN install"
|
2026-05-10 05:12:14 +03:00
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
log ""
|
|
|
|
|
log "================================================================"
|
2026-05-26 21:14:51 +03:00
|
|
|
log " DONE"
|
2026-05-10 05:12:14 +03:00
|
|
|
log "================================================================"
|
|
|
|
|
log ""
|
2026-05-26 21:14:51 +03:00
|
|
|
log "Montana node: systemctl status montana-node"
|
2026-05-10 05:12:14 +03:00
|
|
|
log "VPN endpoint: systemctl status xray"
|
|
|
|
|
log "decoy nginx: systemctl status nginx"
|
|
|
|
|
log ""
|
2026-05-26 21:14:51 +03:00
|
|
|
log "Node logs: journalctl -u montana-node -f"
|
|
|
|
|
log "VPN logs: journalctl -u xray -f"
|
2026-05-10 05:12:14 +03:00
|
|
|
log ""
|
2026-05-26 21:14:51 +03:00
|
|
|
log "VLESS URL for the client was printed above in step 2."
|
|
|
|
|
log "The node's mnemonic backup was printed in step 1 — keep it safe."
|