From c04a2b06cbb810ecb7901e65a6a52b8bca1d6882 Mon Sep 17 00:00:00 2001 From: ajdj100 Date: Mon, 8 Dec 2025 14:51:02 -0500 Subject: [PATCH 01/13] Fixed glitchtip disabled inversion on API --- api/src/index.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/api/src/index.js b/api/src/index.js index 68d2f1f..383b0c9 100644 --- a/api/src/index.js +++ b/api/src/index.js @@ -20,8 +20,8 @@ const port = process.env.SERVER_PORT; //glitchtip setup const sentry = require('@sentry/node'); -if (!process.env.DISABLE_GLITCHTIP) { - console.log("Glitchtip disabled AAAAAA") +if (process.env.DISABLE_GLITCHTIP) { + console.log("Glitchtip disabled") } else { let dsn = process.env.GLITCHTIP_DSN; sentry.init({ dsn: dsn }); From 2185ffc746e0439af974280b51e0b612b49753dd Mon Sep 17 00:00:00 2001 From: hizumi Date: Tue, 9 Dec 2025 14:27:42 -0600 Subject: [PATCH 02/13] Update .gitea/workflows/cd-deploy.yaml debug workflow action --- .gitea/workflows/cd-deploy.yaml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.gitea/workflows/cd-deploy.yaml b/.gitea/workflows/cd-deploy.yaml index 66e64f1..069a8e9 100644 --- a/.gitea/workflows/cd-deploy.yaml +++ b/.gitea/workflows/cd-deploy.yaml @@ -1,6 +1,8 @@ name: Continuous Deployment on: push: + branches: + - main jobs: Deploy: @@ -29,6 +31,8 @@ jobs: - name: Token Copy run: | cd /var/www/html/milsim-site-v4 + ls + file /workspace/17th-Ranger-Battalion-ORG/milsim-site-v4/.git/config cp /workspace/17th-Ranger-Battalion-ORG/milsim-site-v4/.git/config .git/config chown nginx:nginx .git/config From 1a80bfc543ff9847663d57cd7066c021313f3a3e Mon Sep 17 00:00:00 2001 From: hizumi Date: Tue, 9 Dec 2025 14:37:16 -0600 Subject: [PATCH 03/13] Update .gitea/workflows/cd-deploy.yaml continue to debug workflow --- .gitea/workflows/cd-deploy.yaml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.gitea/workflows/cd-deploy.yaml b/.gitea/workflows/cd-deploy.yaml index 069a8e9..7fe84f3 100644 --- a/.gitea/workflows/cd-deploy.yaml +++ b/.gitea/workflows/cd-deploy.yaml @@ -10,7 +10,7 @@ jobs: runs-on: ubuntu-latest container: volumes: - - /var/www/html/milsim-site-v4:/var/www/html/milsim-site-v4:rw + - /var/www/html/milsim-site-v4:/var/www/html/milsim-site-v4:z steps: - name: Setup Local Environment run: | @@ -22,6 +22,10 @@ jobs: npm -v node -v + - name: Verify Local Environment + run: | + mount + - name: Checkout uses: actions/checkout@v4 with: @@ -31,6 +35,7 @@ jobs: - name: Token Copy run: | cd /var/www/html/milsim-site-v4 + pwd ls file /workspace/17th-Ranger-Battalion-ORG/milsim-site-v4/.git/config cp /workspace/17th-Ranger-Battalion-ORG/milsim-site-v4/.git/config .git/config From dccdaddd20ab90afab9b2157b1a9c1c24bb62a37 Mon Sep 17 00:00:00 2001 From: hizumi Date: Tue, 9 Dec 2025 14:45:24 -0600 Subject: [PATCH 04/13] Update .gitea/workflows/cd-deploy.yaml another deployment attempt --- .gitea/workflows/cd-deploy.yaml | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/.gitea/workflows/cd-deploy.yaml b/.gitea/workflows/cd-deploy.yaml index 7fe84f3..d0a2537 100644 --- a/.gitea/workflows/cd-deploy.yaml +++ b/.gitea/workflows/cd-deploy.yaml @@ -19,13 +19,11 @@ jobs: - name: Verify Node Environment run: | + which npm npm -v + which node node -v - - name: Verify Local Environment - run: | - mount - - name: Checkout uses: actions/checkout@v4 with: @@ -35,9 +33,6 @@ jobs: - name: Token Copy run: | cd /var/www/html/milsim-site-v4 - pwd - ls - file /workspace/17th-Ranger-Battalion-ORG/milsim-site-v4/.git/config cp /workspace/17th-Ranger-Battalion-ORG/milsim-site-v4/.git/config .git/config chown nginx:nginx .git/config @@ -48,24 +43,31 @@ jobs: - name: Update Application Code run: | - sudo -u nginx bash -c "cd /var/www/html/milsim-site-v4 && git reset --hard && git pull origin main" + cd /var/www/html/milsim-site-v4 + sudo -u nginx git reset --hard + sudo -u nginx git pull origin main - name: Update Shared Dependencies run: | - sudo -u nginx bash -c "cd /var/www/html/milsim-site-v4/shared && npm install" + cd /var/www/html/milsim-site-v4/shared + sudo -u nginx npm install - name: Update UI Dependencies run: | - sudo -u nginx bash -c "cd /var/www/html/milsim-site-v4/ui && npm install" + cd /var/www/html/milsim-site-v4/ui + sudo -u nginx npm install - name: Update API Dependencies run: | - sudo -u nginx bash -c "cd /var/www/html/milsim-site-v4/api && npm install" + cd /var/www/html/milsim-site-v4/api + sudo -u nginx npm install - name: Build UI run: | - sudo -u nginx bash -c "cd /var/www/html/milsim-site-v4/ui && npm run build" + cd /var/www/html/milsim-site-v4/ui + sudo -u nginx npm run build - name: Build API run: | - sudo -u nginx bash -c "cd /var/www/html/milsim-site-v4/api && npm run build" + cd /var/www/html/milsim-site-v4/api + sudo -u nginx npm run build From 1f52a2c4f738e04a75b47457c0b233466122305e Mon Sep 17 00:00:00 2001 From: hizumi Date: Tue, 9 Dec 2025 14:48:19 -0600 Subject: [PATCH 05/13] Update .gitea/workflows/cd-deploy.yaml forcefully override npm path for execution --- .gitea/workflows/cd-deploy.yaml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.gitea/workflows/cd-deploy.yaml b/.gitea/workflows/cd-deploy.yaml index d0a2537..74acb0e 100644 --- a/.gitea/workflows/cd-deploy.yaml +++ b/.gitea/workflows/cd-deploy.yaml @@ -50,24 +50,24 @@ jobs: - name: Update Shared Dependencies run: | cd /var/www/html/milsim-site-v4/shared - sudo -u nginx npm install + sudo -u nginx /opt/acttoolcache/node/18.20.8/x64/bin/npm install - name: Update UI Dependencies run: | cd /var/www/html/milsim-site-v4/ui - sudo -u nginx npm install + sudo -u nginx /opt/acttoolcache/node/18.20.8/x64/bin/npm install - name: Update API Dependencies run: | cd /var/www/html/milsim-site-v4/api - sudo -u nginx npm install + sudo -u nginx /opt/acttoolcache/node/18.20.8/x64/bin/npm install - name: Build UI run: | cd /var/www/html/milsim-site-v4/ui - sudo -u nginx npm run build + sudo -u nginx /opt/acttoolcache/node/18.20.8/x64/bin/npm run build - name: Build API run: | cd /var/www/html/milsim-site-v4/api - sudo -u nginx npm run build + sudo -u nginx /opt/acttoolcache/node/18.20.8/x64/bin/npm run build From 468fd3051467ca147004d4d9e6b7a59f0e4a7c62 Mon Sep 17 00:00:00 2001 From: hizumi Date: Tue, 9 Dec 2025 14:55:40 -0600 Subject: [PATCH 06/13] Update .gitea/workflows/cd-deploy.yaml attempt to preserve existing environment to fix node issues --- .gitea/workflows/cd-deploy.yaml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.gitea/workflows/cd-deploy.yaml b/.gitea/workflows/cd-deploy.yaml index 74acb0e..4690628 100644 --- a/.gitea/workflows/cd-deploy.yaml +++ b/.gitea/workflows/cd-deploy.yaml @@ -50,24 +50,24 @@ jobs: - name: Update Shared Dependencies run: | cd /var/www/html/milsim-site-v4/shared - sudo -u nginx /opt/acttoolcache/node/18.20.8/x64/bin/npm install + sudo -u nginx -E npm install - name: Update UI Dependencies run: | cd /var/www/html/milsim-site-v4/ui - sudo -u nginx /opt/acttoolcache/node/18.20.8/x64/bin/npm install + sudo -u nginx -E npm install - name: Update API Dependencies run: | cd /var/www/html/milsim-site-v4/api - sudo -u nginx /opt/acttoolcache/node/18.20.8/x64/bin/npm install + sudo -u nginx -E npm install - name: Build UI run: | cd /var/www/html/milsim-site-v4/ui - sudo -u nginx /opt/acttoolcache/node/18.20.8/x64/bin/npm run build + sudo -u nginx -E npm run build - name: Build API run: | cd /var/www/html/milsim-site-v4/api - sudo -u nginx /opt/acttoolcache/node/18.20.8/x64/bin/npm run build + sudo -u nginx -E npm run build From 8089ee4268949abdb1ddad0917d5a762135a9ae1 Mon Sep 17 00:00:00 2001 From: hizumi Date: Tue, 9 Dec 2025 20:22:08 -0600 Subject: [PATCH 07/13] Update .gitea/workflows/cd-deploy.yaml stupidly work out permissions error due to sudo not copying environment variables properly --- .gitea/workflows/cd-deploy.yaml | 35 +++++++++++++++++++-------------- 1 file changed, 20 insertions(+), 15 deletions(-) diff --git a/.gitea/workflows/cd-deploy.yaml b/.gitea/workflows/cd-deploy.yaml index 4690628..74e84b7 100644 --- a/.gitea/workflows/cd-deploy.yaml +++ b/.gitea/workflows/cd-deploy.yaml @@ -36,38 +36,43 @@ jobs: cp /workspace/17th-Ranger-Battalion-ORG/milsim-site-v4/.git/config .git/config chown nginx:nginx .git/config - - name: Fix File Permissions - run: | - sudo chown -R nginx:nginx /var/www/html/milsim-site-v4 - sudo chmod -R u+w /var/www/html/milsim-site-v4 - - name: Update Application Code run: | cd /var/www/html/milsim-site-v4 sudo -u nginx git reset --hard sudo -u nginx git pull origin main - - name: Update Shared Dependencies + - name: Update Shared Dependencies and Fix Permissions run: | cd /var/www/html/milsim-site-v4/shared - sudo -u nginx -E npm install + npm install + chown -R nginx:nginx . - - name: Update UI Dependencies + - name: Update UI Dependencies and Fix Permissions run: | cd /var/www/html/milsim-site-v4/ui - sudo -u nginx -E npm install + npm install + chown -R nginx:nginx . - - name: Update API Dependencies + - name: Update API Dependencies and Fix Permissions run: | cd /var/www/html/milsim-site-v4/api - sudo -u nginx -E npm install + npm install + chown -R nginx:nginx . - - name: Build UI + - name: Build UI and Fix Permissions run: | cd /var/www/html/milsim-site-v4/ui - sudo -u nginx -E npm run build + npm run build + chown -R nginx:nginx . - - name: Build API + - name: Build API and Fix Permissions run: | cd /var/www/html/milsim-site-v4/api - sudo -u nginx -E npm run build + npm run build + chown -R nginx:nginx . + + - name: Reset File Permissions + run: | + sudo chown -R nginx:nginx /var/www/html/milsim-site-v4 + sudo chmod -R u+w /var/www/html/milsim-site-v4 \ No newline at end of file From ec854c6800cfdbefd9e427f8cec2af04e1b5a6bf Mon Sep 17 00:00:00 2001 From: hizumi Date: Tue, 9 Dec 2025 20:26:13 -0600 Subject: [PATCH 08/13] Update .gitea/workflows/cd-deploy.yaml update node version to 20 from built in 18 --- .gitea/workflows/cd-deploy.yaml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.gitea/workflows/cd-deploy.yaml b/.gitea/workflows/cd-deploy.yaml index 74e84b7..c077cfe 100644 --- a/.gitea/workflows/cd-deploy.yaml +++ b/.gitea/workflows/cd-deploy.yaml @@ -18,6 +18,9 @@ jobs: useradd nginx -u 990 -g nginx -m || true - name: Verify Node Environment + uses: actions/setup-node@v6 + with: + node-version: 20.19 run: | which npm npm -v @@ -25,7 +28,7 @@ jobs: node -v - name: Checkout - uses: actions/checkout@v4 + uses: actions/checkout@v5 with: fetch-depth: 0 ref: 'main' From 6d544225d99983e6eeb6bd3a15de0c5a2a0348f3 Mon Sep 17 00:00:00 2001 From: hizumi Date: Tue, 9 Dec 2025 20:31:38 -0600 Subject: [PATCH 09/13] Update .gitea/workflows/cd-deploy.yaml fix syntax --- .gitea/workflows/cd-deploy.yaml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.gitea/workflows/cd-deploy.yaml b/.gitea/workflows/cd-deploy.yaml index c077cfe..371fcc8 100644 --- a/.gitea/workflows/cd-deploy.yaml +++ b/.gitea/workflows/cd-deploy.yaml @@ -17,10 +17,12 @@ jobs: groupadd -g 989 nginx || true useradd nginx -u 990 -g nginx -m || true - - name: Verify Node Environment + - name: Update Node Environment uses: actions/setup-node@v6 with: node-version: 20.19 + + - name: Verify Node Environment run: | which npm npm -v From a95bf3318d4442df456a3a7649c0c80366a05765 Mon Sep 17 00:00:00 2001 From: hizumi Date: Tue, 9 Dec 2025 20:53:33 -0600 Subject: [PATCH 10/13] Update .gitea/workflows/cd-deploy.yaml update the CD script to only run on tags signifying a usable release --- .gitea/workflows/cd-deploy.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.gitea/workflows/cd-deploy.yaml b/.gitea/workflows/cd-deploy.yaml index 371fcc8..cd0e24c 100644 --- a/.gitea/workflows/cd-deploy.yaml +++ b/.gitea/workflows/cd-deploy.yaml @@ -3,6 +3,8 @@ on: push: branches: - main + tags: + - '*' jobs: Deploy: From 58431891ba0dcd888a4d33a6cb35afed32948dda Mon Sep 17 00:00:00 2001 From: hizumi Date: Tue, 9 Dec 2025 20:55:41 -0600 Subject: [PATCH 11/13] Update ecosystem.config.js allow automatic naming of started process based on environment --- ecosystem.config.js | 1 + 1 file changed, 1 insertion(+) diff --git a/ecosystem.config.js b/ecosystem.config.js index 68925cc..aa2c2ed 100644 --- a/ecosystem.config.js +++ b/ecosystem.config.js @@ -5,6 +5,7 @@ module.exports = { script: 'built/api/src/index.js', watch: ['.env', 'built'], ignore_watch: ['.gitignore', '\.json', 'src', '\.db', 'node_modules'], + appendEnvToName: true, watch_options: { usePolling: true, interval: 10000 From 37f204137b95bea6e3affbb4b373dba998f9642d Mon Sep 17 00:00:00 2001 From: hizumi Date: Tue, 9 Dec 2025 21:06:45 -0600 Subject: [PATCH 12/13] Update .gitea/workflows/cd-deploy.yaml fix run, apparently on push triggers are not cumulatively conditional --- .gitea/workflows/cd-deploy.yaml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.gitea/workflows/cd-deploy.yaml b/.gitea/workflows/cd-deploy.yaml index cd0e24c..cd5155b 100644 --- a/.gitea/workflows/cd-deploy.yaml +++ b/.gitea/workflows/cd-deploy.yaml @@ -1,8 +1,6 @@ name: Continuous Deployment on: push: - branches: - - main tags: - '*' From 760965de19d419ce819f44100d0e418f89a66a5f Mon Sep 17 00:00:00 2001 From: hizumi Date: Tue, 9 Dec 2025 21:11:03 -0600 Subject: [PATCH 13/13] Add .gitea/workflows/ci-deploy.yaml create CI script based on CD script to run on every push to main and deploy on development site --- .gitea/workflows/ci-deploy.yaml | 83 +++++++++++++++++++++++++++++++++ 1 file changed, 83 insertions(+) create mode 100644 .gitea/workflows/ci-deploy.yaml diff --git a/.gitea/workflows/ci-deploy.yaml b/.gitea/workflows/ci-deploy.yaml new file mode 100644 index 0000000..0858510 --- /dev/null +++ b/.gitea/workflows/ci-deploy.yaml @@ -0,0 +1,83 @@ +name: Continuous Integration +on: + push: + branches: + - main + +jobs: + Deploy: + name: Update Development + runs-on: ubuntu-latest + container: + volumes: + - /var/www/html/milsim-site-v4-dev:/var/www/html/milsim-site-v4:z + steps: + - name: Setup Local Environment + run: | + groupadd -g 989 nginx || true + useradd nginx -u 990 -g nginx -m || true + + - name: Update Node Environment + uses: actions/setup-node@v6 + with: + node-version: 20.19 + + - name: Verify Node Environment + run: | + which npm + npm -v + which node + node -v + + - name: Checkout + uses: actions/checkout@v5 + with: + fetch-depth: 0 + ref: 'main' + + - name: Token Copy + run: | + cd /var/www/html/milsim-site-v4 + cp /workspace/17th-Ranger-Battalion-ORG/milsim-site-v4/.git/config .git/config + chown nginx:nginx .git/config + + - name: Update Application Code + run: | + cd /var/www/html/milsim-site-v4 + sudo -u nginx git reset --hard + sudo -u nginx git pull origin main + + - name: Update Shared Dependencies and Fix Permissions + run: | + cd /var/www/html/milsim-site-v4/shared + npm install + chown -R nginx:nginx . + + - name: Update UI Dependencies and Fix Permissions + run: | + cd /var/www/html/milsim-site-v4/ui + npm install + chown -R nginx:nginx . + + - name: Update API Dependencies and Fix Permissions + run: | + cd /var/www/html/milsim-site-v4/api + npm install + chown -R nginx:nginx . + + - name: Build UI and Fix Permissions + run: | + cd /var/www/html/milsim-site-v4/ui + npm run build + chown -R nginx:nginx . + + - name: Build API and Fix Permissions + run: | + cd /var/www/html/milsim-site-v4/api + npm run build + chown -R nginx:nginx . + + - name: Reset File Permissions + run: | + sudo chown -R nginx:nginx /var/www/html/milsim-site-v4 + sudo chmod -R u+w /var/www/html/milsim-site-v4 \ No newline at end of file