Documentation
Adding new engines
OpenDDE’s modular architecture makes it straightforward to add new computational engines. This guide walks through the process step by step.
Overview
- Create a Docker service for the new tool
- Implement the adapter interface in the backend
- Register the service in
docker-compose.yml - Update the backend configuration to use the new engine
Step 1: Create the Docker service
Create a new directory for your engine:
mkdir services/my-engine
cd services/my-engineWrite a minimal Flask/FastAPI wrapper:
# services/my-engine/app.py
from flask import Flask, request, jsonify
app = Flask(__name__)
@app.route('/health')
def health():
return jsonify({"status": "ok"})
@app.route('/predict', methods=['POST'])
def predict():
data = request.json
# ... your prediction logic ...
return jsonify({"result": result})Create a Dockerfile:
FROM python:3.11-slim
WORKDIR /app
COPY requirements.txt .
RUN pip install -r requirements.txt
COPY . .
CMD ["python", "-m", "flask", "run", "--host=0.0.0.0", "--port=5004"]Step 2: Implement the adapter
See Engine swap layer for the adapter interface pattern. Implement the appropriate abstract class for your engine type.
Step 3: Register in Docker Compose
# docker-compose.yml
services:
my-engine:
build: ./services/my-engine
ports:
- "5004:5004"
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:5004/health"]
interval: 30s
timeout: 10s
retries: 3Step 4: Update configuration
Update the backend configuration to point to your new engine. The exact mechanism depends on which engine type you’re replacing or adding.