Add ecosystem.config.js

Signed-off-by: Thomas Scott <tombomb122@noreply.localhost>
This commit is contained in:
Thomas Scott 2025-12-17 12:11:29 +00:00
parent 1b937d7bcd
commit ce970bb09c
1 changed files with 112 additions and 0 deletions

112
ecosystem.config.js Normal file
View File

@ -0,0 +1,112 @@
/**
* PM2 ecosystem configuration
*
* IMPORTANT:
* - Do NOT commit real API keys or tokens
* - Use environment variables or a local .env file instead
*/
module.exports = {
apps: [
{
name: 'redmine-gitea-sync',
script: './server.mjs',
// Environment variables
env: {
NODE_ENV: 'production',
PORT: 3002,
// ------------------------
// Redmine Configuration
// ------------------------
REDMINE_API_URL: 'https://redmine.example.com',
REDMINE_API_KEY: '<REDMINE_API_KEY>',
REDMINE_TIMEOUT: '30000',
// ------------------------
// Gitea Configuration
// Base URL should NOT include /api/v1
// ------------------------
GITEA_API_URL: 'https://git.example.com',
GITEA_TOKEN: '<GITEA_TOKEN>',
GITEA_OWNER: '<GITEA_OWNER>',
GITEA_TIMEOUT: '30000',
// ------------------------
// Cache Configuration
// ------------------------
CACHE_TTL: '30000',
// ------------------------
// Sync Feature Flags
// ------------------------
SYNC_LABELS: 'true',
SYNC_MILESTONES: 'true',
SYNC_CUSTOM_FIELDS: 'true',
// ------------------------
// Retry Configuration
// ------------------------
RETRY_ATTEMPTS: '3',
RETRY_DELAY: '1000',
// ------------------------
// Logging Configuration
// ------------------------
LOG_LEVEL: 'info',
LOG_VERBOSE: 'false',
// ------------------------
// Project Mapping (JSON string)
// Format: {"GiteaRepoName":"redmine-project-id"}
// ------------------------
PROJECT_MAPPING: '{"EXAMPLE_REPO":"example-project"}',
},
// Development environment override
env_development: {
NODE_ENV: 'development',
LOG_LEVEL: 'debug',
LOG_VERBOSE: 'true',
},
// ------------------------
// PM2 behavior settings
// ------------------------
instances: 1,
exec_mode: 'fork',
watch: false,
// Automatic restart settings
max_restarts: 10,
min_uptime: '10s',
max_memory_restart: '300M',
// Logging
error_file: './logs/error.log',
out_file: './logs/out.log',
log_date_format: 'YYYY-MM-DD HH:mm:ss Z',
merge_logs: true,
// Restart behavior
autorestart: true,
restart_delay: 4000,
watch_delay: 1000,
ignore_watch: ['node_modules', 'logs', '.git'],
// Kill timeout
kill_timeout: 5000,
// Wait for ready signal
wait_ready: false,
listen_timeout: 10000,
// Cron restart (optional)
// cron_restart: '0 3 * * *',
// Time zone
time: true,
},
],
};