Backup: 2025-06-07 19:48 - Script test
[Restore from backup: vip-coordinator-backup-2025-06-07-19-48-script-test]
This commit is contained in:
281
UBUNTU_INSTALL.md
Normal file
281
UBUNTU_INSTALL.md
Normal file
@@ -0,0 +1,281 @@
|
||||
# 🐧 VIP Coordinator - Ubuntu Installation Guide
|
||||
|
||||
Deploy VIP Coordinator on Ubuntu in just a few commands!
|
||||
|
||||
## Prerequisites
|
||||
|
||||
First, ensure Docker and Docker Compose are installed on your Ubuntu system:
|
||||
|
||||
```bash
|
||||
# Update package index
|
||||
sudo apt update
|
||||
|
||||
# Install Docker
|
||||
sudo apt install -y docker.io
|
||||
|
||||
# Install Docker Compose
|
||||
sudo apt install -y docker-compose
|
||||
|
||||
# Add your user to docker group (to run docker without sudo)
|
||||
sudo usermod -aG docker $USER
|
||||
|
||||
# Log out and back in, or run:
|
||||
newgrp docker
|
||||
|
||||
# Verify installation
|
||||
docker --version
|
||||
docker-compose --version
|
||||
```
|
||||
|
||||
## Quick Install (One Command)
|
||||
|
||||
```bash
|
||||
# Download and run the interactive setup script
|
||||
curl -sSL https://raw.githubusercontent.com/your-repo/vip-coordinator/main/setup.sh | bash
|
||||
```
|
||||
|
||||
## Manual Installation
|
||||
|
||||
If you prefer to download and inspect the script first:
|
||||
|
||||
```bash
|
||||
# Create a directory for VIP Coordinator
|
||||
mkdir vip-coordinator
|
||||
cd vip-coordinator
|
||||
|
||||
# Download the setup script
|
||||
wget https://raw.githubusercontent.com/your-repo/vip-coordinator/main/setup.sh
|
||||
|
||||
# Make it executable
|
||||
chmod +x setup.sh
|
||||
|
||||
# Run the interactive setup
|
||||
./setup.sh
|
||||
```
|
||||
|
||||
## What the Setup Script Does
|
||||
|
||||
The script will interactively ask you for:
|
||||
|
||||
1. **Deployment Type**: Local development or production with custom domain
|
||||
2. **Domain Configuration**: Your domain names (for production)
|
||||
3. **Security**: Generates secure passwords or lets you set custom ones
|
||||
4. **Google OAuth**: Your Google Cloud Console credentials
|
||||
5. **Optional**: AviationStack API key for flight data
|
||||
|
||||
Then it automatically generates:
|
||||
|
||||
- ✅ `.env` - Your configuration file
|
||||
- ✅ `docker-compose.yml` - Docker services configuration
|
||||
- ✅ `start.sh` - Script to start VIP Coordinator
|
||||
- ✅ `stop.sh` - Script to stop VIP Coordinator
|
||||
- ✅ `update.sh` - Script to update to latest version
|
||||
- ✅ `README.md` - Your deployment documentation
|
||||
- ✅ `nginx.conf` - Production nginx config (if needed)
|
||||
|
||||
## After Setup
|
||||
|
||||
Once the setup script completes:
|
||||
|
||||
```bash
|
||||
# Start VIP Coordinator
|
||||
./start.sh
|
||||
|
||||
# Check status
|
||||
docker-compose ps
|
||||
|
||||
# View logs
|
||||
docker-compose logs
|
||||
|
||||
# Stop when needed
|
||||
./stop.sh
|
||||
```
|
||||
|
||||
## Access Your Application
|
||||
|
||||
- **Local Development**: http://localhost
|
||||
- **Production**: https://your-domain.com
|
||||
|
||||
## Google OAuth Setup
|
||||
|
||||
The script will guide you through setting up Google OAuth:
|
||||
|
||||
1. Go to [Google Cloud Console](https://console.cloud.google.com/)
|
||||
2. Create a new project or select existing
|
||||
3. Enable Google+ API
|
||||
4. Create OAuth 2.0 Client ID credentials
|
||||
5. Add the redirect URI provided by the script
|
||||
6. Copy Client ID and Secret when prompted
|
||||
|
||||
## Ubuntu-Specific Notes
|
||||
|
||||
### Firewall Configuration
|
||||
|
||||
If you're using UFW (Ubuntu's firewall):
|
||||
|
||||
```bash
|
||||
# For local development
|
||||
sudo ufw allow 80
|
||||
sudo ufw allow 3000
|
||||
|
||||
# For production (if using nginx proxy)
|
||||
sudo ufw allow 80
|
||||
sudo ufw allow 443
|
||||
sudo ufw allow 22 # SSH access
|
||||
```
|
||||
|
||||
### Production Deployment on Ubuntu
|
||||
|
||||
For production deployment, the script generates an nginx configuration. To use it:
|
||||
|
||||
```bash
|
||||
# Install nginx
|
||||
sudo apt install nginx
|
||||
|
||||
# Copy the generated config
|
||||
sudo cp nginx.conf /etc/nginx/sites-available/vip-coordinator
|
||||
|
||||
# Enable the site
|
||||
sudo ln -s /etc/nginx/sites-available/vip-coordinator /etc/nginx/sites-enabled/
|
||||
|
||||
# Remove default site
|
||||
sudo rm /etc/nginx/sites-enabled/default
|
||||
|
||||
# Test nginx configuration
|
||||
sudo nginx -t
|
||||
|
||||
# Restart nginx
|
||||
sudo systemctl restart nginx
|
||||
```
|
||||
|
||||
### SSL Certificates with Let's Encrypt
|
||||
|
||||
```bash
|
||||
# Install certbot
|
||||
sudo apt install certbot python3-certbot-nginx
|
||||
|
||||
# Get certificates (replace with your domains)
|
||||
sudo certbot --nginx -d yourdomain.com -d api.yourdomain.com
|
||||
|
||||
# Certbot will automatically update your nginx config for HTTPS
|
||||
```
|
||||
|
||||
### System Service (Optional)
|
||||
|
||||
To run VIP Coordinator as a system service:
|
||||
|
||||
```bash
|
||||
# Create service file
|
||||
sudo tee /etc/systemd/system/vip-coordinator.service > /dev/null <<EOF
|
||||
[Unit]
|
||||
Description=VIP Coordinator
|
||||
Requires=docker.service
|
||||
After=docker.service
|
||||
|
||||
[Service]
|
||||
Type=oneshot
|
||||
RemainAfterExit=yes
|
||||
WorkingDirectory=/path/to/your/vip-coordinator
|
||||
ExecStart=/usr/bin/docker-compose up -d
|
||||
ExecStop=/usr/bin/docker-compose down
|
||||
TimeoutStartSec=0
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
EOF
|
||||
|
||||
# Enable and start the service
|
||||
sudo systemctl enable vip-coordinator
|
||||
sudo systemctl start vip-coordinator
|
||||
|
||||
# Check status
|
||||
sudo systemctl status vip-coordinator
|
||||
```
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
### Common Ubuntu Issues
|
||||
|
||||
**Docker permission denied:**
|
||||
```bash
|
||||
sudo usermod -aG docker $USER
|
||||
newgrp docker
|
||||
```
|
||||
|
||||
**Port already in use:**
|
||||
```bash
|
||||
# Check what's using the port
|
||||
sudo netstat -tulpn | grep :80
|
||||
sudo netstat -tulpn | grep :3000
|
||||
|
||||
# Stop conflicting services
|
||||
sudo systemctl stop apache2 # if Apache is running
|
||||
sudo systemctl stop nginx # if nginx is running
|
||||
```
|
||||
|
||||
**Can't connect to Docker daemon:**
|
||||
```bash
|
||||
# Start Docker service
|
||||
sudo systemctl start docker
|
||||
sudo systemctl enable docker
|
||||
```
|
||||
|
||||
### Viewing Logs
|
||||
|
||||
```bash
|
||||
# All services
|
||||
docker-compose logs
|
||||
|
||||
# Specific service
|
||||
docker-compose logs backend
|
||||
docker-compose logs frontend
|
||||
|
||||
# Follow logs in real-time
|
||||
docker-compose logs -f
|
||||
```
|
||||
|
||||
### Updating
|
||||
|
||||
```bash
|
||||
# Update to latest version
|
||||
./update.sh
|
||||
|
||||
# Or manually
|
||||
docker-compose pull
|
||||
docker-compose up -d
|
||||
```
|
||||
|
||||
## Performance Optimization
|
||||
|
||||
For production Ubuntu servers:
|
||||
|
||||
```bash
|
||||
# Increase file limits
|
||||
echo "fs.file-max = 65536" | sudo tee -a /etc/sysctl.conf
|
||||
|
||||
# Optimize Docker
|
||||
echo '{"log-driver": "json-file", "log-opts": {"max-size": "10m", "max-file": "3"}}' | sudo tee /etc/docker/daemon.json
|
||||
|
||||
# Restart Docker
|
||||
sudo systemctl restart docker
|
||||
```
|
||||
|
||||
## Backup
|
||||
|
||||
```bash
|
||||
# Backup database
|
||||
docker-compose exec db pg_dump -U postgres vip_coordinator > backup.sql
|
||||
|
||||
# Backup volumes
|
||||
docker run --rm -v vip-coordinator_postgres-data:/data -v $(pwd):/backup ubuntu tar czf /backup/postgres-backup.tar.gz /data
|
||||
```
|
||||
|
||||
## Support
|
||||
|
||||
- 📖 Full documentation: [DEPLOYMENT.md](DEPLOYMENT.md)
|
||||
- 🐛 Issues: GitHub Issues
|
||||
- 💬 Community: GitHub Discussions
|
||||
|
||||
---
|
||||
|
||||
**🎉 Your VIP Coordinator will be running on Ubuntu in under 5 minutes!**
|
||||
Reference in New Issue
Block a user