From ffc0d18582d2f46131c26a90bba1b618d39e69d5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20Hette=C5=A1?= Date: Wed, 6 Dec 2023 17:01:09 +0100 Subject: [PATCH 1/5] :wrench: Add github actions auto deploy config file --- .github/workflows/main.yml | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 .github/workflows/main.yml diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 0000000..564f8d6 --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,27 @@ +on: + push: + branches: + - main + workflow_dispatch: + +jobs: + deploy: + runs-on: ubuntu-latest + + steps: + - name: Install SSH keys + run: | + install -m 600 -D /dev/null ~/.ssh/id_rsa + echo "${{ secrets.SSH_PRIVATE_KEY }}" > ~/.ssh/id_rsa + ssh-keyscan -H ${{ secrets.SSH_HOST }} > ~/.ssh/known_hosts + + - name: SSH into the server, Github pull and update Docker setup + run: ssh ${{ secrets.SSH_USER }}@${{ secrets.SSH_HOST }} "cd /usr/local/team07/presentation-web/frontend && \ + git checkout main && \ + git pull && \ + docker compose down --rmi all && \ + docker compose up -d && \ + exit" + + - name: Cleanup + run: rm -rf ~/.ssh From 04750fe15c7c4d42be3770c6b8a32511186d365d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20Hette=C5=A1?= Date: Wed, 6 Dec 2023 19:11:44 +0100 Subject: [PATCH 2/5] :wrench: Update github workflow --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 564f8d6..ec458f0 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -20,7 +20,7 @@ jobs: git checkout main && \ git pull && \ docker compose down --rmi all && \ - docker compose up -d && \ + docker compose up --build -d && \ exit" - name: Cleanup From fac47c076bfb521ec4be060deb32f20355dfa2c4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20Hette=C5=A1?= Date: Thu, 7 Dec 2023 12:43:21 +0100 Subject: [PATCH 3/5] :wrench: Update github workflow --- .github/workflows/main.yml | 28 ++++++++++++---------------- 1 file changed, 12 insertions(+), 16 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index ec458f0..0d022b6 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -7,21 +7,17 @@ on: jobs: deploy: runs-on: ubuntu-latest - steps: - - name: Install SSH keys - run: | - install -m 600 -D /dev/null ~/.ssh/id_rsa - echo "${{ secrets.SSH_PRIVATE_KEY }}" > ~/.ssh/id_rsa - ssh-keyscan -H ${{ secrets.SSH_HOST }} > ~/.ssh/known_hosts - - name: SSH into the server, Github pull and update Docker setup - run: ssh ${{ secrets.SSH_USER }}@${{ secrets.SSH_HOST }} "cd /usr/local/team07/presentation-web/frontend && \ - git checkout main && \ - git pull && \ - docker compose down --rmi all && \ - docker compose up --build -d && \ - exit" - - - name: Cleanup - run: rm -rf ~/.ssh + uses: appleboy/ssh-action@v1.0.0 + with: + host: ${{ secrets.SSH_HOST }} + username: ${{ secrets.SSH_USER }} + key: ${{ secrets.SSH_PRIVATE_KEY }} + script_stop: true + script: | + cd /usr/local/team07/presentation-web/frontend + git checkout main + git pull + docker compose down --rmi all + docker compose up --build -d From 1434f6d7064e256c9f0f69db14cba81b3d2c5976 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20Hette=C5=A1?= Date: Fri, 8 Dec 2023 12:34:08 +0100 Subject: [PATCH 4/5] :wrench: Update github workflow --- .github/workflows/main.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 0d022b6..d0c96b3 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -20,4 +20,5 @@ jobs: git checkout main git pull docker compose down --rmi all - docker compose up --build -d + docker compose build --no-cache + docker compose up -d From 014f04eb12532aff14e0e41c8fe4841e0f03d6bf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20Hette=C5=A1?= Date: Fri, 8 Dec 2023 15:40:38 +0100 Subject: [PATCH 5/5] :wrench: Update auth config --- .env.example | 7 ++++--- nuxt.config.ts | 2 +- package.json | 2 +- pnpm-lock.yaml | 14 +++++++------- 4 files changed, 13 insertions(+), 12 deletions(-) diff --git a/.env.example b/.env.example index 44d3888..37af88a 100644 --- a/.env.example +++ b/.env.example @@ -1,6 +1,10 @@ # REST API configuration REST_API_URL= +# Auth configuration - required in production +AUTH_ORIGIN= +AUTH_SECRET= + # Google configuration GOOGLE_CLIENT_ID= GOOGLE_CLIENT_SECRET= @@ -8,6 +12,3 @@ GOOGLE_REFRESH_TOKEN_URL= # .NET backend runs locally on HTTPS (must be set to 0), for production must be set to 1 NODE_TLS_REJECT_UNAUTHORIZED= - -# Authorization secret -AUTH_SECRET= diff --git a/nuxt.config.ts b/nuxt.config.ts index 04b9d80..9578688 100644 --- a/nuxt.config.ts +++ b/nuxt.config.ts @@ -4,7 +4,7 @@ export default defineNuxtConfig({ devtools: { enabled: true }, auth: { enableGlobalAppMiddleware: process.env.VERCEL_ENV !== 'preview', - origin: process.env.NODE_ENV === 'production' ? 'https://frontend-tag.vercel.app' : 'http://localhost:3000', + origin: process.env.AUTH_ORIGIN ?? 'http://localhost:3000', }, runtimeConfig: { restApiUrl: process.env.REST_API_URL, diff --git a/package.json b/package.json index e01cd8d..55b59b0 100644 --- a/package.json +++ b/package.json @@ -38,7 +38,7 @@ "@nuxt/content": "^2.9.0", "copy-to-clipboard": "^3.3.3", "md-to-pdf": "^5.2.4", - "next-auth": "~4.22.5" + "next-auth": "4.21.1" }, "husky": { "hooks": { diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 17a4372..26969ae 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -15,8 +15,8 @@ dependencies: specifier: ^5.2.4 version: 5.2.4(typescript@5.2.2) next-auth: - specifier: ~4.22.5 - version: 4.22.5(next@13.5.6)(react-dom@18.2.0)(react@18.2.0) + specifier: 4.21.1 + version: 4.21.1(next@13.5.6)(react-dom@18.2.0)(react@18.2.0) devDependencies: '@bg-dev/nuxt-naiveui': @@ -48,7 +48,7 @@ devDependencies: version: 6.8.1(ts-node@10.9.1)(webpack@5.89.0) '@sidebase/nuxt-auth': specifier: ^0.5.0 - version: 0.5.0(next-auth@4.22.5) + version: 0.5.0(next-auth@4.21.1) commitlint-config-gitmoji: specifier: ^2.3.1 version: 2.3.1 @@ -2242,14 +2242,14 @@ packages: - zenObservable dev: false - /@sidebase/nuxt-auth@0.5.0(next-auth@4.22.5): + /@sidebase/nuxt-auth@0.5.0(next-auth@4.21.1): resolution: {integrity: sha512-Zq0laKbRjX3luAJrkSTYE9gkLttFO5LiWB9qq5xiYQGmtKxY9cu8sk9KeUVZ3z6shjEqHdtwM5FFCKGGvwVALA==} peerDependencies: next-auth: ^4.21.1 dependencies: '@nuxt/kit': 3.7.4 defu: 6.1.2 - next-auth: 4.22.5(next@13.5.6)(react-dom@18.2.0)(react@18.2.0) + next-auth: 4.21.1(next@13.5.6)(react-dom@18.2.0)(react@18.2.0) nitropack: 2.6.3 requrl: 3.0.2 ufo: 1.3.1 @@ -8363,8 +8363,8 @@ packages: engines: {node: '>= 0.4.0'} dev: false - /next-auth@4.22.5(next@13.5.6)(react-dom@18.2.0)(react@18.2.0): - resolution: {integrity: sha512-zPVEpqDp4cx1y0HbonCSrz2sA4qw0grTMd/S0PezUKXvDzmVemtsJnfNK/xo5pO2sz5ilM541+EVCTp9QoRLbA==} + /next-auth@4.21.1(next@13.5.6)(react-dom@18.2.0)(react@18.2.0): + resolution: {integrity: sha512-NYkU4jAPSVxWhCblE8dDFAnKM7kOoO/QEobQ0RoEVP9Wox99A3PKHwOAsWhSg8ahJG/iKIWk2Bo1xHvsS4R39Q==} peerDependencies: next: ^12.2.5 || ^13 nodemailer: ^6.6.5