Runtime environment setup
You can reproduce this deployment guide on localhost. Nevertheless this guide is a blueprint for production. All environment variables, package sources, dependencies and other settings are declared with configuration YAML files. This is the preferred approach to production settings with Ray. See Ray Production Guide. As a consequence, this guide is a lot about managing YAML files. Kodosumi simplifies the management of these configuration files by splitting the configuration into a base and multiple app configurations. This deployment is based on thecompany_news
service built in development workflow.
Let’s start with creating a root directory to host our runtime environment, i.e.
mkdir ~/kodosumi
cd kodosumi
Create a Python Virtual Environment with
python -m venv .venv # depends on OS setup
source .venv/bin/activate
The location of your system’s Python executable
python
might vary.koco start
which launches the Kodosumi spooler daemon PLUS the Kodosumi admin panel web app and API. In the current example we start the spooler and the panel seperately. We start with the spooler
koco spool
This starts the spooler in the background and as a daemon. You can review daemon status with
koco spool —status
Stop the spooler later with koco spool --stop
.
The spooler automatically creates directory ./data/config
to host Ray serve configuration files as specified with configuration parameter YAML_BASE
. The yaml base defaults to ./data/config/config.yaml
and locates the base relative to the directory where you start koco spool
and koco serve
.
Create file ./data/config/config.yaml
with Ray serve base configuration. The following yaml configuration is a good starting point. For further details read Ray’s documentation about Serve Config Files.
company_news
.
Create the first app configuration named company_news.yaml
with the following content:
./data/config/config.yaml
and adds a key application
with records from ./data/config/company_news.yaml
.
With running Ray, spooler and app we now start the Kodosumi panel and register Ray deployments
koco serve —register http://localhost:8001/-/routes
See Configure Ray Serve Deployments for additional options on your deployment. Be advised to gather some experience with Ray core components before you rollout your services. Understand remote resource requirements and how to limit concurrency to avoid OOM issues
Deployment API
The deployment API at
/deploy
and /serve
is experimental.config.yaml
.
The following Python snippets demonstrates API usage with example service kodosumi_examples.prime
.
config.yaml
before we deploy the prime
service.
GET /deploy
and an existing base configuration with GET /deploy/config
.
./data/config/config.yaml
, for example
GET /deploy/config
throws a 404 Not found
exception, then create it with for example
POST /serve
with