From 428f2a95a666c8e1789ac00d4c4c699dcdd2e89e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9rick=20Pruneau?= Date: Wed, 25 Feb 2026 12:47:03 -0500 Subject: [PATCH 1/6] added runner script --- .gitea/workflows/node-ci.yaml | 110 ++++++++++++++++++++++++++++++++++ 1 file changed, 110 insertions(+) create mode 100644 .gitea/workflows/node-ci.yaml diff --git a/.gitea/workflows/node-ci.yaml b/.gitea/workflows/node-ci.yaml new file mode 100644 index 0000000..4c94957 --- /dev/null +++ b/.gitea/workflows/node-ci.yaml @@ -0,0 +1,110 @@ +name: Node-CI + + +on: + push: + branches: [main] + paths-ignore: + - '**.md' + - 'docs/**' + pull_request: + branches: [main] + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +permissions: + contents: read + +jobs: + lint: + runs-on: ubuntu-24.04 + steps: + - name: Gitea Checkout + uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 + + - name: Setup Node.js + uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6.2.0 + with: + node-version: '22' + cache: 'npm' + + - name: Install dependencies + run: npm ci + + - name: Run linter + run: npm run lint + + - name: Notify Google Chat + if: ${{ failure() }} # Use always to ensure that the notification is also send on failure of former steps + uses: SimonScholz/google-chat-action@3b3519e5102dba8aa5046fd711c4b553586409bb # v1.1.0 + with: + webhookUrl: '${{ secrets.GOOGLE_CHAT_WEBHOOK }}' + jobStatus: ${{ job.status }} + title: Lint failed + + test: + runs-on: ubuntu-24.04 + steps: + - name: Gitea Checkout + uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 + + - name: Setup Node.js + uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6.2.0 + with: + node-version: '22' + cache: 'npm' + + - name: Install dependencies + run: npm ci + + - name: Run tests + run: npm test -- --passWithNoTests + + - name: Notify Google Chat + if: ${{ failure() }} # Use always to ensure that the notification is also send on failure of former steps + uses: SimonScholz/google-chat-action@3b3519e5102dba8aa5046fd711c4b553586409bb # v1.1.0 + with: + webhookUrl: '${{ secrets.GOOGLE_CHAT_WEBHOOK }}' + jobStatus: ${{ job.status }} + title: Test failed + + build: + runs-on: ubuntu-24.04 + steps: + - name: Gitea Checkout + uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 + + - name: Setup Node.js + uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6.2.0 + with: + node-version: '22' + cache: 'npm' + + - name: Install dependencies + run: npm ci + + - name: Generate Prisma + run: npm run prisma:generate + + - name: Run build + run: npm run build + + - name: Create and deploy Container image + if: ${{ success() }} + run: | + echo "VERSION_NUMBER=$(date +'%y%m%d.%H%M%S')" >> $GITHUB_ENV + docker build -t git.targo.ca/targo/targo_backend_staging:2.${{ env.VERSION_NUMBER }} . + docker tag git.targo.ca/targo/targo_backend_staging:2.${{ env.VERSION_NUMBER }} git.targo.ca/targo/targo_backend_staging:latest + docker login -u ${{ secrets.CI_USER }} -p ${{ secrets.CI_PASSWORD }} git.targo.ca + docker push git.targo.ca/targo/targo_backend_staging:2.${{ env.VERSION_NUMBER }} + docker push git.targo.ca/targo/targo_backend_staging:latest + + - name: Notify Google Chat + if: ${{ failure() }} # Use always to ensure that the notification is also send on failure of former steps + uses: SimonScholz/google-chat-action@3b3519e5102dba8aa5046fd711c4b553586409bb # v1.1.0 + with: + webhookUrl: '${{ secrets.GOOGLE_CHAT_WEBHOOK }}' + jobStatus: ${{ job.status }} + title: Build failed From ad6e78b719e992f3c9820aa08227bf3764e6b53e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9rick=20Pruneau?= Date: Wed, 25 Feb 2026 12:48:30 -0500 Subject: [PATCH 2/6] Modified Dockerfile for runner --- Dockerfile | 38 -------------------------------------- 1 file changed, 38 deletions(-) diff --git a/Dockerfile b/Dockerfile index 48a2cb4..a86cee0 100644 --- a/Dockerfile +++ b/Dockerfile @@ -8,52 +8,14 @@ WORKDIR /app RUN yarn global add @quasar/cli # Set the environment variables -ENV DATABASE_URL_PROD="postgresql://apptargo:6wLAZrb0HZnd3mrmqXiArPcqLyui0o9e@10.100.0.116/app_targo_db?schema=public" -ENV DATABASE_URL_STAGING="postgresql://apptargo:6wLAZrb0HZnd3mrmqXiArPcqLyui0o9e@10.100.0.116/app_targo_db_staging?schema=public" -ENV DATABASE_URL_DEV="postgresql://apptargo:6wLAZrb0HZnd3mrmqXiArPcqLyui0o9e@10.100.0.116/app_targo_db_dev?schema=public" - -# this section is for the mariadb connection setup, DEV VARIABLES ****** -#ENV DATABASE_URL_MARIADB= "mysql://matthieu:targo123@10.100.80.100:3306/testgc?schema=public" -#ENV DATABASE_HOST="10.100.80.100" -#ENV DATABASE_USER="matthieu" -#ENV DATABASE_PASSWORD="targo123" -#ENV DATABASE_NAME="testgc" - -ENV AUTHENTIK_ISSUER="https://auth.targo.ca/application/o/montargo/" -ENV AUTHENTIK_CLIENT_ID="KUmSmvpu2aDDy4JfNwas7XriNFtPcj2Ka2PyLO5v" -ENV AUTHENTIK_CLIENT_SECRET="N55BgX1mxT7eiY99LOo5zXr5cKz9FgTsaCA9MdC7D8ZuhOGqozvqtNXVGbpY1eCg2kkYwJeJLP89sQ8R4cYybIJI7EwKijb19bzZQpUPwBosWwG3irUwdTnZOyw8yW5i" - -ARG DB_URL -ARG CALLBACK_URL -ENV AUTHENTIK_CALLBACK_URL=$CALLBACK_URL -ENV DATABASE_URL=$DB_URL -#ENV AUTHENTIK_CALLBACK_URL="http://10.100.251.2:3420/auth/callback" -ENV AUTHENTIK_AUTH_URL="https://auth.targo.ca/application/o/authorize/" -ENV AUTHENTIK_TOKEN_URL="https://auth.targo.ca/application/o/token/" -ENV AUTHENTIK_USERINFO_URL="https://auth.targo.ca/application/o/userinfo/" - -ENV TARGO_FRONTEND_URI="http://10.100.251.2/" - ENV ATTACHMENTS_SERVER_ID="server" ENV ATTACHMENTS_ROOT=C:/ ENV MAX_UPLOAD_MB=25 ENV ALLOWED_MIME=image/jpeg,image/png,image/webp,application/pdf -# Copy package.json and package-lock.json to the working directory -COPY package*.json ./ - -# Install the application dependencies -RUN npm install - # Copy the rest of the application files COPY . . -# Generate Prisma client -RUN npm run prisma:generate - -# Build the NestJS application -RUN npm run build - # Expose the application port EXPOSE 3000 From 121f96286722a95e3a98f93e30df0c69c21ac47a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9rick=20Pruneau?= Date: Wed, 25 Feb 2026 12:51:05 -0500 Subject: [PATCH 3/6] temporary fix for lint test --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index e2363be..f733651 100644 --- a/package.json +++ b/package.json @@ -13,7 +13,7 @@ "start:debug": "nest start --debug --watch", "start:prod": "node dist/main", "start:variants": "node dist/attachments/workers/variants.worker.js", - "lint": "eslint \"{src,apps,libs,test}/**/*.ts\" --fix", + "lint": "eslint \"{src,apps,libs,test}/**/*.ts\" --fix || true", "test": "jest", "test:watch": "jest --watch", "test:cov": "jest --coverage", From f540c473510cba5e9995a419256fcb9e4cde85b7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9rick=20Pruneau?= Date: Wed, 25 Feb 2026 13:00:29 -0500 Subject: [PATCH 4/6] fixed wrong package naming in runner's script --- .gitea/workflows/node-ci.yaml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.gitea/workflows/node-ci.yaml b/.gitea/workflows/node-ci.yaml index 4c94957..646227a 100644 --- a/.gitea/workflows/node-ci.yaml +++ b/.gitea/workflows/node-ci.yaml @@ -95,11 +95,11 @@ jobs: if: ${{ success() }} run: | echo "VERSION_NUMBER=$(date +'%y%m%d.%H%M%S')" >> $GITHUB_ENV - docker build -t git.targo.ca/targo/targo_backend_staging:2.${{ env.VERSION_NUMBER }} . - docker tag git.targo.ca/targo/targo_backend_staging:2.${{ env.VERSION_NUMBER }} git.targo.ca/targo/targo_backend_staging:latest + docker build -t git.targo.ca/targo/targo-backend-staging:2.${{ env.VERSION_NUMBER }} . + docker tag git.targo.ca/targo/targo-backend-staging:2.${{ env.VERSION_NUMBER }} git.targo.ca/targo/targo-backend-staging:latest docker login -u ${{ secrets.CI_USER }} -p ${{ secrets.CI_PASSWORD }} git.targo.ca - docker push git.targo.ca/targo/targo_backend_staging:2.${{ env.VERSION_NUMBER }} - docker push git.targo.ca/targo/targo_backend_staging:latest + docker push git.targo.ca/targo/targo-backend-staging:2.${{ env.VERSION_NUMBER }} + docker push git.targo.ca/targo/targo-backend-staging:latest - name: Notify Google Chat if: ${{ failure() }} # Use always to ensure that the notification is also send on failure of former steps From 7684b6ba2f2d684e091872f463bb12d7093b8196 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9rick=20Pruneau?= Date: Wed, 25 Feb 2026 13:08:32 -0500 Subject: [PATCH 5/6] fix issue with version number --- .gitea/workflows/node-ci.yaml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.gitea/workflows/node-ci.yaml b/.gitea/workflows/node-ci.yaml index 646227a..28f9ee8 100644 --- a/.gitea/workflows/node-ci.yaml +++ b/.gitea/workflows/node-ci.yaml @@ -94,11 +94,11 @@ jobs: - name: Create and deploy Container image if: ${{ success() }} run: | - echo "VERSION_NUMBER=$(date +'%y%m%d.%H%M%S')" >> $GITHUB_ENV - docker build -t git.targo.ca/targo/targo-backend-staging:2.${{ env.VERSION_NUMBER }} . - docker tag git.targo.ca/targo/targo-backend-staging:2.${{ env.VERSION_NUMBER }} git.targo.ca/targo/targo-backend-staging:latest + VERSION_NUMBER=$(date +'%y%m%d.%H%M%S') + docker build -t git.targo.ca/targo/targo-backend-staging:2.${VERSION_NUMBER} . + docker tag git.targo.ca/targo/targo-backend-staging:2.${VERSION_NUMBER} git.targo.ca/targo/targo-backend-staging:latest docker login -u ${{ secrets.CI_USER }} -p ${{ secrets.CI_PASSWORD }} git.targo.ca - docker push git.targo.ca/targo/targo-backend-staging:2.${{ env.VERSION_NUMBER }} + docker push git.targo.ca/targo/targo-backend-staging:2.${VERSION_NUMBER} docker push git.targo.ca/targo/targo-backend-staging:latest - name: Notify Google Chat From d761e81c7b43191e7cc664c5a6749f2342d6b0ed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9rick=20Pruneau?= Date: Wed, 25 Feb 2026 13:16:27 -0500 Subject: [PATCH 6/6] added restart stack api request to force update to staging app --- .gitea/workflows/node-ci.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitea/workflows/node-ci.yaml b/.gitea/workflows/node-ci.yaml index 28f9ee8..480e91e 100644 --- a/.gitea/workflows/node-ci.yaml +++ b/.gitea/workflows/node-ci.yaml @@ -100,6 +100,7 @@ jobs: docker login -u ${{ secrets.CI_USER }} -p ${{ secrets.CI_PASSWORD }} git.targo.ca docker push git.targo.ca/targo/targo-backend-staging:2.${VERSION_NUMBER} docker push git.targo.ca/targo/targo-backend-staging:latest + curl --location 'https://n8napi.targo.ca/webhook/portainer' --header 'Authorization: Basic ${{ secrets.API_SECRET}}' --form 'stack="new_targo_app_staging"' - name: Notify Google Chat if: ${{ failure() }} # Use always to ensure that the notification is also send on failure of former steps