diff options
author | IRONM00N <64110067+IRONM00N@users.noreply.github.com> | 2022-02-23 18:02:08 +0000 |
---|---|---|
committer | IRONM00N <64110067+IRONM00N@users.noreply.github.com> | 2022-02-23 18:02:08 +0000 |
commit | 333b521d381385786d70bbd54cf2a9ba54b6a6f9 (patch) | |
tree | bf93a36fa4a0c5795a8b7f4c5344a934d6f239e1 | |
parent | f395ceeabf63ae8972f360cd72f4a14cbaba36b6 (diff) | |
download | tanzanite-333b521d381385786d70bbd54cf2a9ba54b6a6f9.tar.gz tanzanite-333b521d381385786d70bbd54cf2a9ba54b6a6f9.tar.bz2 tanzanite-333b521d381385786d70bbd54cf2a9ba54b6a6f9.zip |
feat: overcomplicate ecosystem.config
-rw-r--r-- | ecosystem.config.cjs | 53 |
1 files changed, 20 insertions, 33 deletions
diff --git a/ecosystem.config.cjs b/ecosystem.config.cjs index 656d30d..b064f76 100644 --- a/ecosystem.config.cjs +++ b/ecosystem.config.cjs @@ -1,48 +1,35 @@ /* eslint-disable import/no-commonjs */ module.exports = { apps: [ - { - name: 'bush-bot', + ...['', '-beta'].map((e) => ({ + name: `bush-bot${e}`, script: 'yarn', args: 'start:raw', - out_file: '../bushbot.log', - error_file: '../bushbot.log', + out_file: `../bushbot${e}.log`, + error_file: `../bushbot${e}.log`, max_memory_restart: '1G', node_args: ['--max_old_space_size=2048'], env: { FORCE_COLOR: '3' }, exp_backoff_restart_delay: 2500, wait_ready: true - }, - { - name: 'bush-bot-beta', - script: 'yarn', - args: 'start:raw', - out_file: '../bushbot-beta.log', - error_file: '../bushbot-beta.log', - max_memory_restart: '1G', - node_args: ['--max_old_space_size=2048'], - env: { FORCE_COLOR: '3' }, - exp_backoff_restart_delay: 2500, - wait_ready: true - } + })) ], deploy: { - production: { - 'user': 'pi', - 'host': '192.168.1.210', - 'ref': 'origin/master', - 'repo': 'https://github.com/NotEnoughUpdates/bush-bot.git', - 'path': '/code/bush-bot', - 'post-deploy': 'yarn install && yarn build:tsc && pm2 start ecosystem.config.cjs --only bush-bot' - }, - beta: { - 'user': 'pi', - 'host': '192.168.1.210', - 'ref': 'origin/beta', - 'repo': 'https://github.com/NotEnoughUpdates/bush-bot.git', - 'path': '/code/bush-bot-beta', - 'post-deploy': 'yarn install && yarn build:tsc && pm2 start ecosystem.config.cjs --only bush-bot-beta' - } + ...Object.fromEntries( + ['production', 'beta'].map((e) => [ + e, + { + 'user': 'pi', + 'host': '192.168.1.210', + 'ref': `origin/${e === 'production' ? 'master' : 'beta'}`, + 'repo': 'https://github.com/NotEnoughUpdates/bush-bot.git', + 'path': `/code/bush-bot${e === 'beta' ? '-beta' : ''}`, + 'post-deploy': `yarn install && yarn build:tsc && pm2 start ecosystem.config.cjs --only bush-bot${ + e === 'beta' ? '-beta' : '' + }` + } + ]) + ) } }; |