All checks were successful
Deploy API Server / build-and-deploy (push) Successful in 45s
Extract queue name constants to queue.constants.ts to resolve the require cycle that caused 'Cannot read properties of undefined' at startup. Both queue-definitions.ts and queue.service.ts now import from the shared constants file. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
40 lines
960 B
Desktop File
40 lines
960 B
Desktop File
[Unit]
|
|
Description=zhixi NestJS Worker (BullMQ Processor)
|
|
After=network.target mysql.service redis.service
|
|
Wants=mysql.service redis.service
|
|
# Start after API is up (API runs Prisma migration on start)
|
|
After=zhixi-nest-api.service
|
|
|
|
[Service]
|
|
Type=simple
|
|
User=www-data
|
|
Group=www-data
|
|
WorkingDirectory=/opt/zhixi/backend
|
|
ExecStart=/usr/bin/node dist/src/worker.main.js
|
|
Restart=always
|
|
RestartSec=10
|
|
TimeoutStopSec=60
|
|
# Worker needs extra time: BullMQ graceful shutdown waits for active jobs,
|
|
# then SIGKILL from systemd after TimeoutStopSec provides hard deadline.
|
|
|
|
# Environment
|
|
Environment=NODE_ENV=production
|
|
EnvironmentFile=/opt/zhixi/env/.env.production
|
|
|
|
# Memory limit (Worker jobs may consume memory)
|
|
MemoryMax=512M
|
|
|
|
# Security
|
|
NoNewPrivileges=yes
|
|
ProtectSystem=strict
|
|
ProtectHome=yes
|
|
ReadWritePaths=/opt/zhixi/backend/uploads
|
|
|
|
# Logging
|
|
StandardOutput=journal
|
|
StandardError=journal
|
|
SyslogIdentifier=zhixi-nest-worker
|
|
|
|
[Install]
|
|
WantedBy=multi-user.target
|