Sync all deployment documentation and remove manual database creation

- Align deploy.sh, deployment.md, and deployment-quickstart.md with consistent steps
- Remove manual database file creation (SQLite creates them automatically)
- Update all documents to use npm run build instead of npm run build:ts
- Add architecture support for both ARM64 and x86_64
- Include S3_BUCKET_NAME=none option for local-only deployment
- Fix step numbering after removing database creation step

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Claude Code 2025-07-06 18:37:48 -04:00
parent e2b3593c37
commit c395183158
3 changed files with 138 additions and 140 deletions

View file

@ -4,9 +4,9 @@ This guide covers both automated and manual deployment options for the Great Lak
## Prerequisites
- **Server**: Debian 12 ARM64 (or compatible Linux distribution)
- **Node.js**: Version 18 or higher
- **Domain**: DNS pointing to your server
- **Server**: Debian 12 (ARM64 or x86_64)
- **Access**: Root or sudo access
- **Domain**: DNS pointing to your server (optional)
- **Ports**: 80 and 443 open for web traffic
## Automated Deployment (Recommended)
@ -15,30 +15,42 @@ This guide covers both automated and manual deployment options for the Great Lak
1. **Run the deployment script on your server:**
```bash
# Default: Downloads config from S3
curl -sSL https://ice-puremichigan-lol.s3.amazonaws.com/scripts/deploy.sh | bash
# Alternative: Use local files only (no S3)
curl -sSL https://ice-puremichigan-lol.s3.amazonaws.com/scripts/deploy.sh | S3_BUCKET_NAME=none bash
```
2. **Clone and setup the application:**
2. **Follow the printed instructions from the script:**
```bash
sudo git clone https://git.deco.sh/deco/ice.git /opt/icewatch
# Clone repository
git clone https://git.deco.sh/deco/ice.git /opt/icewatch
# Copy config files (only if using S3_BUCKET_NAME=none)
sudo cp /opt/icewatch/scripts/icewatch.service /etc/systemd/system/
sudo cp /opt/icewatch/scripts/Caddyfile /etc/caddy/Caddyfile
# Set up application
cd /opt/icewatch
sudo chown -R $USER:$USER /opt/icewatch
npm install # This automatically builds CSS via postinstall
npm run build:ts # Compile TypeScript to JavaScript
```
3. **Configure environment variables:**
```bash
npm install
npm run build # Compile TypeScript and build CSS
cp .env.example .env
nano .env # Add your API keys
```
4. **Start services:**
```bash
sudo systemctl enable icewatch
sudo systemctl start icewatch
sudo systemctl enable caddy
sudo systemctl start caddy
nano .env # Add your MapBox token and admin password
# Configure domain (if needed)
sudo nano /etc/caddy/Caddyfile
# Database files are created automatically by the application
# Set permissions
sudo chown -R icewatch:icewatch /opt/icewatch
sudo chmod 660 /opt/icewatch/.env
# Start services
sudo systemctl daemon-reload
sudo systemctl enable icewatch caddy
sudo systemctl start icewatch caddy
```
### What the Automated Script Does
@ -74,15 +86,35 @@ node --version
### 2. Install Go (for Custom Caddy)
```bash
# Architecture detection
ARCH=$(uname -m)
case $ARCH in
x86_64)
GO_ARCH="amd64"
;;
aarch64|arm64)
GO_ARCH="arm64"
;;
*)
echo "Unsupported architecture: $ARCH"
exit 1
;;
esac
# Download and install Go
wget -q https://go.dev/dl/go1.21.5.linux-arm64.tar.gz
GO_VERSION="1.21.5"
GO_TARBALL="go${GO_VERSION}.linux-${GO_ARCH}.tar.gz"
wget -q "https://go.dev/dl/${GO_TARBALL}"
sudo rm -rf /usr/local/go
sudo tar -C /usr/local -xzf go1.21.5.linux-arm64.tar.gz
sudo tar -C /usr/local -xzf "${GO_TARBALL}"
# Add to PATH
export PATH=$PATH:/usr/local/go/bin
echo 'export PATH=$PATH:/usr/local/go/bin' >> ~/.bashrc
source ~/.bashrc
# Clean up
rm -f "${GO_TARBALL}"
```
### 3. Build Custom Caddy with Rate Limiting
@ -128,10 +160,9 @@ sudo chown -R $USER:$USER /opt/icewatch
# Install dependencies and build
npm install # This automatically builds CSS
npm run build:ts # Compile TypeScript to JavaScript
npm run build # Compile TypeScript and build CSS
# Create databases
touch icewatch.db profanity.db
# Database files are created automatically by the application
# Set final ownership
sudo chown -R icewatch:icewatch /opt/icewatch
@ -296,7 +327,7 @@ sudo -u icewatch git pull
# Install new dependencies and rebuild
sudo -u icewatch npm install
sudo -u icewatch npm run build:ts
sudo -u icewatch npm run build
# Restart service
sudo systemctl restart icewatch
@ -316,7 +347,7 @@ sudo systemctl restart icewatch
sudo journalctl -u caddy --no-pager
```
3. **Database permissions**:
3. **Permission issues**:
```bash
sudo chown -R icewatch:icewatch /opt/icewatch
```
@ -324,7 +355,7 @@ sudo systemctl restart icewatch
4. **TypeScript compilation issues**:
```bash
cd /opt/icewatch
sudo -u icewatch npm run build:ts
sudo -u icewatch npm run build
```
4. **Port conflicts**:
@ -363,6 +394,6 @@ For deployment issues:
- Verify environment variables: `sudo -u icewatch env`
- Test application directly: `cd /opt/icewatch && sudo -u icewatch node dist/server.js`
- Review this documentation and configuration files
- Ensure TypeScript is compiled: `npm run build:ts`
- Ensure TypeScript is compiled: `npm run build`
The application includes comprehensive logging and monitoring to help diagnose issues quickly.