diff --git a/.gitea/workflows/build_push.yml b/.gitea/workflows/build_push.yml new file mode 100644 index 0000000..a67c9c8 --- /dev/null +++ b/.gitea/workflows/build_push.yml @@ -0,0 +1,60 @@ +name: Build and Push Image +on: + push: + branches: + - master + +jobs: + build: + name: Build and push image + runs-on: ubuntu-latest + container: catthehacker/ubuntu:act-latest + if: gitea.ref == 'refs/heads/master' + + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Create Kubeconfig + run: | + mkdir $HOME/.kube + echo "${{ secrets.KUBEC_CONFIG_BUILDX }}" > $HOME/.kube/config + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + with: + driver: kubernetes + driver-opts: | + namespace=gitea-runner + qemu.install=true + + - name: Login to Docker Registry + uses: docker/login-action@v3 + with: + registry: git.aridgwayweb.com + username: armistace + password: ${{ secrets.REG_PASSWORD }} + + - name: Build and push + uses: docker/build-push-action@v5 + with: + context: . + push: true + platforms: linux/amd64,linux/arm64 + tags: | + git.aridgwayweb.com/armistace/mcpo:latest + + - name: Deploy + run: | + echo "Installing Kubectl" + apt-get update + apt-get install -y apt-transport-https ca-certificates curl gnupg + curl -fsSL https://pkgs.k8s.io/core:/stable:/v1.33/deb/Release.key | gpg --dearmor -o /etc/apt/keyrings/kubernetes-apt-keyring.gpg + chmod 644 /etc/apt/keyrings/kubernetes-apt-keyring.gpg + echo 'deb [signed-by=/etc/apt/keyrings/kubernetes-apt-keyring.gpg] https://pkgs.k8s.io/core:/stable:/v1.33/deb/ /' | tee /etc/apt/sources.list.d/kubernetes.list + chmod 644 /etc/apt/sources.list.d/kubernetes.list + apt-get update + apt-get install kubectl + kubectl delete namespace mcpo + kubectl create namespace mcpo + kubectl apply -f kube/pod.yaml && kubectl apply -f kube/deployment.yaml && kubectl apply -f kube/service.yaml diff --git a/.gitignore b/.gitignore index 831fce0..96d31fc 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,3 @@ .venv* +.aider* +.env diff --git a/path/to/README.md b/README.md similarity index 89% rename from path/to/README.md rename to README.md index 7628f02..89b48f2 100644 --- a/path/to/README.md +++ b/README.md @@ -1,6 +1,6 @@ -# Gitea MCP Project +# MCPO Project -This repository contains the source code, configuration files, and deployment instructions for a project that uses Docker, Kubernetes, and the `mcpo` tool to manage a Gitea MCP (Multi-Component Protocol) service. +This repository contains the source code, configuration files, and deployment instructions for a project that uses Docker, Kubernetes, and the `mcpo` tool to manage mulitiple MCP (Multi-Component Protocol) service. ## Overview @@ -13,7 +13,7 @@ The project sets up: ### Docker - **Dockerfile**: Builds a container with Python dependencies and the `mcpo` tool -- **gitea_mcp_set.sh**: Script to configure the container environment +- **gitea_mcp_set.sh**: Script to configure gitea_mcp in the container environment - **requirements.txt**: Python dependencies for any script-based components ### Kubernetes @@ -30,7 +30,7 @@ The project sets up: ## Purpose This project provides a complete environment to: -1. Run the Gitea MCP service using containerization +1. Run the mpco service using containerization 2. Orchestrate the service using Kubernetes 3. Manage configuration and authentication securely diff --git a/kube/deployment.yaml b/kube/deployment.yaml new file mode 100644 index 0000000..8d7ea18 --- /dev/null +++ b/kube/deployment.yaml @@ -0,0 +1,22 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: mcpo-deployment + labels: + app: mcpo + namespace: mcpo +spec: + replicas: 3 + selector: + matchLabels: + app: mcpo + template: + metadata: + labels: + app: mcpo + spec: + containers: + - name: mcpo + image: git.aridgwayweb.com/armistace/mcpo:latest + ports: + - containerPort: 8000 diff --git a/kube/pod.yaml b/kube/pod.yaml new file mode 100644 index 0000000..826ea44 --- /dev/null +++ b/kube/pod.yaml @@ -0,0 +1,11 @@ +apiVersion: v1 +kind: Pod +metadata: + name: mcpo + namespace: mcpo +spec: + containers: + - name: mcpo + image: git.aridgwayweb.com/armistace/mcpo:latest + ports: + - containerPort: 8000 diff --git a/kube/service.yaml b/kube/service.yaml new file mode 100644 index 0000000..e7501ed --- /dev/null +++ b/kube/service.yaml @@ -0,0 +1,13 @@ +apiVersion: v1 +kind: Service +metadata: + name: mcpo-service + namespace: mcpo +spec: + type: NodePort + selector: + app: mcpo + ports: + - port: 80 + targetPort: 8000 + nodePort: 30026