Summary
This is a part of Chronos tutorial series.
In this tutorial we will cover several advanced Chronos deployment and hosting options using container images and docker compose orchestration. You can use the steps for the local development enviroenment or for hosting on the Linux based server instances.
Requirenments:
- Docker copose installed.
- Docker runtime (for building and running docker container images)
- Access to pull images from Docker Hub.
Build a container image
In the previous part, we covered a quick start options to get Chronos AI agent builder up and running in your development enviroenment.
This time, we will look closer at the docker compose examples, which are provided within Chronos project. And use them to run application with advanced configurations.
# clone the code repository from the GitHub
git clone git@github.com:intelligexhq/chronos.git
cd chronos/chronos_app/docker
# list available files in the directory
ls -aFl
.
├── docker-compose-vectordb.yml
├── docker-compose-workers.yml
├── docker-compose.yml
├── Dockerfile.local
└── readme.md
# this will build a new Chronos all in one
# container image on your machine
docker build -f Dockerfile.local -t chronos:local ..
Follow the above steps to build local Chronos container image. Once you have it built, below are the advanced options of running it.
Data stores
Its important to understand the options Chronos uses to persist data. Chronos has inbuilt support for the following databases:
- SQLite (default, dev, testing)
- PostgreSQL (recomended production)
- MySQL (production alternative)
- MariaDB (production alternative)
Database selection and usage is defined via environment variables you supply to Chronos container image.
The default behaviour, if no settings are supplied, is that Chronos will use simple sqlite file based database. The below enviroenment variables can be used for instructing Cronos application to choose a different datastore.
# variables
DATABASE_TYPE # sqlite|postgres|mysql|mariadb (defaults to sqlite)
DATABASE_PATH # SQLite only: directory path
DATABASE_HOST # Host for postgres/mysql/mariadb
DATABASE_PORT # Port (5432 postgres, 3306 mysql/mariadb)
DATABASE_NAME # Database name
DATABASE_USER # Database user name
DATABASE_PASSWORD # Database user password
Run with docker compose
- The first
docker-compose.ymlfile in the directory showcases Chronos setup withPostgreSQLdatabase. Chronos container image is started together with postgresql database container image and all the necesary enviroenment variables for Chronos to start up are provided. - Second,
docker-compose-workers.ymldocker compose file has a more more advancedservice / workermode enabled. Where 1 isntance of Chronos runs as a main service and 1 or more instances join as workers via event queue supported byRedisdatabase. This setup also includes PostgreSQL as datastore. - Third example
docker-compose-vectordb.ymlshowcases the use of Chronos running together withQdrantvector database, and the local instance ofOllamafor using locally hosted LLM & SLM models.
# run simple exemaple only with PostgreSQL
docker compose -f docker-compose.yml up
# Chronos should be accessable on localhost:3001
docker compose down
# run the docker compose with multiple workers and Redis queue
docker compose -f docker-compose-workers.yml up
# scale workers to 3 instances
docker compose -f docker-compose-workers.yml up --scale chronos-worker=3
# Chronos should be accessable on localhost:3001
# If enabled BullMQ queue dashboard on localhost:3001/admin/queues
# run with Qdrant vector database and Ollama container for the local embeddings
docker compose -f docker-compose-vectordb.yml up
# use ollama container and pull the embedding model after the startup
docker compose -f docker-compose-vectordb.yml exec ollama ollama pull nomic-embed-text
# chronos is now accessible on http://localhost:3001
# configure vector store in UI: qdrant running at http://qdrant:6333
# configure embeddings in UI: ollama running at http://ollama:11434
Next steps
Once you get Chronos application running in the setup you want, follow the other Chronos tutorial parts for visually building AI agent workflows in Chronos builder canvas.