Merge pull request #6 from msi-se/deployment-to-cloud #2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Update services | |
on: | |
push: | |
branches: | |
- main | |
paths: | |
- 'deployement/k8s/*' | |
- '!deployement/k8s/fusionauth.yaml' | |
env: | |
ACCESS_TOKEN: ${{ secrets.ACCESS_TOKEN }} | |
ORG_NAME: ${{ secrets.ORG_NAME }} | |
REPO_NAME: ${{ secrets.REPO_NAME }} | |
jobs: | |
build-and-deploy-services: | |
runs-on: self-hosted | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Azure login | |
uses: azure/login@v1 | |
with: | |
auth-type: IDENTITY | |
client-id: ${{ secrets.AZURE_CLIENT_ID }} | |
tenant-id: ${{ secrets.AZURE_TENANT_ID }} | |
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }} | |
- name: Kubernetes secrets creation | |
continue-on-error: true | |
working-directory: deployement/k8s | |
run: | | |
az aks get-credentials --resource-group ${{ secrets.AKS_RESOURCE_GROUP_NAME }} --name ${{ secrets.KUBERNETES_CLUSTER_NAME }} | |
kubectl get nodes | |
fusionAuthURL=http://${{ secrets.FUSION_AUTH_PUBLIC_IP }}:9011 | |
internalFusionAuthURL=http://${{ secrets.FUSION_AUTH_PUBLIC_IP }}:9011 | |
appURL=http://${{ secrets.APP_IP }} | |
VITE_BACKEND_URL=http://${{ secrets.APP_IP }}/api | |
kubectl create secret generic mongodburi --from-literal=MONGODB_URI=${{ secrets.MONGODB_URI }} | |
kubectl create secret generic fusionauthurl --from-literal=fusionAuthURL=$fusionAuthURL | |
kubectl create secret generic internalfusionauthurl --from-literal=internalFusionAuthURL=$internalFusionAuthURL | |
kubectl create secret generic appurl --from-literal=appURL=$appURL | |
kubectl create secret generic vitebackendurl --from-literal=VITE_BACKEND_URL=$VITE_BACKEND_URL | |
kubectl create secret generic clientsecret --from-literal=clientSecret=${{ secrets.clientSecret }} | |
- name: Ingress creation | |
continue-on-error: true | |
working-directory: deployement/k8s | |
run: | | |
az aks get-credentials --resource-group ${{ secrets.AKS_RESOURCE_GROUP_NAME }} --name ${{ secrets.KUBERNETES_CLUSTER_NAME }} | |
kubectl get nodes | |
helm install ingress-nginx ingress-nginx/ingress-nginx \ | |
--set controller.replicaCount=1 \ | |
--set controller.nodeSelector."kubernetes\.io/os"=linux \ | |
--set defaultBackend.nodeSelector."kubernetes\.io/os"=linux \ | |
--set controller.service.externalTrafficPolicy=Local \ | |
--set controller.service.loadBalancerIP=${{ secrets.APP_IP }} | |
- name: Kubernetes deploy | |
working-directory: deployement/k8s | |
run: | | |
az aks get-credentials --resource-group ${{ secrets.AKS_RESOURCE_GROUP_NAME }} --name ${{ secrets.KUBERNETES_CLUSTER_NAME }} | |
ls | grep ".yaml$" | xargs -L 1 -d '\n' kubectl apply -f |