Fix worker service and Docker storage permission issues (Issues #66, #67)

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:
Claude
2025-11-27 16:13:50 +00:00
committed by paul
parent 77326a91ca
commit a59a4232ff
2 changed files with 12 additions and 22 deletions
+5 -22
View File
@@ -823,8 +823,8 @@ 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
@@ -844,27 +844,10 @@ StandardError=append:$NATIVE_APP_DIR/logs/backend-error.log
[Install]
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() {