Deployment

VPS Installation

Complete production deployment guide for an Ubuntu VPS with systemd.

VPS Installation

GO Shortener is engineered for production deployment on lightweight Linux virtual private servers (e.g., 1 GB RAM Ubuntu instances) running alongside other services such as File Browser, Nginx, or Docker containers without resource contention.


Production Filesystem Layout

All application artifacts are consolidated within /root/Go-shortner:

/root/Go-shortner/
├── go-shortener          # Standalone Go executable (with embedded frontend)
├── .env                  # Environment configuration & secrets (chmod 600)
├── uninstall.sh          # One-click uninstaller script
└── data/
    └── go.sqlite         # SQLite database file (WAL mode enabled)

Step-by-Step Deployment

1. Connect to Your VPS

Open a terminal and connect to your server as root via SSH:

Terminal
ssh root@your-vps-ip

2. Prepare Directory and Permissions

Create the root directories for the application and database storage:

Terminal
mkdir -p /root/Go-shortner/data
chmod 700 /root/Go-shortner

3. Fetch the Latest Standalone Binary

Determine your CPU architecture (x86_64 or aarch64) and download the release binary:

Terminal
# Detect architecture
ARCH=$(uname -m)
if [ "$ARCH" = "x86_64" ]; then
  BINARY="go-shortener-linux-amd64"
elif [ "$ARCH" = "aarch64" ] || [ "$ARCH" = "arm64" ]; then
  BINARY="go-shortener-linux-arm64"
else
  echo "Unsupported architecture: $ARCH" && exit 1
fi

# Download binary into /root/Go-shortner/
curl -L -o /root/Go-shortner/go-shortener "https://github.com/ItsARCn/Go-shortner/releases/latest/download/$BINARY"
chmod +x /root/Go-shortner/go-shortener

4. Create the Production Environment File

Generate a secure .env file with a strong random 32-byte secret:

Terminal
cat << EOF > /root/Go-shortner/.env
PORT=3000
HOST=127.0.0.1
BASE_URL=https://go.arcn.online
DB_PATH=/root/Go-shortner/data/go.sqlite
JWT_SECRET=$(openssl rand -hex 32)
SESSION_DURATION_HOURS=72

ANONYMOUS_DAILY_QUOTA=15
REGISTERED_MONTHLY_QUOTA=100
ANONYMOUS_MAX_EXPIRATION_DAYS=7
REGISTERED_MAX_EXPIRATION_DAYS=365

TURNSTILE_ENABLED=false
EOF

# Restrict file permissions strictly to root
chmod 600 /root/Go-shortner/.env

5. Install the systemd Service

Create the service unit file at /etc/systemd/system/go-shortener.service:

/etc/systemd/system/go-shortener.service
[Unit]
Description=GO Shortener - Minimal High-Performance URL Shortener
After=network.target

[Service]
Type=simple
User=root
WorkingDirectory=/root/Go-shortner
ExecStart=/root/Go-shortner/go-shortener
Restart=always
RestartSec=3
LimitNOFILE=65535

# Hardening
PrivateTmp=true

[Install]
WantedBy=multi-user.target

6. Enable and Start the Service

Reload systemd, enable the service to start automatically on system boot, and trigger startup:

Terminal
systemctl daemon-reload
systemctl enable --now go-shortener

Verifying the Deployment

Inspect the service status and query the local health endpoint:

Terminal
# Inspect systemd status
systemctl status go-shortener

# Health check
curl -s http://127.0.0.1:3000/api/health

If successful, the endpoint responds with {"status":"ok"}.

Copyright © 2026