# Great Lakes Ice Report - Quick Deployment Guide This is a simplified deployment guide for quickly setting up the Great Lakes Ice Report application. ## Prerequisites - Debian 12 (ARM64 or x86_64) server - Root or sudo access - Domain pointing to your server (optional, defaults to ice.puremichigan.lol) ## Quick Start - Automated Deployment ```bash # Run the automated deployment script curl -sSL https://ice-puremichigan-lol.s3.amazonaws.com/scripts/deploy.sh | bash # Or to use local files only (no S3) curl -sSL https://ice-puremichigan-lol.s3.amazonaws.com/scripts/deploy.sh | S3_BUCKET_NAME=none bash ``` Then follow the instructions printed by the script. The key steps are: ## Manual Steps After Running Deployment Script ### 1. Clone the Repository ```bash git clone https://git.deco.sh/deco/ice.git /opt/icewatch ``` ### 2. Copy Configuration Files (if using S3_BUCKET_NAME=none) ```bash sudo cp /opt/icewatch/scripts/icewatch.service /etc/systemd/system/ sudo cp /opt/icewatch/scripts/Caddyfile /etc/caddy/Caddyfile ``` ### 3. Set Up the Application ```bash cd /opt/icewatch npm install npm run build # Compile TypeScript and build CSS cp .env.example .env nano .env # Add your MapBox token and admin password ``` ### 4. Configure Domain (if needed) ```bash sudo nano /etc/caddy/Caddyfile # Change 'ice.puremichigan.lol' to your domain ``` ### 5. Set Permissions ```bash sudo chown -R icewatch:icewatch /opt/icewatch sudo chmod 660 /opt/icewatch/.env ``` ### 6. Start Services ```bash sudo systemctl daemon-reload sudo systemctl enable icewatch caddy sudo systemctl start icewatch caddy ``` ### 7. Check Status ```bash sudo systemctl status icewatch sudo systemctl status caddy ``` ## Environment Variables Edit `.env` with these required settings: ``` MAPBOX_ACCESS_TOKEN=pk.your_mapbox_token_here ADMIN_PASSWORD=your_secure_password PORT=3000 NODE_ENV=production ``` ## Verify Installation ```bash # Test locally curl http://localhost:3000/api/locations # Check logs if needed sudo journalctl -u icewatch -f ``` ## Updating the Application ```bash cd /opt/icewatch sudo systemctl stop icewatch # Pull latest changes as icewatch user sudo -u icewatch git pull # Install dependencies and rebuild sudo -u icewatch npm install sudo -u icewatch npm run build # Restart service sudo systemctl start icewatch ``` ## Troubleshooting ### Service won't start ```bash # Check logs sudo journalctl -u icewatch --no-pager -n 50 # Common issue: Missing dist/server.js cd /opt/icewatch npm run build # Database files are created automatically by the application ``` ### Permission errors ```bash # Ensure correct ownership of project directory cd /opt/icewatch sudo chown -R icewatch:icewatch /opt/icewatch ``` ## Important Notes 1. The deployment script installs Node.js, Go, and builds a custom Caddy with rate limiting 2. The application uses TypeScript which must be compiled with `npm run build` 3. Database files are created automatically by the application 4. The service runs as the `icewatch` system user 5. Caddy automatically obtains SSL certificates