Files
panel/docker-entrypoint-dev.sh

40 lines
1.3 KiB
Bash

#!/bin/bash
# Development container startup script
# This runs when the development container starts
echo "🚀 Starting development environment..."
# Ensure data directory exists
mkdir -p /app/data
# Ensure uploads directory structure exists
mkdir -p /app/public/uploads/contracts
mkdir -p /app/public/uploads/projects
mkdir -p /app/public/uploads/tasks
# Set proper permissions for uploads directory
chmod -R 755 /app/public/uploads
# Create admin account if it doesn't exist
echo "🔧 Setting up admin account..."
node scripts/create-admin.js
# Set up daily backup cron job (runs at 2 AM daily)
echo "⏰ Setting up daily backup cron job..."
echo "0 2 * * * cd /app && node backup-db.mjs >> /app/data/backup.log 2>&1" > /etc/cron.d/backup-cron
chmod 0644 /etc/cron.d/backup-cron
crontab /etc/cron.d/backup-cron
# Set up daily due date reminders cron job (runs at 3 AM daily)
echo "⏰ Setting up daily due date reminders cron job..."
echo "0 3 * * * cd /app && node send-due-date-reminders.mjs >> /app/data/reminders.log 2>&1" > /etc/cron.d/reminders-cron
chmod 0644 /etc/cron.d/reminders-cron
crontab -l | cat - /etc/cron.d/reminders-cron > /tmp/crontab.tmp && crontab /tmp/crontab.tmp
service cron start
# Start the development server
echo "✅ Starting development server..."
exec npm run dev