Fix database path issues and update deployment instructions
- 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 <noreply@anthropic.com>
This commit is contained in:
parent
429a5d4afc
commit
e2b3593c37
2 changed files with 11 additions and 7 deletions
|
@ -146,11 +146,11 @@ if [ "$S3_BUCKET_NAME" != "none" ]; then
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Download Caddyfile template
|
# Download Caddyfile
|
||||||
echo "📥 Downloading Caddy configuration..."
|
echo "📥 Downloading Caddy configuration..."
|
||||||
curl -sSL "$S3_BASE_URL/Caddyfile" -o /tmp/Caddyfile
|
curl -sSL "$S3_BASE_URL/Caddyfile" -o /tmp/Caddyfile
|
||||||
if [ $? -eq 0 ]; then
|
if [ $? -eq 0 ]; then
|
||||||
sudo mv /tmp/Caddyfile /etc/caddy/Caddyfile.template
|
sudo mv /tmp/Caddyfile /etc/caddy/Caddyfile
|
||||||
echo "✅ Downloaded Caddyfile from S3"
|
echo "✅ Downloaded Caddyfile from S3"
|
||||||
else
|
else
|
||||||
echo "❌ Failed to download Caddyfile from S3"
|
echo "❌ Failed to download Caddyfile from S3"
|
||||||
|
@ -180,6 +180,7 @@ fi
|
||||||
echo "3. Set up the application:"
|
echo "3. Set up the application:"
|
||||||
echo " cd /opt/icewatch"
|
echo " cd /opt/icewatch"
|
||||||
echo " npm install"
|
echo " npm install"
|
||||||
|
echo " npm run build # Compile TypeScript and build CSS"
|
||||||
echo " cp .env.example .env"
|
echo " cp .env.example .env"
|
||||||
echo " nano .env # Add your MapBox token and admin password"
|
echo " nano .env # Add your MapBox token and admin password"
|
||||||
echo ""
|
echo ""
|
||||||
|
@ -187,16 +188,19 @@ echo "4. Configure domain in Caddyfile (if needed):"
|
||||||
echo " sudo nano /etc/caddy/Caddyfile"
|
echo " sudo nano /etc/caddy/Caddyfile"
|
||||||
echo " # The default is configured for ice.puremichigan.lol"
|
echo " # The default is configured for ice.puremichigan.lol"
|
||||||
echo ""
|
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 chown -R icewatch:icewatch /opt/icewatch"
|
||||||
echo " sudo chmod 660 /opt/icewatch/.env"
|
echo " sudo chmod 660 /opt/icewatch/.env"
|
||||||
echo ""
|
echo ""
|
||||||
echo "6. Start services:"
|
echo "7. Start services:"
|
||||||
echo " sudo systemctl daemon-reload"
|
echo " sudo systemctl daemon-reload"
|
||||||
echo " sudo systemctl enable icewatch caddy"
|
echo " sudo systemctl enable icewatch caddy"
|
||||||
echo " sudo systemctl start icewatch caddy"
|
echo " sudo systemctl start icewatch caddy"
|
||||||
echo ""
|
echo ""
|
||||||
echo "7. Check status:"
|
echo "8. Check status:"
|
||||||
echo " sudo systemctl status icewatch"
|
echo " sudo systemctl status icewatch"
|
||||||
echo " sudo systemctl status caddy"
|
echo " sudo systemctl status caddy"
|
||||||
echo ""
|
echo ""
|
||||||
|
|
|
@ -16,7 +16,7 @@ class DatabaseService {
|
||||||
|
|
||||||
async initializeMainDatabase(): Promise<void> {
|
async initializeMainDatabase(): Promise<void> {
|
||||||
return new Promise((resolve, reject) => {
|
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) => {
|
this.mainDb = new sqlite3.Database(dbPath, async (err: Error | null) => {
|
||||||
if (err) {
|
if (err) {
|
||||||
console.error('Could not connect to main database', err);
|
console.error('Could not connect to main database', err);
|
||||||
|
@ -41,7 +41,7 @@ class DatabaseService {
|
||||||
|
|
||||||
async initializeProfanityDatabase(): Promise<void> {
|
async initializeProfanityDatabase(): Promise<void> {
|
||||||
return new Promise((resolve, reject) => {
|
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) => {
|
this.profanityDb = new sqlite3.Database(dbPath, async (err: Error | null) => {
|
||||||
if (err) {
|
if (err) {
|
||||||
console.error('Could not connect to profanity database', err);
|
console.error('Could not connect to profanity database', err);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue