guidly/deploy/setup-server.sh
laruevin d5ed7fdcf9 Initial commit: Guidly project with CI/CD pipeline
Telegram Bot + Mini App for city walking quests.
- React 19 + TypeScript + Vite 6 frontend
- Express 5 + PostgreSQL backend
- grammY Telegram bot with DeepSeek AI
- GitLab CI/CD: lint, build, deploy to production

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-11 11:42:42 +07:00

50 lines
1.4 KiB
Bash

#!/bin/bash
set -e
echo "=== Guidly VPS Setup ==="
echo "Run this script once on a fresh Ubuntu 22/24 server"
# 1. Update system
echo ">>> Updating system..."
apt update && apt upgrade -y
# 2. Install Node.js 22 (LTS)
echo ">>> Installing Node.js 22..."
curl -fsSL https://deb.nodesource.com/setup_22.x | bash -
apt install -y nodejs
# 3. Install nginx
echo ">>> Installing nginx..."
apt install -y nginx
# 4. Install certbot for Let's Encrypt SSL
echo ">>> Installing certbot..."
apt install -y certbot python3-certbot-nginx
# 5. Install PM2 globally
echo ">>> Installing PM2..."
npm install -g pm2
# 6. Create app directory
echo ">>> Creating app directory..."
mkdir -p /root/guidly
# 7. Configure firewall (if ufw is active)
if command -v ufw &> /dev/null; then
echo ">>> Configuring firewall..."
ufw allow 'Nginx Full'
ufw allow OpenSSH
fi
echo ""
echo "=== Setup complete ==="
echo ""
echo "Next steps:"
echo " 1. Point DNS: gidli.ru → $(curl -s ifconfig.me)"
echo " 2. Copy nginx config: cp /root/guidly/deploy/nginx-guidly.conf /etc/nginx/sites-available/gidli.ru"
echo " 3. Enable site: ln -s /etc/nginx/sites-available/gidli.ru /etc/nginx/sites-enabled/"
echo " 4. Remove default: rm -f /etc/nginx/sites-enabled/default"
echo " 5. Get SSL cert: certbot --nginx -d gidli.ru"
echo " 6. Test nginx: nginx -t && systemctl reload nginx"
echo " 7. Deploy app: run deploy.sh from your local machine"