Deployment Guide

Deploy NenDB to production with confidence using industry best practices for scalability, security, and reliability.

Deployment Options

🐳

Docker Deployment

Containerized deployment for consistent environments and easy scaling.

Quick Start

# Pull the official image
docker pull nendb/nendb:latest

# Run with persistent storage
docker run -d \
  --name nendb \
  -p 3000:3000 \
  -v /data/nendb:/var/lib/nendb \
  nendb/nendb:latest

Docker Compose

version: '3.8'
services:
  nendb:
    image: nendb/nendb:latest
    ports:
      - "3000:3000"
    volumes:
      - nendb_data:/var/lib/nendb
      - ./config.toml:/etc/nendb/config.toml
    environment:
      - NENDB_LOG_LEVEL=info
    restart: unless-stopped

volumes:
  nendb_data:
☸️

Kubernetes

Orchestrated deployment with auto-scaling and high availability.

Deployment Manifest

apiVersion: apps/v1
kind: Deployment
metadata:
  name: nendb
spec:
  replicas: 3
  selector:
    matchLabels:
      app: nendb
  template:
    metadata:
      labels:
        app: nendb
    spec:
      containers:
      - name: nendb
        image: nendb/nendb:latest
        ports:
        - containerPort: 3000
        env:
        - name: NENDB_LOG_LEVEL
          value: "info"
        volumeMounts:
        - name: data
          mountPath: /var/lib/nendb
      volumes:
      - name: data
        persistentVolumeClaim:
          claimName: nendb-pvc
🌩️

Cloud Providers

One-click deployment on major cloud platforms.

AWS ECS

# Deploy using AWS CLI
aws ecs create-service \
  --cluster nendb-cluster \
  --service-name nendb \
  --task-definition nendb:1 \
  --desired-count 2

Google Cloud Run

# Deploy to Cloud Run
gcloud run deploy nendb \
  --image gcr.io/PROJECT_ID/nendb \
  --platform managed \
  --region us-central1 \
  --allow-unauthenticated
πŸ–₯️

Bare Metal

Direct installation for maximum performance and control.

System Requirements

  • β€’ Linux x86_64 or ARM64
  • β€’ 4GB RAM minimum (8GB recommended)
  • β€’ 20GB disk space
  • β€’ Network connectivity

Installation

# Download and install
curl -L https://releases.nenco.co/latest/nendb-linux-x64.tar.gz \
  | tar -xz -C /opt/

# Create systemd service
sudo cp /opt/nendb/nendb.service /etc/systemd/system/
sudo systemctl enable nendb
sudo systemctl start nendb

Production Configuration

Configuration File

Create a production-ready configuration file:

# /etc/nendb/config.toml
[server]
host = "0.0.0.0"
port = 3000
max_connections = 1000
connection_timeout = 30000

[storage]
data_dir = "/var/lib/nendb/data"
wal_dir = "/var/lib/nendb/wal"
memory_pool_size = "8GB"
batch_size = 10000

[logging]
level = "info"
file = "/var/log/nendb/nendb.log"
max_size = "100MB"
max_files = 10

[security]
tls_enabled = true
tls_cert = "/etc/ssl/certs/nendb.crt"
tls_key = "/etc/ssl/private/nendb.key"
auth_enabled = true

[monitoring]
metrics_enabled = true
metrics_port = 9090
health_check_interval = 30

Environment Variables

Core Settings

# Server configuration
NENDB_HOST=0.0.0.0
NENDB_PORT=3000
NENDB_MAX_CONNECTIONS=1000

# Storage configuration
NENDB_DATA_DIR=/var/lib/nendb/data
NENDB_MEMORY_POOL_SIZE=8GB
NENDB_BATCH_SIZE=10000

# Security
NENDB_TLS_ENABLED=true
NENDB_AUTH_ENABLED=true

# Logging
NENDB_LOG_LEVEL=info
NENDB_LOG_FILE=/var/log/nendb/nendb.log

High Availability Setup

Cluster Configuration

Set up a multi-node cluster for high availability:

# Primary node configuration
[cluster]
enabled = true
node_id = "primary"
peers = [
  "nendb-node-2:3001",
  "nendb-node-3:3001"
]
replication_factor = 3
consistency_level = "quorum"

[replication]
async_replication = false
sync_timeout = 5000
heartbeat_interval = 1000

Load Balancer Setup

Configure HAProxy for load balancing:

# HAProxy configuration
global
    daemon
    maxconn 4096

defaults
    mode tcp
    timeout connect 10s
    timeout client 30s
    timeout server 30s

frontend nendb_frontend
    bind *:3000
    default_backend nendb_cluster

backend nendb_cluster
    balance roundrobin
    option tcp-check
    server nendb1 10.0.1.10:3000 check
    server nendb2 10.0.1.11:3000 check  
    server nendb3 10.0.1.12:3000 check

Monitoring & Observability

Prometheus Metrics

Built-in metrics for monitoring performance and health:

  • β€’ nendb_operations_total - Total operations
  • β€’ nendb_query_duration - Query execution time
  • β€’ nendb_memory_usage - Memory consumption
  • β€’ nendb_connections_active - Active connections
  • β€’ nendb_batch_size_avg - Average batch size

Health Checks

Built-in health check endpoints:

  • β€’ GET /health - Basic health status
  • β€’ GET /health/ready - Readiness probe
  • β€’ GET /health/live - Liveness probe
  • β€’ GET /metrics - Prometheus metrics
  • β€’ GET /status - Detailed status info

Grafana Dashboard

Import pre-built dashboard for comprehensive monitoring:

# Download official dashboard
curl -L https://grafana.com/api/dashboards/15234/revisions/1/download \
  -o nendb-dashboard.json

# Import via Grafana UI or API
curl -X POST http://grafana:3000/api/dashboards/db \
  -H "Content-Type: application/json" \
  -d @nendb-dashboard.json

Log Aggregation

Structured logging with JSON format:

{
  "timestamp": "2024-01-15T10:30:45Z",
  "level": "info",
  "message": "Query executed successfully",
  "query_id": "q_123456",
  "duration_ms": 2.3,
  "rows_affected": 1000,
  "client_ip": "10.0.1.100"
}

Security Best Practices

πŸ”’ Essential Security Measures

  • β€’ Enable TLS encryption for all client connections
  • β€’ Use strong authentication with role-based access control
  • β€’ Configure firewall rules to restrict access to database port
  • β€’ Regularly update NenDB to latest security patches
  • β€’ Monitor access logs for suspicious activity
  • β€’ Use encrypted storage for sensitive data

πŸ›‘οΈ Network Security

  • β€’ Deploy behind a VPN or private network when possible
  • β€’ Use IP whitelisting to restrict client access
  • β€’ Implement rate limiting to prevent abuse
  • β€’ Enable DDoS protection at the network level
  • β€’ Use secrets management for sensitive configuration

πŸ“Š Backup & Recovery

  • β€’ Implement automated daily backups
  • β€’ Test backup restoration procedures regularly
  • β€’ Store backups in geographically distributed locations
  • β€’ Use point-in-time recovery for critical applications
  • β€’ Document disaster recovery procedures

Was this page helpful?