From e5d3f6b5c9f6c2f87658fa17374b98a1f3abee48 Mon Sep 17 00:00:00 2001 From: wdeus Date: Mon, 2 Dec 2024 12:29:44 -0300 Subject: [PATCH 1/6] force build --- .github/workflows/deploy.yml | 31 ------------------------------- .github/workflows/main.yml | 21 +++++++++++++++++++++ 2 files changed, 21 insertions(+), 31 deletions(-) delete mode 100644 .github/workflows/deploy.yml diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml deleted file mode 100644 index e1b39c4..0000000 --- a/.github/workflows/deploy.yml +++ /dev/null @@ -1,31 +0,0 @@ -name: Deploy to AKS Cluster - -on: - workflow_run: - workflows: ["Java CI with Maven"] - types: - - completed - -jobs: - deploy: - runs-on: ubuntu-latest - if: ${{ github.event.workflow_run.conclusion == 'success' && github.event.workflow_run.head_branch == 'main' }} - steps: - - uses: actions/checkout@v3 - - - uses: Azure/aks-set-context@v1 - with: - creds: '${{ secrets.AZURE_CREDENTIALS }}' - cluster-name: pixelCluster - resource-group: gr-pixel-containers - - - uses: Azure/k8s-deploy@v1 - with: - manifests: | - k8s/deployment.yaml - k8s/service.yaml - images: | - springapppixel.azurecr.io/backend:${{ github.sha }} - imagepullsecrets: | - k8s-secret - namespace: ingress-basic diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 6b3e7a4..09fddb2 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -74,6 +74,27 @@ jobs: run: | docker build . -t springapppixel.azurecr.io/backend:${{ github.sha }} docker push springapppixel.azurecr.io/backend:${{ github.sha }} + + # Set the target AKS cluster. + - uses: Azure/aks-set-context@v1 + with: + creds: '${{ secrets.AZURE_CREDENTIALS }}' + cluster-name: pixelCluster + resource-group: gr-pixel-containers + + - name: Update deployment image + run: | + sed -i 's||angularapp.azurecr.io/frontend:${{ github.sha }}|' k8s/deployment.yaml + - uses: Azure/k8s-deploy@v1 + with: + manifests: | + k8s/deployment.yaml + k8s/service.yaml + images: | + angularapp.azurecr.io/frontend:${{ github.sha }} + imagepullsecrets: | + k8s-secret-front + namespace: ingress-basic notifyTelegramSuccess: runs-on: ubuntu-latest From 97ebdb0d5c1ba631d11a93fb9f7dd70fec2a6ccd Mon Sep 17 00:00:00 2001 From: wdeus Date: Mon, 2 Dec 2024 12:44:18 -0300 Subject: [PATCH 2/6] force build --- .github/workflows/main.yml | 69 +++++++++++++++++++------------------- 1 file changed, 34 insertions(+), 35 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 09fddb2..1df0ff1 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -56,45 +56,44 @@ jobs: if: github.ref == 'refs/heads/main' run: mvn clean install - docker: + build-and-push-acr: + name: Build and Push to Azure Container Registry runs-on: ubuntu-latest + if: github.event_name == 'pull_request' && github.base_ref == 'main' steps: - - uses: actions/checkout@v3 - - - name: Set up Docker for Azure - uses: Azure/docker-login@v1 - with: - login-server: springapppixel.azurecr.io - username: ${{ secrets.ACR_USERNAME }} - password: ${{ secrets.ACR_PASSWORD }} - - - name: Build Docker Image and Push to Azure - if: github.ref == 'refs/heads/main' - run: | - docker build . -t springapppixel.azurecr.io/backend:${{ github.sha }} - docker push springapppixel.azurecr.io/backend:${{ github.sha }} - - # Set the target AKS cluster. - - uses: Azure/aks-set-context@v1 - with: - creds: '${{ secrets.AZURE_CREDENTIALS }}' - cluster-name: pixelCluster - resource-group: gr-pixel-containers + - uses: actions/checkout@master + + - uses: Azure/docker-login@v1 + with: + login-server: springapppixel.azurecr.io + username: ${{ secrets.ACR_USERNAME }} + password: ${{ secrets.ACR_PASSWORD }} + + - run: | + docker build . -t springapppixel.azurecr.io/backend:${{ github.sha }} + docker push springapppixel.azurecr.io/backend:${{ github.sha }} - - name: Update deployment image - run: | - sed -i 's||angularapp.azurecr.io/frontend:${{ github.sha }}|' k8s/deployment.yaml - - uses: Azure/k8s-deploy@v1 - with: - manifests: | - k8s/deployment.yaml - k8s/service.yaml - images: | - angularapp.azurecr.io/frontend:${{ github.sha }} - imagepullsecrets: | - k8s-secret-front - namespace: ingress-basic + # Set the target AKS cluster. + - uses: Azure/aks-set-context@v1 + with: + creds: '${{ secrets.AZURE_CREDENTIALS }}' + cluster-name: pixelCluster + resource-group: gr-pixel-containers + + - name: Update deployment image + run: | + sed -i 's||springapppixel.azurecr.io/backend:${{ github.sha }}|' k8s/deployment.yaml + - uses: Azure/k8s-deploy@v1 + with: + manifests: | + k8s/deployment.yaml + k8s/service.yaml + images: | + springapppixel.azurecr.io/backend:${{ github.sha }} + imagepullsecrets: | + k8s-secret-front + namespace: ingress-basic notifyTelegramSuccess: runs-on: ubuntu-latest From fb54659d9396cbda0386f5912dbfb5a038f0fff4 Mon Sep 17 00:00:00 2001 From: wdeus Date: Mon, 2 Dec 2024 12:45:28 -0300 Subject: [PATCH 3/6] corrige action --- .github/workflows/main.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 1df0ff1..dd17e52 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -97,7 +97,7 @@ jobs: notifyTelegramSuccess: runs-on: ubuntu-latest - needs: [build, test, docker] + needs: [build, test, build-and-push-acr] if: success() steps: - name: Send Telegram Notification (Success) @@ -113,7 +113,7 @@ jobs: notifyTelegramFailure: runs-on: ubuntu-latest - needs: [build, test, docker] + needs: [build, test, build-and-push-acr] if: failure() steps: - name: Send Telegram Notification (Failure) From bb339092facb5b233403d737eb63a2e4b5b63011 Mon Sep 17 00:00:00 2001 From: wdeus Date: Mon, 2 Dec 2024 13:46:26 -0300 Subject: [PATCH 4/6] modifica quantidade de replicas --- k8s/deployment.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/k8s/deployment.yaml b/k8s/deployment.yaml index a50f4c2..de8b589 100644 --- a/k8s/deployment.yaml +++ b/k8s/deployment.yaml @@ -4,7 +4,7 @@ metadata: name: api namespace: ingress-basic spec: - replicas: 2 + replicas: 1 selector: matchLabels: app: api From e3b4f7d50d987771ba8083e8d5fdf5fb4efb1126 Mon Sep 17 00:00:00 2001 From: wdeus Date: Mon, 2 Dec 2024 13:56:02 -0300 Subject: [PATCH 5/6] alterando secret --- .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 dd17e52..88d5803 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -92,7 +92,7 @@ jobs: images: | springapppixel.azurecr.io/backend:${{ github.sha }} imagepullsecrets: | - k8s-secret-front + k8s-secret namespace: ingress-basic notifyTelegramSuccess: From e1bbddb59e42b3a5cef10aabf66dd744d88183fe Mon Sep 17 00:00:00 2001 From: wdeus Date: Mon, 2 Dec 2024 15:27:49 -0300 Subject: [PATCH 6/6] =?UTF-8?q?corrige=20endere=C3=A7o=20do=20banco?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/resources/application.properties | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties index f3572c1..df7e966 100644 --- a/src/main/resources/application.properties +++ b/src/main/resources/application.properties @@ -1,12 +1,11 @@ spring.application.name=pixel -spring.datasource.url=jdbc:postgresql://localhost:5432/dash -spring.datasource.username=admin -spring.datasource.password=admin +spring.datasource.url=jdbc:postgresql://bd-pixel.postgres.database.azure.com:5432/postgres +spring.datasource.username=pixel +spring.datasource.password=NeymarJr2024 spring.datasource.driver-class-name=org.postgresql.Driver - -spring.flyway.enabled=true +spring.flyway.enabled=false spring.flyway.locations=classpath:bd/migration spring.jpa.open-in-view=false