Sign inSign up

znittzel/oatdb

By znittzel

•Updated 9 months ago

High-performance PLDAG constraint database. All-in-one image for logic constraint satisfaction.

Image
Databases & storage
0

1.4K

znittzel/oatdb repository overview

⁠Oat DB - Logic Constraint Database

Docker Pulls Docker Image Size License

Oat DB is a high-performance PLDAG (Propositional Logic Directed Acyclic Graph) API database that provides constraint satisfaction solving, graph-based logical operations, and property management.

Perfect for:

  • 🧩 Constraint satisfaction problems (CSP)
  • 🎯 Optimization with multiple objectives
  • 📊 Graph-based data modeling with properties
  • 🔗 Dependency resolution and conflict detection
  • ⚡ High-performance logical inference

⁠🚀 Quick Start

This is an all-in-one Docker image - no external dependencies needed!

# Start your own solver api or use pull & run the following
docker run -d --name rust-glpk-api -p 9000:9000 ourstudio/rust-glpk-api

# Pull and run in one command
docker run --name oat-db -p 7061:7061 -e SOLVER_API_URL=http://localhost:9000 -d znittzel/oatdb:latest

# Verify it's running
curl http://localhost:7061/health
# {"status":"healthy"}

That's it! The API is now available at http://localhost:7061

⁠What's Included

This single container includes everything:

  • ✅ Oat DB API Server - REST API for constraint solving
  • ✅ Supervisord - Process management for all services

⁠📖 API Documentation

Once running, visit the interactive API documentation:

http://localhost:7061/docs
⁠Quick Example

Create a constraint and solve:

# Create a new constraint node
curl -X POST http://localhost:7061/call \
  -H "Content-Type: application/json" \
  -d '{
  "calls": [
    {
      "fn": "set_and",
      "args": {
        "references": ["x", "y", "z"]
      },
      "out": "constraint_ids"
    }
  ],
  "outputs": [
    "constraint_ids"
  ]
}'

# Response: {"id": "abc123..."}

⁠💾 Data Persistence

By default, data is ephemeral. To persist data across container restarts:

docker run --name oat-db -p 7061:7061 \
  -v oat-data:/data \
  -d znittzel/oatdb:latest

All data (Redis + PostgreSQL) is stored in the oat-data volume.

⁠⚙️ Configuration

Configure using environment variables:

docker run --name oat-db -p 7061:7061 \
  -e LOG_LEVEL=debug \
  -e LOG_FORMAT=json \
  -e POSTGRES_PASSWORD=my_secure_password \
  -v oat-data:/data \
  -d znittzel/oatdb:latest
⁠Available Environment Variables
VariableDefaultDescription
PORT7061API server port
LOG_LEVELinfoLog level: error, warn, info, debug, trace
LOG_FORMATcompactLog format: compact, pretty, json
POSTGRES_PASSWORDoat_passwordPostgreSQL password
REDIS_PREFIXpldag:Prefix for Redis keys

Note: REDIS_URL and PG_URL are pre-configured for internal services.

⁠🔍 Health Check

The container includes a health check endpoint:

curl http://localhost:7061/health

⁠🛠️ Troubleshooting

⁠View Logs
docker logs -f oat-db
⁠Check Service Status
docker exec oat-db supervisorctl status
⁠Test PostgreSQL Connection
docker exec -it oat-db /usr/local/bin/test-postgres.sh
⁠Enter Container
docker exec -it oat-db bash

⁠💼 Production Use

For production deployments:

  1. Change the default PostgreSQL password:

    docker run ... -e POSTGRES_PASSWORD=your_secure_password ...
    
  2. Use structured logging:

    docker run ... -e LOG_FORMAT=json ...
    
  3. Set resource limits:

    docker run --memory=2g --cpus=2 ...
    
  4. Use a reverse proxy (nginx, Caddy, Traefik) for SSL/TLS

  5. Regular backups of the /data volume

⁠📦 Backup & Restore

⁠Backup
# Create backup
docker exec oat-db tar czf /tmp/backup.tar.gz /data
docker cp oat-db:/tmp/backup.tar.gz ./oat-backup-$(date +%Y%m%d).tar.gz
⁠Restore
# Stop container
docker stop oat-db

# Restore data
docker run --rm \
  -v oat-data:/data \
  -v $(pwd):/backup \
  ubuntu tar xzf /backup/oat-backup-20240101.tar.gz -C /

# Start container
docker start oat-db

⁠🏷️ Available Tags

  • latest - Latest stable release
  • 0.2.0 - Specific version
  • 0.1.0 - Previous version

⁠🔧 Technical Details

  • Base Image: Debian Bookworm Slim
  • Image Size: ~450MB (compressed)
  • Architecture: linux/amd64, linux/arm64 (multi-arch)
  • Exposed Ports: 7061 (HTTP API)
  • Internal Services:
    • PostgreSQL: localhost:5432
    • Redis: localhost:6379

⁠📄 License

Licensed under either of:

  • MIT License
  • Apache License, Version 2.0

⁠🆘 Support

If you encounter issues:

  1. Check the troubleshooting guide⁠
  2. Run the diagnostic script: docker exec -it oat-db /usr/local/bin/test-postgres.sh
  3. Open an issue⁠ with logs

Built with Rust 🦀 • Powered by PostgreSQL, Redis & GLPK

Tag summary

Content type

Image

Digest

sha256:e805c9007…

Size

160.7 MB

Last updated

9 months ago

docker pull znittzel/oatdb