Issue #66: Remove redundant picpeak-workers.service creation from setup script. Workers (fileWatcher, expirationChecker, emailProcessor) are now started automatically by server.js, so a separate systemd service is not needed. The legacy service cleanup code is retained for migration purposes. Issue #67: Ensure storage directories exist at container startup in wait-for-db.sh. When host directories are bind-mounted in Docker, the container's built-in directories are overridden. This fix creates the required directory structure (events/active, events/archived, thumbnails) before the application starts, preventing EACCES permission errors.
This commit is contained in:
@@ -43,6 +43,13 @@ done
|
||||
|
||||
>&2 echo "Target database \"$target_db\" is ready."
|
||||
|
||||
# Ensure storage directories exist with proper permissions (Issue #67 fix)
|
||||
# When host directories are bind-mounted, the container's built-in directories are overridden
|
||||
# This ensures the required directory structure exists before the application starts
|
||||
echo "Ensuring storage directories exist..."
|
||||
STORAGE_BASE="${STORAGE_PATH:-/app/storage}"
|
||||
mkdir -p "$STORAGE_BASE/events/active" "$STORAGE_BASE/events/archived" "$STORAGE_BASE/thumbnails" 2>/dev/null || true
|
||||
|
||||
# Run migrations (use safe runner in production)
|
||||
echo "Running database migrations..."
|
||||
if [ "$NODE_ENV" = "production" ]; then
|
||||
|
||||
@@ -824,7 +824,7 @@ EOF
|
||||
create_systemd_services() {
|
||||
log_step "Creating systemd services..."
|
||||
|
||||
# Backend service
|
||||
# Backend service (includes workers - fileWatcher, expirationChecker are started by server.js)
|
||||
cat > /etc/systemd/system/picpeak-backend.service <<EOF
|
||||
[Unit]
|
||||
Description=PicPeak Backend Service
|
||||
@@ -845,26 +845,9 @@ StandardError=append:$NATIVE_APP_DIR/logs/backend-error.log
|
||||
WantedBy=multi-user.target
|
||||
EOF
|
||||
|
||||
# Workers service
|
||||
cat > /etc/systemd/system/picpeak-workers.service <<EOF
|
||||
[Unit]
|
||||
Description=PicPeak Background Workers
|
||||
After=network.target picpeak-backend.service
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
User=$NATIVE_APP_USER
|
||||
WorkingDirectory=$NATIVE_APP_DIR/app/backend
|
||||
Environment="NODE_ENV=production"
|
||||
ExecStart=/usr/bin/node src/services/workerManager.js
|
||||
Restart=always
|
||||
RestartSec=10
|
||||
StandardOutput=append:$NATIVE_APP_DIR/logs/workers.log
|
||||
StandardError=append:$NATIVE_APP_DIR/logs/workers-error.log
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
EOF
|
||||
# Note: Workers (fileWatcher, expirationChecker, emailProcessor) are now started
|
||||
# automatically by server.js, so a separate workers service is no longer needed.
|
||||
# Legacy picpeak-workers.service will be cleaned up during installation.
|
||||
}
|
||||
|
||||
setup_caddy() {
|
||||
|
||||
Reference in New Issue
Block a user