Skip to content

Orchestrator-Core

Production ready Orchestration Framework to manage product lifecyle and workflows. Easy to use, Built on top of FastAPI

Downloads Coverage Pypi



The orchestrator core is a project developed by SURF to facilitate the orchestration of services. Together with ESnet this project has been opensourced in the commons conservancy to help facilitate collaboration. We invite all who are interested to take a look and to contribute!

Orchestration

When do you orchestrate and when do you automate. The answer is you probably need both. Automation helps you execute repetetive tasks reliably and easily, Orchestration adds a layer and allows you to add more intelligence to the tasks you need to automate.

Orchestrate* - Transitive Verb

/ˈôrkəˌstrāt/ /ˈɔrkəˌstreɪt/

1: Arrange or score (music) for orchestral performance.

‘the song cycle was stunningly arranged and orchestrated’

2: Arrange or direct the elements of (a situation) to produce a desired effect, especially surreptitiously.

‘the developers were able to orchestrate a favorable media campaign’

Project Goal

This orchestrator-core provides a framework through which you can manage service orchestration for your end users. It enables you to define products to which users can subscribe, and helps you intelligently manage the lifecycle of Creation, Modification, Termination and Validation of a customer subscription.

Usage

This project can be installed as follows:

Step 1:

Install the core.

pip install orchestrator-core

Step 2:

Create a postgres database:

createuser -sP nwa
createdb orchestrator-core -O nwa

Step 3 (optional):

When using multiple workers, you will need a redis, postgres or kafka service for live updates with websockets. Redis is installed by default and for postgres or kafka you will need to install them:

pip install broadcaster[postgres]
pip install broadcaster[kafka]

For the connection you need an env variable with the connection url.

export WEBSOCKET_BROADCASTER_URL="redis://localhost:6379"

more broadcaster info here

Step 4:

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 5:

Initialize the migration environment.

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

Step 6:

Profit :)

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

Visit http://127.0.0.1:8080/api/redoc to view the api documentation.

Setting up a development environment

To add features to the repository follow the following procedure to setup a working development environment.

Installation (Development)

Install the project and its dependancies to develop on the code.

Step 1 - install flit:

mkdvirtualenv -p python3.9 orchestrator-core
workon orchestrator-core
pip install flit

Step 2 - install the development code:

flit install --deps develop --symlink

Danger

Make sure to use the flit binary that is installed in your environment. You can check the correct path by running

which flit

Running tests

Run the unit-test suite to verify a correct setup.

Step 1 - Create a database

createuser -sP nwa
createdb orchestrator-core-test -O nwa

Step 2 - Run tests

pytest test/unit_tests

If you do not encounter any failures in the test, you should be able to develop features in the orchestrator-core.