← Back to Documentation

How to Deploy and Monitor CedarDB Docker Containers

This guide walks through deploying CedarDB containers using ServerBuddy's visual interface, covering both basic deployments and production configurations.

Prerequisites

Your Linux server needs:

  • Docker or Podman installed
  • 512MB+ available RAM
  • 10GB+ free disk space

You can check Docker installation by navigating to the "Containers" tab or by running the following in the Terminal:

docker --version
# or
podman --version

Creating a CedarDB Container with GUI

Step 1: Navigate to Docker Management

  1. Connect to your server via ServerBuddy
  2. Click the "Containers" tab

Docker Containers View

Step 2: Configure Container Parameters

Click the "+ Add" button in the top right to open the container dialog:

New CedarDB Container Configuration

Basic Configuration

  • Image: cedardb/cedardb (official CedarDB image)
  • Container Name: production-cedardb (descriptive naming)
  • Command: Leave empty (uses CedarDB default entrypoint)

Port Mappings

Enter the following in the port mappings section:

  • Host Port: 5432Container Port: 5432
  • Alternative: Use 5433 on host if 5432 is occupied

Environment Variables (Critical for CedarDB)

Add these essential CedarDB environment variables:

Variable Value
CEDAR_PASSWORD YourSecurePassword123!
CEDAR_USER cedar_admin (optional, defaults to postgres)
CEDAR_DB application_db (optional)

Volume Mappings for Data Persistence

Configure persistent storage to survive container restarts:

  • Mount: cedardb-production-data (Docker volume name)
  • Container Path: /var/lib/cedardb/data

For initialization scripts (optional): - Mount: cedardb-init-scripts (Docker volume name) - Container Path: /docker-entrypoint-initdb.d

This ensures your database persists even if the container is removed.

Network Configuration

  • Choose custom network for multi-container applications
  • ServerBuddy shows available networks in a dropdown

Runtime Options

  • Restart Policy: Select "Unless Stopped" for production
  • Run in detached mode: Keeps container running in background
  • Remove on exit: Keep unchecked for databases

Step 3: Deploy the Container

Click "Create Container" to:

  1. Pull the CedarDB image if not present
  2. Create volume directories
  3. Start the container with specified configuration
  4. Display creation status

The container should be running within 15-20 seconds.

Monitoring CedarDB Container Health

Container Status Indicators

The Docker containers view displays:

Container Status Indicators

  • 🟢 Green: Running healthy
  • 🟡 Yellow: Starting/restarting
  • 🔴 Red: Stopped or errored
  • Gray: Paused

Available Container Actions

Hover over the container row to access:

  • Start/Stop/Restart controls

Checking CedarDB Performance

Container Resource Usage

You can view this by double clicking on your container entry in the containers table.

CedarDB Container Resource Monitoring

The container details view shows:

  • Memory consumption vs. limits
  • CPU usage percentage (real-time graph)
  • Network I/O rates (inbound/outbound)
  • Disk read/write operations

CedarDB Internal Metrics

Connect via the Terminal tab:

  1. Click the Terminal tab
  2. Connect to CedarDB container using PostgreSQL client

Connect with default user:

docker exec -it production-cedardb psql -U postgres

Connect with custom user:

docker exec -it production-cedardb psql -U cedar_admin

Run performance queries:

-- Database size
SELECT pg_database_size(current_database());

-- Active connections
SELECT count(*) FROM pg_stat_activity;

-- Table statistics
SELECT * FROM pg_stat_user_tables;

-- Current queries
SELECT pid, query, state FROM pg_stat_activity WHERE state != 'idle';

-- Database statistics
SELECT * FROM pg_stat_database WHERE datname = current_database();

PostgreSQL Compatibility

CedarDB is fully compatible with PostgreSQL clients, so you can connect using:

# From host machine
PGPASSWORD=YourSecurePassword123! psql -h localhost -p 5432 -U postgres

# Using standard PostgreSQL tools
pg_dump -h localhost -p 5432 -U postgres database_name > backup.sql

Log Analysis

You can view the logs for the container in the "Logs" tab by changing the log source to "Containers", and then selecting your container from the dropdown list.

The log viewer offers:

  • Filtering by log level (ERROR, WARNING)
  • Text search across logs
  • Real-time updates

Troubleshooting Connection Issues

If you can't connect to CedarDB: 1. Check port mapping in container details (default: 5432) 2. Review container logs for authentication errors 3. Verify CEDAR_PASSWORD environment variable is set 4. Confirm firewall rules allow the connection 5. Ensure PostgreSQL client is using correct authentication

Security Best Practices

  • Use strong passwords via CEDAR_PASSWORD
  • Consider using Docker secrets for sensitive data
  • Limit port exposure to specific IPs when possible
  • Use custom usernames instead of default postgres
  • Set resource limits to prevent resource exhaustion
  • Implement regular backup strategy using PostgreSQL-compatible tools
  • Enable SSL/TLS for encrypted connections

Common Issues and Solutions

Container Won't Start

  • Check logs for error messages
  • Verify port 5432 is available
  • Ensure image exists and is pulled
  • Check volume mount permissions
  • Verify CEDAR_PASSWORD is provided

Connection Refused

  • Confirm container is running
  • Verify port mapping (5432)
  • Check firewall rules
  • Review authentication credentials
  • Ensure network connectivity

Authentication Failed

  • Verify password matches CEDAR_PASSWORD
  • Check username (defaults to postgres)
  • Ensure client is using correct authentication method
  • Review container logs for specific errors

Key Takeaways

  • Always use volumes for data persistence at /var/lib/cedardb/data
  • PostgreSQL compatible: Use standard PostgreSQL tools and clients
  • Password required: Always set CEDAR_PASSWORD environment variable
  • Default port 5432: Same as PostgreSQL for compatibility
  • Configure resource limits to prevent container from consuming all system resources
  • Use restart policies for automatic recovery
  • Backup regularly using pg_dump or similar PostgreSQL tools