diff --git a/.gitea/workflows/cd-deploy.yaml b/.gitea/workflows/cd-deploy.yaml index 66e64f1..cd5155b 100644 --- a/.gitea/workflows/cd-deploy.yaml +++ b/.gitea/workflows/cd-deploy.yaml @@ -1,6 +1,8 @@ name: Continuous Deployment on: push: + tags: + - '*' jobs: Deploy: @@ -8,20 +10,27 @@ 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: | 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@v4 + uses: actions/checkout@v5 with: fetch-depth: 0 ref: 'main' @@ -32,31 +41,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: | - 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 + - name: Update Shared Dependencies and Fix Permissions run: | - sudo -u nginx bash -c "cd /var/www/html/milsim-site-v4/shared && npm install" + cd /var/www/html/milsim-site-v4/shared + npm install + chown -R nginx:nginx . - - name: Update UI Dependencies + - name: Update UI Dependencies and Fix Permissions run: | - sudo -u nginx bash -c "cd /var/www/html/milsim-site-v4/ui && npm install" + cd /var/www/html/milsim-site-v4/ui + npm install + chown -R nginx:nginx . - - name: Update API Dependencies + - name: Update API Dependencies and Fix Permissions run: | - sudo -u nginx bash -c "cd /var/www/html/milsim-site-v4/api && npm install" + cd /var/www/html/milsim-site-v4/api + npm install + chown -R nginx:nginx . - - name: Build UI + - name: Build UI and Fix Permissions 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 + npm run build + chown -R nginx:nginx . - - name: Build API + - name: Build API and Fix Permissions 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 + 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 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 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 }); 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