Blnk is a modern financial software designed for scalability and reliability. This guide outlines deployment strategies for operations of all sizes, ranging from development setups to full-scale production systems.

System architecture

Blnk operates as a distributed system with three core components:

  1. API Server: Manages incoming HTTP requests and API operations.
  2. Worker: Processes background jobs and handles asynchronous tasks.
  3. Migration Service: Oversees database schema updates and management.

Supporting Infrastructure:

  • PostgreSQL: Primary database.
  • Redis: Used for caching and message queues.
  • Typesense: Provides search functionality.
  • Jaeger (optional): Enables distributed tracing.

Deployment options

This guide covers two primary deployment strategies, each suited to different operational needs.

  1. Single server deployment:

    • Development environments
    • Small to medium-scale production deployments
    • Teams with limited operational overhead
    • Quick setup requirements
  2. Kubernetes deployment:

    • Large-scale production environments
    • High availability requirements
    • Teams with existing Kubernetes expertise
    • Systems requiring sophisticated scaling capabilities

1. Single Server Deployment

1

Prerequisites

Ensure you have the following available or installed:

  • Linux server (Ubuntu 20.04 LTS or newer recommended)
  • Docker Engine 20.10+
  • Docker Compose 2.0+
  • Managed PostgreSQL instance
  • Managed Redis instance
2

Configuration

Create or update your blnk.json configuration file:

blnk.json
{
  "project_name": "Blnk",
  "data_source": {
    "dns": "postgres://<user>:<password>@<host>:5432/blnk?sslmode=require"
  },
  "redis": {
    "dns": "redis://:<password>@<host>:6379"
  },
  "server": {
    "port": "5001",
    "ssl": false,
    "domain": "your-domain.com"
  }
}
3

Create a "docker-compose.yml" file

Copy and paste the following configuration into your file to get started. This setup includes the API server, worker, and migration services for seamless deployment.

docker-compose.yml
version: "3.8"
services:
  server:
    image: jerryenebeli/blnk:0.7.4
    restart: unless-stopped
    ports:
      - "5001:5001"
    volumes:
      - ./blnk.json:/blnk.json
    healthcheck:
      test: ["CMD", "curl", "-f", "<http://localhost:5001/health>"]
      interval: 30s
      timeout: 10s
      retries: 3

  worker:
    image: jerryenebeli/blnk:0.7.4
    restart: unless-stopped
    entrypoint: ["blnk", "workers"]
    volumes:
      - ./blnk.json:/blnk.json
    depends_on:
      - server

  migration:
    image: jerryenebeli/blnk:0.7.4
    entrypoint: ["blnk", "migrate", "up"]
    volumes:
      - ./blnk.json:/blnk.json
    restart: "no"
4

Start deployment

Run the following docker commands:

# Initialize services
docker-compose up -d

# Execute database migration
docker-compose run --rm migration

# Verify deployment status
docker-compose ps

# Monitor service logs
docker-compose logs -f

2. Kubernetes Deployment

1

Prerequisites

Ensure you have the following available or installed:

  • Kubernetes cluster 1.22+
  • kubectl configured
  • Helm 3.x installed
  • Managed database services (recommended)
2

Base configuration

Create the namespace and configuration:

namespace.yml
apiVersion: v1
kind: Namespace
metadata:
  name: blnk
config.yml
apiVersion: v1
kind: ConfigMap
metadata:
  name: blnk-config
  namespace: blnk
data:
  blnk.json: |
    {
      "project_name": "Blnk",
      "data_source": {
        "dns": "postgres://<user>:<password>@<host>:5432/blnk?sslmode=require"
      },
      "redis": {
        "dns": "redis://:<password>@<host>:6379"
      },
      "server": {
        "port": "5001"
      }
    }
3

Server deployment

server.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
  name: blnk-server
  namespace: blnk
spec:
  replicas: 2
  selector:
    matchLabels:
      app: blnk-server
  template:
    metadata:
      labels:
        app: blnk-server
    spec:
      containers:
      - name: server
        image: jerryenebeli/blnk:0.7.4
        resources:
          requests:
            memory: "512Mi"
            cpu: "250m"
          limits:
            memory: "1Gi"
            cpu: "500m"
        ports:
        - containerPort: 5001
        volumeMounts:
        - name: config
          mountPath: /blnk.json
          subPath: blnk.json
        livenessProbe:
          httpGet:
            path: /health
            port: 5001
          initialDelaySeconds: 30
          periodSeconds: 10
      volumes:
      - name: config
        configMap:
          name: blnk-config
4

Worker deployment

worker.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
  name: blnk-worker
  namespace: blnk
spec:
  replicas: 2
  template:
    metadata:
      labels:
        app: blnk-worker
    spec:
      containers:
      - name: worker
        image: jerryenebeli/blnk:0.7.4
        command: ["blnk", "workers"]
        resources:
          requests:
            memory: "512Mi"
            cpu: "250m"
          limits:
            memory: "1Gi"
            cpu: "500m"
        volumeMounts:
        - name: config
          mountPath: /blnk.json
          subPath: blnk.json
5

Migration job

migration-job.yaml
apiVersion: batch/v1
kind: Job
metadata:
  name: blnk-migration
  namespace: blnk
spec:
  template:
    spec:
      containers:
      - name: migration
        image: jerryenebeli/blnk:0.7.4
        command: ["blnk", "migrate", "up"]
        volumeMounts:
        - name: config
          mountPath: /blnk.json
          subPath: blnk.json
      restartPolicy: Never
  backoffLimit: 4
6

Start deployment process

Run the following commands:

# Apply configurations
kubectl apply -f namespace.yaml
kubectl apply -f config.yaml
kubectl apply -f server.yaml
kubectl apply -f worker.yaml

# Execute migrations
kubectl apply -f migration-job.yaml

# Monitor deployment
kubectl get pods -n blnk

Production considerations

1. Security

  1. Network Security
    • Enable SSL/TLS for all external connections
    • Implement proper network policies
    • Use secret management solutions
    • Regular security updates
  2. Access Control
    • Implement proper authentication
    • Use role-based access control
    • Regular audit of access patterns

2. Monitoring

  1. System Metrics
    • CPU utilization
    • Memory usage
    • Disk I/O
    • Network traffic
  2. Application Metrics
    • Request latency
    • Error rates
    • Queue depths
    • Processing times

3. Backup and Recovery

  1. Database Backups
    • Regular automated backups
    • Point-in-time recovery capability
    • Backup testing procedures
  2. Configuration Management
    • Version control for configurations
    • Documentation of deployment procedures
    • Disaster recovery planning

Troubleshooting guide

Here are common issues to check for if you encounter any problems during deployment:

  1. Database Connectivity
    • Verify network security groups
    • Check connection strings
    • Validate database credentials
  2. Worker Processing
    • Monitor Redis connectivity
    • Check worker logs
    • Verify queue configuration
  3. Migration Issues
    • Verify database permissions
    • Check migration logs
    • Validate schema versions

Support resources

  1. Log Analysis
    • Check application logs (docker-compose logs or kubectl logs)
    • Review system logs
    • Monitor error tracking systems
  2. Performance Issues
    • Review resource utilization
    • Check database performance
    • Monitor network latency
  3. Additional Support
    • Technical documentation
    • Community forums
    • Support channels

Need help?

We are very happy to help you make the most of Blnk, regardless of whether it is your first time or you are switching from another tool.

To ask questions or discuss issues, please contact us or join our Discord community.

Get access to Blnk Cloud.

Manage your Blnk Ledger and explore advanced features (access control & collaboration, anomaly detection, secure storage & file management, etc.) in one dashboard.