From e2b3593c370be5afe289dd7225cac41336c61406 Mon Sep 17 00:00:00 2001 From: Claude Code Date: Sun, 6 Jul 2025 18:33:08 -0400 Subject: [PATCH] Fix database path issues and update deployment instructions MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Fix DatabaseService.ts to use correct relative paths (../../ instead of ../../../) - Add npm run build step to deployment instructions - Add database file creation step to deployment instructions - Fix Caddyfile download to go directly to /etc/caddy/Caddyfile - Update step numbering in deployment script 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude --- scripts/deploy.sh | 14 +++++++++----- src/services/DatabaseService.ts | 4 ++-- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/scripts/deploy.sh b/scripts/deploy.sh index 3f23844..4e8ebad 100644 --- a/scripts/deploy.sh +++ b/scripts/deploy.sh @@ -146,11 +146,11 @@ if [ "$S3_BUCKET_NAME" != "none" ]; then exit 1 fi - # Download Caddyfile template + # Download Caddyfile echo "📥 Downloading Caddy configuration..." curl -sSL "$S3_BASE_URL/Caddyfile" -o /tmp/Caddyfile if [ $? -eq 0 ]; then - sudo mv /tmp/Caddyfile /etc/caddy/Caddyfile.template + sudo mv /tmp/Caddyfile /etc/caddy/Caddyfile echo "✅ Downloaded Caddyfile from S3" else echo "❌ Failed to download Caddyfile from S3" @@ -180,6 +180,7 @@ fi echo "3. Set up the application:" echo " cd /opt/icewatch" echo " npm install" +echo " npm run build # Compile TypeScript and build CSS" echo " cp .env.example .env" echo " nano .env # Add your MapBox token and admin password" echo "" @@ -187,16 +188,19 @@ echo "4. Configure domain in Caddyfile (if needed):" echo " sudo nano /etc/caddy/Caddyfile" echo " # The default is configured for ice.puremichigan.lol" echo "" -echo "5. Set permissions:" +echo "5. Create database files:" +echo " touch icewatch.db profanity.db" +echo "" +echo "6. Set permissions:" echo " sudo chown -R icewatch:icewatch /opt/icewatch" echo " sudo chmod 660 /opt/icewatch/.env" echo "" -echo "6. Start services:" +echo "7. Start services:" echo " sudo systemctl daemon-reload" echo " sudo systemctl enable icewatch caddy" echo " sudo systemctl start icewatch caddy" echo "" -echo "7. Check status:" +echo "8. Check status:" echo " sudo systemctl status icewatch" echo " sudo systemctl status caddy" echo "" diff --git a/src/services/DatabaseService.ts b/src/services/DatabaseService.ts index bfbb173..976d5b3 100644 --- a/src/services/DatabaseService.ts +++ b/src/services/DatabaseService.ts @@ -16,7 +16,7 @@ class DatabaseService { async initializeMainDatabase(): Promise { return new Promise((resolve, reject) => { - const dbPath = path.join(__dirname, '../../../icewatch.db'); + const dbPath = path.join(__dirname, '../../icewatch.db'); this.mainDb = new sqlite3.Database(dbPath, async (err: Error | null) => { if (err) { console.error('Could not connect to main database', err); @@ -41,7 +41,7 @@ class DatabaseService { async initializeProfanityDatabase(): Promise { return new Promise((resolve, reject) => { - const dbPath = path.join(__dirname, '../../../profanity.db'); + const dbPath = path.join(__dirname, '../../profanity.db'); this.profanityDb = new sqlite3.Database(dbPath, async (err: Error | null) => { if (err) { console.error('Could not connect to profanity database', err);