From ce970bb09c8f5008198516bfcc0af2ab76c08532 Mon Sep 17 00:00:00 2001 From: Thomas Scott Date: Wed, 17 Dec 2025 12:11:29 +0000 Subject: [PATCH] Add ecosystem.config.js Signed-off-by: Thomas Scott --- ecosystem.config.js | 112 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 112 insertions(+) create mode 100644 ecosystem.config.js diff --git a/ecosystem.config.js b/ecosystem.config.js new file mode 100644 index 0000000..9167129 --- /dev/null +++ b/ecosystem.config.js @@ -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_TIMEOUT: '30000', + + // ------------------------ + // Gitea Configuration + // Base URL should NOT include /api/v1 + // ------------------------ + GITEA_API_URL: 'https://git.example.com', + GITEA_TOKEN: '', + 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, + }, + ], +}; \ No newline at end of file