Skip to main content
This guide describes how to deploy Matcher in both development and production environments.

Docker compose (development)


Docker Compose is the recommended approach for local development and testing.

1. Clone the repository

git clone https://github.com/LerianStudio/matcher.git
cd matcher

2. Configure the environment

Create a local environment file:
cp config/.env.example config/.env
Update config/.env with values appropriate for your environment. Refer to Environment variables for details.

3. Start services

Start the required infrastructure services:
docker-compose up -d postgres redis rabbitmq
Wait until all services report a healthy status:
docker-compose ps
Start Matcher:
docker-compose up -d matcher
To start all services at once:
docker-compose up -d

4. Verify the installation

Confirm that Matcher is running:
curl http://localhost:8080/health
Expected response:
{
  "status": "healthy",
  "services": {
    "postgres": "healthy",
    "redis": "healthy",
    "rabbitmq": "healthy"
  }
}

Docker compose services

The default docker-compose.yml includes:
ServicePortPurpose
matcher8080Matcher API
postgres5432PostgreSQL database
redis6379Redis cache
rabbitmq5672, 15672RabbitMQ (AMQP and management UI)

Development with hot reload

For active development, use:
make dev
This starts Matcher with live reload enabled using Air.

Kubernetes / helm (production)


Production deployments should use the official Helm chart.

Prerequisites

  • Kubernetes 1.28+
  • Helm 3.12+
  • kubectl configured for the target cluster

1. Add the helm repository

helm repo add lerian https://charts.lerian.studio
helm repo update

2. Create a namespace

kubectl create namespace matcher

3. Configure values

Create a values.yaml file with your deployment configuration:
replicaCount: 2

image:
 repository: lerianstudio/matcher
 tag: "latest"
 pullPolicy: IfNotPresent

service:
 type: ClusterIP
 port: 8080

ingress:
 enabled: true
 className: nginx
 hosts:
 - host: matcher.example.com
 paths:
 - path: /
 pathType: Prefix
 tls:
 - secretName: matcher-tls
 hosts:
 - matcher.example.com

postgresql:
 external: true
 host: postgres.example.com
 port: 5432
 database: matcher
 username: matcher
 existingSecret: matcher-db-credentials
 existingSecretKey: password

redis:
 external: true
 host: redis.example.com
 port: 6379
 existingSecret: matcher-redis-credentials

rabbitmq:
 external: true
 host: rabbitmq.example.com
 port: 5672
 username: matcher
 existingSecret: matcher-rabbitmq-credentials

auth:
 enabled: true
 serviceAddress: https://auth.example.com

observability:
 enabled: true
 otelExporterEndpoint: http://otel-collector:4317

resources:
 requests:
 cpu: 500m
 memory: 512Mi
 limits:
 cpu: 2000m
 memory: 2Gi

4. Create secrets

Create Kubernetes secrets for sensitive credentials:
kubectl create secret generic matcher-db-credentials \
 --from-literal=password=your-db-password \
 -n matcher

kubectl create secret generic matcher-redis-credentials \
 --from-literal=password=your-redis-password \
 -n matcher

kubectl create secret generic matcher-rabbitmq-credentials \
 --from-literal=password=your-rabbitmq-password \
 -n matcher

5. Install the chart

helm install matcher lerian/matcher \
 --namespace matcher \
 --values values.yaml

6. Verify the deployment

kubectl get pods -n matcher
kubectl get svc -n matcher
kubectl logs -f deployment/matcher -n matcher

Upgrading

To upgrade an existing deployment:
helm repo update
helm upgrade matcher lerian/matcher \
 --namespace matcher \
 --values values.yaml

Environment variables


Matcher is configured entirely through environment variables.

Application

VariableDefaultDescription
ENV_NAMEdevelopmentRuntime environment name
LOG_LEVELinfoLog verbosity
SERVER_ADDRESS:8080HTTP server address
HTTP_BODY_LIMIT_BYTES104857600Maximum request size

Database (postgresql)

VariableDefaultDescription
POSTGRES_HOSTlocalhostDatabase host
POSTGRES_PORT5432Database port
POSTGRES_USERmatcherUsername
POSTGRES_PASSWORD-Password
POSTGRES_DBmatcherDatabase name
POSTGRES_SSLMODEdisableSSL mode
POSTGRES_MAX_OPEN_CONNS25Max open connections
POSTGRES_MAX_IDLE_CONNS10Max idle connections

Cache (redis)

VariableDefaultDescription
REDIS_HOSTlocalhost:6379Redis address
REDIS_PASSWORD-Password
REDIS_DB0Database index
REDIS_POOL_SIZE10Pool size

Messaging (rabbitmq)

VariableDefaultDescription
RABBITMQ_HOSTlocalhostBroker host
RABBITMQ_PORT5672Broker port
RABBITMQ_USERguestUsername
RABBITMQ_PASSWORDguestPassword
RABBITMQ_VHOST/Virtual host

Authentication

VariableDefaultDescription
AUTH_ENABLEDtrueEnable authentication
AUTH_SERVICE_ADDRESS-Auth service URL
DEFAULT_TENANT_ID-Default tenant ID
DEFAULT_TENANT_SLUG-Default tenant slug

Observability

VariableDefaultDescription
OTEL_ENABLEDfalseEnable OpenTelemetry
OTEL_SERVICE_NAMEmatcherTrace service name
OTEL_EXPORTER_ENDPOINT-OTLP exporter endpoint

TLS

VariableDefaultDescription
SERVER_TLS_CERT_FILE-TLS certificate path
SERVER_TLS_KEY_FILE-TLS private key path

Verify the installation


Validate that Matcher is operating correctly.

Health check

curl http://localhost:8080/health

Readiness check

curl http://localhost:8080/ready

API verification

curl -X POST http://localhost:8080/v1/contexts \
 -H "Authorization: Bearer $TOKEN" \
 -H "Content-Type: application/json" \
 -d '{
   "name": "Test Context",
   "type": "1:1"
 }'

Troubleshooting


Common issues

  • Cause: PostgreSQL is not running or unreachable.
  • Resolution:
  1. Verify PostgreSQL is running: docker-compose ps postgres
  2. Check connection values in .env
  3. Test connectivity: nc -zv localhost 5432
  4. Review logs: docker-compose logs postgres
  • Cause: Redis is not running or credentials are incorrect.
  • Resolution:
  1. Verify Redis is running: docker-compose ps redis
  2. Confirm REDIS_PASSWORD
  3. Test connectivity: redis-cli -h localhost ping
  • Cause: RabbitMQ is still initializing or the virtual host is missing.
  • Resolution:
  1. Wait until RabbitMQ is healthy
  2. Access the management UI at http://localhost:15672
  3. Verify RABBITMQ_VHOST
  • Cause: Auth service is unreachable or the token is invalid.
  • Resolution:
  1. Verify AUTH_SERVICE_ADDRESS
  2. Disable auth for development: AUTH_ENABLED=false
  3. Review auth service logs
  • Cause: Database migrations could not be applied.
  • Resolution:
  1. Check migration status: make migrate-status
  2. Review migration logs
  3. Apply migrations manually: make migrate-up
  4. Inspect the schema_migrations table if needed

Viewing logs

docker-compose logs -f matcher
kubectl logs -f deployment/matcher -n matcher

Debug mode

Enable debug logging for additional visibility:
LOG_LEVEL=debug docker-compose up matcher

Next steps