Fix deployment documentation and scripts for TypeScript setup
- Update deployment instructions to properly compile TypeScript - Fix systemd service to run dist/server.js instead of server.js - Standardize on /opt/icewatch as installation directory - Change icewatch user to have bash shell for easier management - Add explicit database creation steps - Create quick deployment guide for simplified setup - Update README with corrected deployment steps - Fix all references from various names to consistent 'icewatch' This ensures the /table route and all TypeScript features work correctly after deployment by running the compiled JavaScript output. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
parent
c13b61cd03
commit
84b0fe9e93
4 changed files with 235 additions and 38 deletions
|
@ -20,9 +20,11 @@ This guide covers both automated and manual deployment options for the Great Lak
|
|||
|
||||
2. **Clone and setup the application:**
|
||||
```bash
|
||||
git clone git@git.deco.sh:deco/ice.git /opt/ice
|
||||
cd /opt/ice
|
||||
sudo git clone https://github.com/deco/ice.git /opt/icewatch
|
||||
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:**
|
||||
|
@ -33,8 +35,8 @@ This guide covers both automated and manual deployment options for the Great Lak
|
|||
|
||||
4. **Start services:**
|
||||
```bash
|
||||
sudo systemctl enable ice
|
||||
sudo systemctl start ice
|
||||
sudo systemctl enable icewatch
|
||||
sudo systemctl start icewatch
|
||||
sudo systemctl enable caddy
|
||||
sudo systemctl start caddy
|
||||
```
|
||||
|
@ -64,6 +66,9 @@ sudo apt install -y nodejs build-essential
|
|||
|
||||
# Install Git (if not already installed)
|
||||
sudo apt install -y git
|
||||
|
||||
# Verify Node.js version (should be 18+ for TypeScript)
|
||||
node --version
|
||||
```
|
||||
|
||||
### 2. Install Go (for Custom Caddy)
|
||||
|
@ -107,23 +112,29 @@ sudo mkdir -p /etc/caddy /var/log/caddy
|
|||
sudo chown -R caddy:caddy /var/log/caddy
|
||||
|
||||
# Create app user
|
||||
sudo groupadd --system great-lakes-ice-report
|
||||
sudo useradd --system --gid great-lakes-ice-report --create-home --home-dir /opt/great-lakes-ice-report --shell /usr/sbin/nologin great-lakes-ice-report
|
||||
sudo groupadd --system icewatch
|
||||
sudo useradd --system --gid icewatch --create-home --home-dir /opt/icewatch --shell /usr/sbin/nologin icewatch
|
||||
```
|
||||
|
||||
### 5. Deploy Application
|
||||
|
||||
```bash
|
||||
# Clone repository
|
||||
sudo git clone https://github.com/your-username/ice.git /opt/great-lakes-ice-report
|
||||
cd /opt/great-lakes-ice-report
|
||||
sudo git clone https://github.com/deco/ice.git /opt/icewatch
|
||||
cd /opt/icewatch
|
||||
|
||||
# Set temporary ownership for installation
|
||||
sudo chown -R $USER:$USER /opt/icewatch
|
||||
|
||||
# Install dependencies and build
|
||||
sudo npm install
|
||||
sudo npm run build
|
||||
npm install # This automatically builds CSS
|
||||
npm run build:ts # Compile TypeScript to JavaScript
|
||||
|
||||
# Set ownership
|
||||
sudo chown -R great-lakes-ice-report:great-lakes-ice-report /opt/great-lakes-ice-report
|
||||
# Create databases
|
||||
touch icewatch.db profanity.db
|
||||
|
||||
# Set final ownership
|
||||
sudo chown -R icewatch:icewatch /opt/icewatch
|
||||
```
|
||||
|
||||
### 6. Configure Environment
|
||||
|
@ -155,7 +166,9 @@ NODE_ENV=production
|
|||
|
||||
**Create app service:**
|
||||
```bash
|
||||
sudo cp scripts/great-lakes-ice-report.service /etc/systemd/system/
|
||||
sudo cp scripts/icewatch.service /etc/systemd/system/
|
||||
# Ensure the service file has the correct ExecStart:
|
||||
# ExecStart=/usr/bin/node dist/server.js
|
||||
```
|
||||
|
||||
**Create Caddy service:**
|
||||
|
@ -203,8 +216,8 @@ sudo nano /etc/caddy/Caddyfile
|
|||
sudo systemctl daemon-reload
|
||||
|
||||
# Enable and start services
|
||||
sudo systemctl enable great-lakes-ice-report
|
||||
sudo systemctl start great-lakes-ice-report
|
||||
sudo systemctl enable icewatch
|
||||
sudo systemctl start icewatch
|
||||
|
||||
sudo systemctl enable caddy
|
||||
sudo systemctl start caddy
|
||||
|
@ -246,19 +259,19 @@ The application includes multiple layers of rate limiting:
|
|||
|
||||
```bash
|
||||
# Check application status
|
||||
sudo systemctl status great-lakes-ice-report
|
||||
sudo systemctl status icewatch
|
||||
|
||||
# Check Caddy status
|
||||
sudo systemctl status caddy
|
||||
|
||||
# View logs
|
||||
sudo journalctl -u great-lakes-ice-report -f
|
||||
sudo journalctl -u icewatch -f
|
||||
sudo journalctl -u caddy -f
|
||||
```
|
||||
|
||||
### Log Files
|
||||
|
||||
- **Application logs**: `sudo journalctl -u great-lakes-ice-report`
|
||||
- **Application logs**: `sudo journalctl -u icewatch`
|
||||
- **Caddy access logs**: `/var/log/caddy/great-lakes-ice-report.log`
|
||||
- **System logs**: `/var/log/syslog`
|
||||
|
||||
|
@ -273,19 +286,20 @@ The application automatically:
|
|||
|
||||
```bash
|
||||
# Navigate to app directory
|
||||
cd /opt/great-lakes-ice-report
|
||||
cd /opt/icewatch
|
||||
|
||||
# Stop the service
|
||||
sudo systemctl stop icewatch
|
||||
|
||||
# Pull latest changes
|
||||
sudo git pull
|
||||
sudo -u icewatch git pull
|
||||
|
||||
# Install new dependencies
|
||||
sudo npm install
|
||||
|
||||
# Rebuild application
|
||||
sudo npm run build
|
||||
# Install new dependencies and rebuild
|
||||
sudo -u icewatch npm install
|
||||
sudo -u icewatch npm run build:ts
|
||||
|
||||
# Restart service
|
||||
sudo systemctl restart great-lakes-ice-report
|
||||
sudo systemctl restart icewatch
|
||||
```
|
||||
|
||||
## Troubleshooting
|
||||
|
@ -294,7 +308,7 @@ sudo systemctl restart great-lakes-ice-report
|
|||
|
||||
1. **Service won't start**:
|
||||
```bash
|
||||
sudo journalctl -u great-lakes-ice-report --no-pager
|
||||
sudo journalctl -u icewatch --no-pager
|
||||
```
|
||||
|
||||
2. **SSL certificate issues**:
|
||||
|
@ -304,7 +318,13 @@ sudo systemctl restart great-lakes-ice-report
|
|||
|
||||
3. **Database permissions**:
|
||||
```bash
|
||||
sudo chown -R great-lakes-ice-report:great-lakes-ice-report /opt/great-lakes-ice-report
|
||||
sudo chown -R icewatch:icewatch /opt/icewatch
|
||||
```
|
||||
|
||||
4. **TypeScript compilation issues**:
|
||||
```bash
|
||||
cd /opt/icewatch
|
||||
sudo -u icewatch npm run build:ts
|
||||
```
|
||||
|
||||
4. **Port conflicts**:
|
||||
|
@ -321,7 +341,7 @@ For high-traffic deployments:
|
|||
1. **Increase Node.js memory limit**:
|
||||
```bash
|
||||
# Edit service file
|
||||
sudo nano /etc/systemd/system/great-lakes-ice-report.service
|
||||
sudo nano /etc/systemd/system/icewatch.service
|
||||
# Add: Environment=NODE_OPTIONS="--max-old-space-size=4096"
|
||||
```
|
||||
|
||||
|
@ -340,8 +360,9 @@ For high-traffic deployments:
|
|||
|
||||
For deployment issues:
|
||||
- Check system logs: `sudo journalctl -f`
|
||||
- Verify environment variables: `sudo -u great-lakes-ice-report env`
|
||||
- Test application directly: `cd /opt/great-lakes-ice-report && sudo -u great-lakes-ice-report node server.js`
|
||||
- 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`
|
||||
|
||||
The application includes comprehensive logging and monitoring to help diagnose issues quickly.
|
Loading…
Add table
Add a link
Reference in a new issue