Developer Guide
Overview
This guide provides a step-by-step walkthrough to deploy the complete daksha-rc-core ecosystem using cargo make
commands. You'll set up a local Kubernetes cluster with Traefik ingress, deploy demo applications, install CloudNativePG, and finally deploy the rc-app with full health monitoring.
Prerequisites
Before starting, ensure you have the following installed:
Required Tools
Rust toolchain (version 1.86.0 or later)
Git for version control
Kind (Kubernetes in Docker)
Helm (Kubernetes package manager)
Container Engine: Docker or Podman
cargo-make - Rust task runner and build tool
kubectl - Kubernetes command-line tool
Tools for debugging
mirrord - Local development with Kubernetes environment
Required for:
cargo make debug
Quick Setup Commands
For the impatient, run these commands in sequence:
Step-by-Step Deployment
Step 1: Clone the Repository
Step 2: Install kubectl (if needed)
Expected output:
โ kubectl installation for your platform (Linux/macOS)
โ Verification that kubectl is working
Step 3: Setup Kind Cluster with Traefik
What this does:
๐๏ธ Creates a Kind Kubernetes cluster
๐ Installs Traefik ingress controller in
traefik-system
namespace๐ Generates wildcard TLS certificates for
*.127.0.0.1.nip.io
๐ฅ๏ธ Sets up Traefik dashboard
โณ Waits for all components to be ready
Expected output:
Step 4: Deploy Demo Applications
What this does:
๐ค Deploys whoami application in
whoami
namespace๐ Deploys httpbin application in
httpbin
namespace๐ Copies TLS certificates to application namespaces
โณ Waits for deployments to be ready
๐งช Tests application endpoints
Expected output:
Step 5: Install CloudNativePG
What this does:
๐ฆ Adds CloudNativePG Helm repository
๐๏ธ Installs CNPG operator in
cnpg-system
namespaceโณ Waits for operator to be ready (120s timeout)
๐ Shows CNPG status and version
Expected output:
Step 6: Deploy RC-App
What this does:
โ Validates CNPG is installed and ready
๐ Deploys rc-app using Helm chart from
k8s/rc-app
โณ Waits for deployment to be available (120s timeout)
๐งช Performs comprehensive health checks with retries
๐ Shows deployment status and resource information
Expected output:
Alternative: One-Command Full Deployment
For a complete end-to-end deployment, use:
This single command runs all the above steps in sequence:
setup-kind-cluster
deploy-demo-apps
install-cnpg
deploy-rc-app
Verification and Testing
Test All Applications
Check Cluster Status
Monitor Deployments
Database Connection Scripts
The project includes three PostgreSQL connection scripts for different use cases:
Direct Database Connection (connect-postgres.sh
)
For direct database access with an interactive psql session:
What this script does:
โ Checks CNPG operator status
๐ Finds PostgreSQL pod using label
cnpg.io/podRole=instance
๐ Extracts credentials from Kubernetes secret
dev-rc-app-database-app
๐ Establishes port forwarding to the PostgreSQL pod
๐ป Launches interactive psql session
๐งน Automatically cleans up port forwarding on exit
Example output:
Persistent Port Forwarding (portforward-postgres.sh
)
For maintaining a persistent database connection without launching psql:
What this script does:
๐ Maintains persistent port forwarding connection
๐ Monitors connection health every 10 seconds
๐ง Automatically recovers from connection failures
๐ Displays connection URLs for external tools
โณ Runs until manually stopped with Ctrl+C
Example output:
Pod Terminal Access (shell-postgres.sh
)
For direct access to the PostgreSQL pod terminal with an interactive shell:
What this script does:
โ Checks CNPG operator status
๐ Finds PostgreSQL pod using label
cnpg.io/podRole=instance
๐ฅ๏ธ Connects directly to the pod terminal with interactive bash
๐ง Provides access to all PostgreSQL tools within the pod
๐งน No port forwarding or secrets required
Example output:
Database Reset Script (database_reset.sql
)
For resetting the database to a clean state during development and testing:
What this script does:
๐๏ธ Drops all application tables:
definition
,definitions
,event
,event_listener
,event_sequence
๐ง Removes custom functions:
event_store_begin_epoch()
,event_store_current_epoch()
,notify_event_listener()
๐ Drops sequences:
event_sequence_event_id_seq
๐งน Completely cleans the database schema for fresh starts
Script contents:
When to use:
๐งช Before running integration tests
๐ When switching between different development branches
๐ When debugging database-related issues
๐ When you need a completely fresh database state
Alternative execution methods:
Use Cases
Use connect-postgres.sh
when:
You need direct SQL access for debugging
Running database migrations or admin tasks
Exploring database schema and data
One-time database operations
Use portforward-postgres.sh
when:
Connecting external database tools (pgAdmin, DBeaver, etc.)
Running applications that need database access
Long-running database connections
Development with persistent database connectivity
Use shell-postgres.sh
when:
You need direct access to the PostgreSQL server environment
Running database administration tasks (pg_dump, pg_restore)
Debugging PostgreSQL server configuration
Inspecting pod filesystem and logs
Performing manual database operations within the pod
Use database_reset.sql
when:
Starting integration tests that require a clean database
Switching between development branches with different schemas
Debugging database-related issues by resetting to a known state
Clearing test data after development sessions
Preparing for fresh application deployments
Connection URLs
Both scripts provide connection URLs in multiple formats:
Regular PostgreSQL URL:
postgresql://username:password@localhost:5432/database
JDBC URL:
jdbc:postgresql://localhost:5432/database?user=username&password=password
Individual connection details for manual configuration
These URLs can be used with:
Database management tools (pgAdmin, DBeaver, TablePlus)
Application configuration files
Development environments
CI/CD pipelines for database operations
Application Architecture
After successful deployment, you'll have:
Namespaces
traefik-system
- Traefik ingress controller and dashboardcnpg-system
- CloudNativePG operator for PostgreSQLwhoami
- Demo application showing request detailshttpbin
- HTTP testing and debugging servicedefault
- Main rc-app application
Applications
Application | URL | Purpose |
---|---|---|
RC-App | https://rc.127.0.0.1.nip.io | Main application with health endpoints |
Traefik Dashboard | https://dashboard.127.0.0.1.nip.io | Ingress controller management |
whoami | https://whoami.127.0.0.1.nip.io | Request echo service |
httpbin | https://httpbin.127.0.0.1.nip.io | HTTP testing utilities |
Health Endpoints
RC-App Health: https://rc.127.0.0.1.nip.io/healthz
RC-App Readiness: https://rc.127.0.0.1.nip.io/readyz
Troubleshooting
Common Issues
1. Kind Cluster Creation Fails
2. Traefik Not Ready
3. Applications Not Accessible
4. RC-App Health Check Fails
5. Debug Session Issues
Recovery Commands
Development Workflow
Building and Testing
Debugging with mirrord
For advanced debugging and development, you can use mirrord
to run your local application while connecting to the Kubernetes cluster environment:
What this does:
๐ Automatically discovers the rc-app pod in the cluster
โ Validates the deployment has exactly one replica
๐ Uses mirrord to mirror traffic from the Kubernetes pod to your local application
๐ Runs the application locally with debug logging (
RUST_LOG=rc_web=debug
)
Prerequisites for debugging:
mirrord must be installed: Installation Guide
RC-app must be deployed:
cargo make deploy-rc-app
Deployment should have exactly 1 replica (default configuration)
Example debug session:
Benefits of mirrord debugging:
Environment parity: Your local app runs with the same environment variables, secrets, and network access as the cluster
Real traffic: Test with actual Kubernetes traffic patterns
Database access: Connect to the same PostgreSQL database as the cluster
Service discovery: Access other services in the cluster seamlessly
Troubleshooting debug issues:
Managing the Demo Environment
Next Steps
Explore the API: Visit https://rc.127.0.0.1.nip.io/scalar for API documentation
Debug Locally: Use
cargo make debug
for local development with cluster environment using mirrordDatabase Access: Use
./scripts/connect-postgres.sh dev
for direct database accessPersistent Database Connection: Use
./scripts/portforward-postgres.sh dev
for external database toolsPod Terminal Access: Use
./scripts/shell-postgres.sh dev
for direct pod shell accessCheck Logs: Monitor application behavior with
kubectl logs
Scale Applications: Modify replica counts in Helm values
Add PostgreSQL: Use CNPG to create PostgreSQL clusters
Custom Configuration: Modify
k8s/rc-app/values.yaml
for customization
Additional Resources
Scripts Documentation: See
scripts/README.md
for detailed script informationKubernetes Manifests: Explore
k8s/manual/
for resource definitionsHelm Charts: Check
k8s/rc-app/
for application configurationBuild Configuration: Review
Makefile.toml
for available tasks
๐ Congratulations! You now have a fully functional daksha-rc-core deployment with monitoring, ingress, and database capabilities.