diff --git a/.github/workflows/build-deploy-k8s-dev-hetzner.yml b/.github/workflows/build-deploy-k8s-dev-hetzner.yml new file mode 100644 index 0000000..8858a48 --- /dev/null +++ b/.github/workflows/build-deploy-k8s-dev-hetzner.yml @@ -0,0 +1,59 @@ +name: Build & Deploy to Dev on Hetzner + +on: + push: + branches: [develop] + +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: "Checkout GitHub Action" + uses: actions/checkout@v4.1.7 + + - name: "Login into ACR" + uses: azure/docker-login@v2 + with: + login-server: ${{ secrets.REGISTRY_LOGIN_SERVER }} + username: ${{ secrets.REGISTRY_USERNAME }} + password: ${{ secrets.REGISTRY_PASSWORD }} + + - name: "Build & Push image" + run: | + docker build -f Dockerfile . -t ${{ secrets.REGISTRY_LOGIN_SERVER }}/alkemio-matrix-adapter:${{ github.sha }} -t ${{ secrets.REGISTRY_LOGIN_SERVER }}/alkemio-matrix-adapter:latest + docker push ${{ secrets.REGISTRY_LOGIN_SERVER }}/alkemio-matrix-adapter:${{ github.sha }} + + deploy: + needs: build + runs-on: ubuntu-latest + steps: + - name: "Checkout GitHub Action" + uses: actions/checkout@v4.1.7 + + - name: Install Kubectl + uses: azure/setup-kubectl@v4.0.0 + with: + version: "v1.27.6" # Ensure this matches the version used in your cluster + + - name: Set up Kubeconfig for Hetzner k3s + run: | + mkdir -p $HOME/.kube # Ensure the .kube directory exists + echo "${{ secrets.KUBECONFIG_SECRET_HETZNER_DEV }}" > $HOME/.kube/config + chmod 600 $HOME/.kube/config + + - name: Create Image Pull Secret + run: | + kubectl create secret docker-registry alkemio-matrix-adapter-secret \ + --docker-server=${{ secrets.REGISTRY_LOGIN_SERVER }} \ + --docker-username=${{ secrets.REGISTRY_USERNAME }} \ + --docker-password=${{ secrets.REGISTRY_PASSWORD }} \ + --dry-run=client -o yaml | kubectl apply -f - + + - uses: azure/k8s-deploy@v5.0.0 + with: + manifests: | + manifests/25-matrix-adapter-deployment-dev.yaml + images: | + ${{ secrets.REGISTRY_LOGIN_SERVER }}/alkemio-matrix-adapter:${{ github.sha }} + imagepullsecrets: | + alkemio-matrix-adapter-secret diff --git a/.github/workflows/build-deploy-k8s-sandbox-hetzner.yml b/.github/workflows/build-deploy-k8s-sandbox-hetzner.yml new file mode 100644 index 0000000..50f2dd8 --- /dev/null +++ b/.github/workflows/build-deploy-k8s-sandbox-hetzner.yml @@ -0,0 +1,58 @@ +name: Build & Deploy to Sandbox on Hetzner + +on: + workflow_dispatch: + +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: "Checkout GitHub Action" + uses: actions/checkout@v4.1.7 + + - name: "Login into ACR" + uses: azure/docker-login@v2 + with: + login-server: ${{ secrets.REGISTRY_LOGIN_SERVER }} + username: ${{ secrets.REGISTRY_USERNAME }} + password: ${{ secrets.REGISTRY_PASSWORD }} + + - name: "Build & Push image" + run: | + docker build -f Dockerfile . -t ${{ secrets.REGISTRY_LOGIN_SERVER }}/alkemio-matrix-adapter:${{ github.sha }} -t ${{ secrets.REGISTRY_LOGIN_SERVER }}/alkemio-matrix-adapter:latest + docker push ${{ secrets.REGISTRY_LOGIN_SERVER }}/alkemio-matrix-adapter:${{ github.sha }} + + deploy: + needs: build + runs-on: ubuntu-latest + steps: + - name: "Checkout GitHub Action" + uses: actions/checkout@v4.1.7 + + - name: Install Kubectl + uses: azure/setup-kubectl@v4.0.0 + with: + version: "v1.27.6" # Ensure this matches the version used in your cluster + + - name: Set up Kubeconfig for Hetzner k3s + run: | + mkdir -p $HOME/.kube # Ensure the .kube directory exists + echo "${{ secrets.KUBECONFIG_SECRET_HETZNER_SANDBOX }}" > $HOME/.kube/config + chmod 600 $HOME/.kube/config + + - name: Create Image Pull Secret + run: | + kubectl create secret docker-registry alkemio-matrix-adapter-secret \ + --docker-server=${{ secrets.REGISTRY_LOGIN_SERVER }} \ + --docker-username=${{ secrets.REGISTRY_USERNAME }} \ + --docker-password=${{ secrets.REGISTRY_PASSWORD }} \ + --dry-run=client -o yaml | kubectl apply -f - + + - uses: azure/k8s-deploy@v5.0.0 + with: + manifests: | + manifests/25-matrix-adapter-deployment-dev.yaml + images: | + ${{ secrets.REGISTRY_LOGIN_SERVER }}/alkemio-matrix-adapter:${{ github.sha }} + imagepullsecrets: | + alkemio-matrix-adapter-secret diff --git a/service/message_samples/updateRoomStateForAdminRooms.ts b/service/message_samples/updateRoomStateForAdminRooms.ts index 533d63e..d143c95 100644 --- a/service/message_samples/updateRoomStateForAdminRooms.ts +++ b/service/message_samples/updateRoomStateForAdminRooms.ts @@ -12,17 +12,17 @@ const messageBody: CmdMatrixAdminEventResetAdminRoomsInput = { } } -// { -// "pattern": "updateRoomStateForAdminRooms", -// "data": { -// "adminEmail": "matrixadmin@alkem.io", -// "adminPassword": "change_me_now", -// "powerLevel": { -// "users_default": 50, -// "redact": 0 -// } -// } -// } +{ + "pattern": "updateRoomStateForAdminRooms", + "data": { + "adminEmail": "matrixadmin@alkem.io", + "adminPassword": "change_me_now", + "powerLevel": { + "users_default": 50, + "redact": 0 + } + } +} export class CmdMatrixAdminEventResetAdminRoomsInput { pattern: string;