From 68131b96ad0e2d54234af72dadfeb54c05a81554 Mon Sep 17 00:00:00 2001 From: Alexis Tyler Date: Sat, 26 Sep 2020 16:12:46 +0930 Subject: [PATCH] refactor: add sentry to staging env and fix debug --- app/mothership.ts | 2 +- dynamix.unraid.net.plg | 5 +---- ecosystem.config.js | 26 +++++++++++++++++--------- 3 files changed, 19 insertions(+), 14 deletions(-) diff --git a/app/mothership.ts b/app/mothership.ts index da25565e5..ec39a56b1 100644 --- a/app/mothership.ts +++ b/app/mothership.ts @@ -97,7 +97,7 @@ export const connectToMothership = async (wsServer: WebSocket.Server, currentRet }); relay.on('open', async () => { - log.debug(`Connected to mothership's relay.`); + log.debug(`Connected to mothership's relay via ${MOTHERSHIP_RELAY_WS_LINK}.`); // Reset retry attempts retryAttempt = 0; diff --git a/dynamix.unraid.net.plg b/dynamix.unraid.net.plg index 4a0efc70b..b334c8fdc 100644 --- a/dynamix.unraid.net.plg +++ b/dynamix.unraid.net.plg @@ -54,9 +54,6 @@ fi downloads=(graphql-api plugins) env="production" base_directory="/usr/local/bin/node" -if [[ $* == *--mode\=dev* ]]; then - env="development" -fi status() { local graphql_api_pid=$(pidof graphql-api | awk '{print $1}') if [[ $graphql_api_pid ]]; then @@ -87,7 +84,7 @@ startdebug() { stop local old_working_directory=$(echo $pwd) cd $base_directory - pm2 start $base_directory/graphql-api/ecosystem.config.js --env=debug --no-daemon + pm2 start $base_directory/graphql-api/ecosystem.config.js --env=$(echo $env)-debug --no-daemon cd $old_working_directory } stop() { diff --git a/ecosystem.config.js b/ecosystem.config.js index 95e3d0856..af90c04e8 100644 --- a/ecosystem.config.js +++ b/ecosystem.config.js @@ -1,6 +1,15 @@ /* eslint-disable camelcase */ const path = require('path'); +const staging = { + MOTHERSHIP_RELAY_WS_LINK: 'wss://staging.mothership.unraid.net/relay', + SENTRY_DSN: 'https://335a7a44d1a048648a585fc4fa053d65@o427961.ingest.sentry.io/5439629' +}; +const production = { + NODE_ENV: 'production', + PORT: '/var/run/graphql-api.sock' +} + const envs = { env_development: { PORT: 5000, @@ -14,16 +23,15 @@ const envs = { 'env_safe-mode': { NODE_ENV: 'safe-mode' }, - env_debug: { + env_staging: staging, + 'env_staging-debug': { + ...staging, + DEBUG: true, + }, + env_production: production, + 'env_production-debug': { + ...production, DEBUG: true - }, - env_staging: { - MOTHERSHIP_RELAY_WS_LINK: 'wss://staging.mothership.unraid.net/relay', - SENTRY_DSN: 'https://335a7a44d1a048648a585fc4fa053d65@o427961.ingest.sentry.io/5439629' - }, - env_production: { - NODE_ENV: 'production', - PORT: '/var/run/graphql-api.sock' } };