Skip to content

Base application

By following these steps you can start a bare orchestrator application that can be used to run workflows. This app runs as a standalone API with workflows loaded that can be run in the background. Similar to a Framework like FastAPI, Flask and Django, you install the core library, initialise it with configuration and run. The orchestrator-core contains:

  • API
  • Workflow engine
  • Database

Note

The Orchestrator-core is designed to be installed and extended just like a FastAPI or Flask application. For more information about how this works read the Reference documentation.

Step 1 - Install the package:

Create a virtualenv and install the core.

python -m venv .venv
source .venv/bin/activate
pip install orchestrator-core

Step 2 - Setup the database:

Create a postgres database:

createuser -sP nwa
createdb orchestrator-core -O nwa

Choose a password and remember it for later steps.

As an example, you can run these docker commands in separate shells to start a temporary postgres instance:

docker run --rm --name temp-orch-db -e POSTGRES_PASSWORD=rootpassword -p 5432:5432 postgres:15

docker exec -it temp-orch-db su - postgres -c 'createuser -sP nwa && createdb orchestrator-core -O nwa'

Step 3 - Create the main.py:

Create a main.py file.

from orchestrator import OrchestratorCore
from orchestrator.cli.main import app as core_cli
from orchestrator.settings import AppSettings

app = OrchestratorCore(base_settings=AppSettings())

if __name__ == "__main__":
    core_cli()

Step 4 - Run the database migrations:

Initialize the migration environment and database tables.

export DATABASE_URI=postgresql://nwa:PASSWORD_FROM_STEP_2@localhost:5432/orchestrator-core

python main.py db init
python main.py db upgrade heads

Step 5 - Run the app

export DATABASE_URI=postgresql://nwa:PASSWORD_FROM_STEP_2@localhost:5432/orchestrator-core
export OAUTH2_ACTIVE=False

uvicorn --reload --host 127.0.0.1 --port 8080 main:app

Step 6 - Profit 💥 😁

Visit the ReDoc or OpenAPI to view and interact with the API.