No description
| action.yaml | ||
| clevermicro-kind-config.yaml | ||
| README.md | ||
| service.yaml | ||
Deploy CleverMicro Action
This Forgejo action deploys CleverMicro to a Kubernetes cluster using Kind (Kubernetes in Docker). It sets up a complete CleverMicro environment with all necessary components including KEDA for autoscaling.
Description
The action performs the following steps:
- Creates a Kubernetes cluster using Kind with custom networking configuration
- Adds required Helm chart repositories (KEDA and CleverThis)
- Installs KEDA for Kubernetes-based Event Driven Autoscaling
- Deploys CleverMicro using the Helm chart with specified image tags
- Creates additional Kubernetes resources for testing
- Waits for all pods to be ready
Inputs
| Input | Description | Required | Example |
|---|---|---|---|
registry-url |
Registry URL for pulling Docker images | ✅ | git.cleverthis.com |
registry-user |
Username for registry authentication | ✅ | deployment-user |
registry-password |
Password for registry authentication | ✅ | ${{ secrets.REGISTRY_PASSWORD }} |
amqp-router-tag |
Docker image tag for AMQP Router | ✅ | v1.0.0 |
management-service-tag |
Docker image tag for Management Service | ✅ | v1.0.0 |
client-lib-demo-tag |
Docker image tag for Client Library Demo | ✅ | v1.0.0 |
Usage
Basic Usage
name: Deploy CleverMicro
on:
push:
branches: [master]
jobs:
deploy:
runs-on: docker
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Deploy CleverMicro
uses: https://git.cleverthis.com/actions/clevermicro@master
with:
registry-url: git.cleverthis.com
registry-user: ${{ secrets.REGISTRY_USER }}
registry-password: ${{ secrets.REGISTRY_PASSWORD }}
amqp-router-tag: v1.2.3
management-service-tag: v1.2.3
client-lib-demo-tag: v1.2.3
Advanced Usage with Environment Variables
name: Deploy CleverMicro with Dynamic Tags
on:
workflow_dispatch:
inputs:
environment:
description: "Deployment environment"
required: true
default: "staging"
type: choice
options:
- staging
- production
jobs:
deploy:
runs-on: docker
environment: ${{ forge.event.inputs.environment }}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set image tags based on environment
id: tags
run: |
if [ "${{ forge.event.inputs.environment }}" == "production" ]; then
echo "tag=latest" >> $FORGEJO_OUTPUT
else
echo "tag=develop" >> $FORGEJO_OUTPUT
fi
- name: Deploy CleverMicro
uses: https://git.cleverthis.com/actions/clevermicro@master
with:
registry-url: ${{ secrets.REGISTRY_URL }}
registry-user: ${{ secrets.REGISTRY_USER }}
registry-password: ${{ secrets.REGISTRY_PASSWORD }}
amqp-router-tag: ${{ steps.tags.outputs.tag }}
management-service-tag: ${{ steps.tags.outputs.tag }}
client-lib-demo-tag: ${{ steps.tags.outputs.tag }}
Prerequisites
- Docker must be available on the runner
- kubectl must be available on the runner
- Helm must be available on the runner
- Access to the CleverThis registry and Helm repositories
Components Deployed
Core CleverMicro Components
- AMQP Router: Message routing service
- Management Service: CleverMicro management interface
- Client Library Demo: Demonstration client application
Supporting Infrastructure
- KEDA: Kubernetes Event-driven Autoscaling
- RabbitMQ: Message broker (part of CleverMicro deployment)
- Additional Services: NodePort services for external access
Network Configuration
The Kind cluster is configured with the following port mappings:
| Service | Container Port | Host Port | Description |
|---|---|---|---|
| AMQP Router HTTP | 30080 | 30080 | HTTP API endpoint |
| Management Service | 8001 | 8001 | Management interface |
| RabbitMQ AMQP | 5672 | 5672 | Message broker |
| RabbitMQ Management | 15672 | 15672 | RabbitMQ web UI |
| PostgreSQL | 5432 | 5432 | Database |
| Consul | 8500 | 8500 | Service discovery |
| Jaeger | 16686 | 16686 | Distributed tracing |
Accessing Services
After deployment, you can access the services at:
- CleverMicro AMQP Router: http://localhost:30080
- RabbitMQ Management UI: http://localhost:30672
- Management Service: http://localhost:8001
- Jaeger UI: http://localhost:16686
- Consul UI: http://localhost:8500
Troubleshooting
Common Issues
-
Registry Authentication Failure
Error: failed to authorize: failed to fetch anonymous token- Ensure
registry-userandregistry-passwordare correct - Verify the registry URL is accessible
- Ensure
-
Helm Repository Access
Error: failed to fetch https://git.cleverthis.com/api/packages/infra/helm- Check network connectivity to the registry
- Verify credentials have access to Helm repositories
-
Pod Startup Timeout
Error: timed out waiting for the condition- Check if images are available and accessible
- Verify resource limits and node capacity
- Use
kubectl logsto check pod logs
Debugging Commands
# Check cluster status
kubectl cluster-info
# Check pod status
kubectl -n clevermicro get pods
# Check pod logs
kubectl -n clevermicro logs <pod-name>
# Check services
kubectl -n clevermicro get svc
# Check KEDA installation
kubectl -n keda get pods
File Structure
.
├── action.yaml # Main action definition
├── README.md # This documentation
├── clevermicro-kind-config.yaml # Kind cluster configuration
└── service.yaml # Additional Kubernetes services
Dependencies
This action depends on:
- kubernetes action for Kind cluster setup
- KEDA Helm chart from kedacore/keda
- CleverMicro Helm chart from cleverthis/clevermicro-deployment
Additional Examples
CI/CD Pipeline with Testing
name: CleverMicro CI/CD Pipeline
on:
push:
branches: [master, develop]
pull_request:
branches: [master]
jobs:
test:
runs-on: docker
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Run unit tests
run: |
# Add your test commands here
echo "Running tests..."
deploy-staging:
needs: test
if: forge.ref == 'refs/heads/develop'
runs-on: docker
environment: staging
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Deploy to Staging
uses: https://git.cleverthis.com/actions/clevermicro@master
with:
registry-url: ${{ secrets.REGISTRY_URL }}
registry-user: ${{ secrets.REGISTRY_USER }}
registry-password: ${{ secrets.REGISTRY_PASSWORD }}
amqp-router-tag: develop
management-service-tag: develop
client-lib-demo-tag: develop
deploy-production:
needs: test
if: forge.ref == 'refs/heads/master'
runs-on: docker
environment: production
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Deploy to Production
uses: https://git.cleverthis.com/actions/clevermicro@master
with:
registry-url: ${{ secrets.REGISTRY_URL }}
registry-user: ${{ secrets.REGISTRY_USER }}
registry-password: ${{ secrets.REGISTRY_PASSWORD }}
amqp-router-tag: latest
management-service-tag: latest
client-lib-demo-tag: latest
Contributing
When contributing to this action:
- Test changes in a development environment
- Update documentation for any new inputs or behavior changes
- Ensure backward compatibility or provide migration notes
- Update version tags appropriately