This commit is contained in:
@@ -1,49 +1,82 @@
|
|||||||
name: Build and Deploy
|
name: Build and Deploy
|
||||||
|
run-name: ${{ gitea.actor }} Build and Deploy 🚀
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
- main
|
- main
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build-push:
|
build-and-deploy:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout Code
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
- name: Set up QEMU
|
# -----------------------------------------------------------------
|
||||||
uses: docker/setup-qemu-action@v2
|
# CI PART
|
||||||
|
# -----------------------------------------------------------------
|
||||||
|
- name: Setup Docker Buildx
|
||||||
|
uses: docker/setup-buildx-action@v3
|
||||||
|
|
||||||
- name: Set up Docker Buildx
|
- name: Docker Login (Gitea Registry)
|
||||||
uses: docker/setup-buildx-action@v2
|
uses: docker/login-action@v3
|
||||||
|
|
||||||
- name: Login to Gitea Registry
|
|
||||||
uses: docker/login-action@v2
|
|
||||||
with:
|
with:
|
||||||
registry: ${{ vars.GITEA_REGISTRY_URL }}
|
registry: ${{ vars.GITEA_REGISTRY_URL }}
|
||||||
username: ${{ secrets.GITEA_REGISTRY_USERNAME }}
|
username: ${{ secrets.GITEA_REGISTRY_USERNAME }}
|
||||||
password: ${{ secrets.GITEA_REGISTRY_PASSWORD }}
|
password: ${{ secrets.GITEA_REGISTRY_PASSWORD }}
|
||||||
|
|
||||||
|
# BACKEND BUILD & PUSH
|
||||||
- name: Build and Push Backend
|
- name: Build and Push Backend
|
||||||
uses: docker/build-push-action@v4
|
id: docker_build_backend
|
||||||
|
uses: docker/build-push-action@v5
|
||||||
with:
|
with:
|
||||||
context: ./backend
|
context: ./backend
|
||||||
push: true
|
push: true
|
||||||
tags: ${{ vars.GITEA_REGISTRY_URL }}/${{ github.repository }}/backend:latest
|
tags: ${{ vars.GITEA_REGISTRY_URL }}/${{ github.repository }}/backend:latest
|
||||||
platforms: linux/amd64,linux/arm64
|
platforms: linux/amd64,linux/arm64
|
||||||
|
cache-from: type=gha
|
||||||
|
cache-to: type=gha,mode=max
|
||||||
|
|
||||||
|
# FRONTEND BUILD & PUSH
|
||||||
- name: Build and Push Frontend
|
- name: Build and Push Frontend
|
||||||
uses: docker/build-push-action@v4
|
id: docker_build_frontend
|
||||||
|
uses: docker/build-push-action@v5
|
||||||
with:
|
with:
|
||||||
context: ./frontend
|
context: ./frontend
|
||||||
push: true
|
push: true
|
||||||
tags: ${{ vars.GITEA_REGISTRY_URL }}/${{ github.repository }}/frontend:latest
|
tags: ${{ vars.GITEA_REGISTRY_URL }}/${{ github.repository }}/frontend:latest
|
||||||
platforms: linux/amd64,linux/arm64
|
platforms: linux/amd64,linux/arm64
|
||||||
|
cache-from: type=gha
|
||||||
|
cache-to: type=gha,mode=max
|
||||||
|
|
||||||
- name: Deploy to K3s
|
# -----------------------------------------------------------------
|
||||||
uses: actions-hub/kubectl@master
|
# CD PART
|
||||||
env:
|
# -----------------------------------------------------------------
|
||||||
KUBE_CONFIG: ${{ secrets.KUBE_CONFIG }}
|
- name: Install Kubectl Binary
|
||||||
with:
|
run: |
|
||||||
args: rollout restart deployment/evrak-backend deployment/evrak-frontend
|
curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/arm64/kubectl"
|
||||||
|
chmod +x kubectl
|
||||||
|
sudo mv kubectl /usr/local/bin/
|
||||||
|
|
||||||
|
- name: Deploy to Kubernetes and Update
|
||||||
|
run: |
|
||||||
|
# 1. Write Kubeconfig content to file
|
||||||
|
echo "${{ secrets.KUBE_CONFIG }}" > /tmp/kubeconfig.yaml
|
||||||
|
|
||||||
|
# 2. Get the new image Digests
|
||||||
|
BACKEND_DIGEST="${{ vars.GITEA_REGISTRY_URL }}/${{ github.repository }}/backend@${{ steps.docker_build_backend.outputs.digest }}"
|
||||||
|
FRONTEND_DIGEST="${{ vars.GITEA_REGISTRY_URL }}/${{ github.repository }}/frontend@${{ steps.docker_build_frontend.outputs.digest }}"
|
||||||
|
|
||||||
|
# 3. Update Deployment
|
||||||
|
kubectl set image deployment/evrak-backend backend=${BACKEND_DIGEST} \
|
||||||
|
--kubeconfig=/tmp/kubeconfig.yaml -n default
|
||||||
|
|
||||||
|
kubectl set image deployment/evrak-frontend frontend=${FRONTEND_DIGEST} \
|
||||||
|
--kubeconfig=/tmp/kubeconfig.yaml -n default
|
||||||
|
|
||||||
|
# 4. Rollout Restart to ensure fresh pods
|
||||||
|
kubectl rollout restart deployment/evrak-backend \
|
||||||
|
--kubeconfig=/tmp/kubeconfig.yaml -n default
|
||||||
|
|
||||||
|
kubectl rollout restart deployment/evrak-frontend \
|
||||||
|
--kubeconfig=/tmp/kubeconfig.yaml -n default
|
||||||
|
|||||||
111
deploy/k8s/manifests.yaml
Normal file
111
deploy/k8s/manifests.yaml
Normal file
@@ -0,0 +1,111 @@
|
|||||||
|
apiVersion: v1
|
||||||
|
kind: Service
|
||||||
|
metadata:
|
||||||
|
name: evrak-backend
|
||||||
|
namespace: default
|
||||||
|
spec:
|
||||||
|
selector:
|
||||||
|
app: evrak-backend
|
||||||
|
ports:
|
||||||
|
- protocol: TCP
|
||||||
|
port: 80
|
||||||
|
targetPort: 3000
|
||||||
|
---
|
||||||
|
apiVersion: apps/v1
|
||||||
|
kind: Deployment
|
||||||
|
metadata:
|
||||||
|
name: evrak-backend
|
||||||
|
namespace: default
|
||||||
|
spec:
|
||||||
|
replicas: 1
|
||||||
|
selector:
|
||||||
|
matchLabels:
|
||||||
|
app: evrak-backend
|
||||||
|
template:
|
||||||
|
metadata:
|
||||||
|
labels:
|
||||||
|
app: evrak-backend
|
||||||
|
spec:
|
||||||
|
containers:
|
||||||
|
- name: backend
|
||||||
|
image: git.konstantiniyye.studio/muhammed/evrak/backend:latest
|
||||||
|
ports:
|
||||||
|
- containerPort: 3000
|
||||||
|
env:
|
||||||
|
- name: DB_HOST
|
||||||
|
value: "postgres-service" # Assuming a postgres service exists or will be created
|
||||||
|
- name: DB_PORT
|
||||||
|
value: "5432"
|
||||||
|
- name: DB_USERNAME
|
||||||
|
valueFrom:
|
||||||
|
secretKeyRef:
|
||||||
|
name: evrak-db-secrets
|
||||||
|
key: username
|
||||||
|
- name: DB_PASSWORD
|
||||||
|
valueFrom:
|
||||||
|
secretKeyRef:
|
||||||
|
name: evrak-db-secrets
|
||||||
|
key: password
|
||||||
|
- name: DB_DATABASE
|
||||||
|
value: "evrak"
|
||||||
|
---
|
||||||
|
apiVersion: v1
|
||||||
|
kind: Service
|
||||||
|
metadata:
|
||||||
|
name: evrak-frontend
|
||||||
|
namespace: default
|
||||||
|
spec:
|
||||||
|
selector:
|
||||||
|
app: evrak-frontend
|
||||||
|
ports:
|
||||||
|
- protocol: TCP
|
||||||
|
port: 80
|
||||||
|
targetPort: 80
|
||||||
|
---
|
||||||
|
apiVersion: apps/v1
|
||||||
|
kind: Deployment
|
||||||
|
metadata:
|
||||||
|
name: evrak-frontend
|
||||||
|
namespace: default
|
||||||
|
spec:
|
||||||
|
replicas: 1
|
||||||
|
selector:
|
||||||
|
matchLabels:
|
||||||
|
app: evrak-frontend
|
||||||
|
template:
|
||||||
|
metadata:
|
||||||
|
labels:
|
||||||
|
app: evrak-frontend
|
||||||
|
spec:
|
||||||
|
containers:
|
||||||
|
- name: frontend
|
||||||
|
image: git.konstantiniyye.studio/muhammed/evrak/frontend:latest
|
||||||
|
ports:
|
||||||
|
- containerPort: 80
|
||||||
|
---
|
||||||
|
apiVersion: networking.k8s.io/v1
|
||||||
|
kind: Ingress
|
||||||
|
metadata:
|
||||||
|
name: evrak-ingress
|
||||||
|
namespace: default
|
||||||
|
annotations:
|
||||||
|
kubernetes.io/ingress.class: traefik # Assuming Traefik is used in K3s
|
||||||
|
spec:
|
||||||
|
rules:
|
||||||
|
- host: evrak.konstantiniyye.studio
|
||||||
|
http:
|
||||||
|
paths:
|
||||||
|
- path: /api
|
||||||
|
pathType: Prefix
|
||||||
|
backend:
|
||||||
|
service:
|
||||||
|
name: evrak-backend
|
||||||
|
port:
|
||||||
|
number: 80
|
||||||
|
- path: /
|
||||||
|
pathType: Prefix
|
||||||
|
backend:
|
||||||
|
service:
|
||||||
|
name: evrak-frontend
|
||||||
|
port:
|
||||||
|
number: 80
|
||||||
@@ -4,7 +4,7 @@ import 'reactflow/dist/style.css';
|
|||||||
import { useProjectStore } from '../store/useProjectStore';
|
import { useProjectStore } from '../store/useProjectStore';
|
||||||
|
|
||||||
const MindMap: React.FC = () => {
|
const MindMap: React.FC = () => {
|
||||||
const { projects, selectedKey } = useProjectStore();
|
const { projects } = useProjectStore();
|
||||||
|
|
||||||
// Filter nodes based on selection (e.g., show children of selected node)
|
// Filter nodes based on selection (e.g., show children of selected node)
|
||||||
// For demo, just showing all projects as nodes
|
// For demo, just showing all projects as nodes
|
||||||
|
|||||||
Reference in New Issue
Block a user