Files
netrunner-backend/templates/init_node.sh
T

43 lines
1.2 KiB
Bash

#!/bin/bash
set -e
echo "[*] Step 1: Updating system packages..."
apt-get update -y && apt-get install -y ca-certificates libssl3
echo "[*] Step 2: Installing Docker..."
if ! command -v docker &> /dev/null; then
curl -fsSL https://get.docker.com -o get-docker.sh
sh get-docker.sh
fi
echo "[*] Step 3: Logging into ghcr.io via Control Plane token..."
echo "$GH_TOKEN" | docker login ghcr.io -u nineap --password-stdin
echo "[*] Step 4: Pulling the latest Netrunner image..."
docker pull ghcr.io/nineap/netrunner-proxy:latest
echo "[*] Step 5: Starting Netrunner Proxy at port 443..."
docker run -d \
--name netrunner-proxy \
--restart always \
--network host \
--cap-add NET_ADMIN \
--cap-add NET_RAW \
--cap-add DAC_OVERRIDE \
--device /dev/net/tun:/dev/net/tun \
-e CONTROL_PLANE_URL=http://147.45.43.70:8080 \
-e NODE_IP=$NODE_IP \
ghcr.io/nineap/netrunner-proxy:latest
echo "[*] Step 6: Starting Watchtower for auto-updates..."
docker run -d \
--name watchtower \
--restart always \
-v /var/run/docker.sock:/var/run/docker.sock \
-v /root/.docker/config.json:/config.json:ro \
containrrr/watchtower \
--interval 300 \
--cleanup \
netrunner-proxy
echo "[+] Node deployment complete. Proxy and Watchtower are running."