Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 0 additions & 31 deletions .github/workflows/deploy.yml

This file was deleted.

54 changes: 37 additions & 17 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,28 +56,48 @@ 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 }}
- 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 }}

# 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|<IMAGE_PLACEHOLDER>|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
namespace: ingress-basic

notifyTelegramSuccess:
runs-on: ubuntu-latest
needs: [build, test, docker]
needs: [build, test, build-and-push-acr]
if: success()
steps:
- name: Send Telegram Notification (Success)
Expand All @@ -93,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)
Expand Down
2 changes: 1 addition & 1 deletion k8s/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ metadata:
name: api
namespace: ingress-basic
spec:
replicas: 2
replicas: 1
selector:
matchLabels:
app: api
Expand Down
9 changes: 4 additions & 5 deletions src/main/resources/application.properties
Original file line number Diff line number Diff line change
@@ -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
Expand Down
Loading