Hosting Chronos - advanced examples

Summary
This is a part of Chronos tutorial series.
In this part of tutorial we cover several advanced Chronos deployment options using container images and docker compose orchestration. For the local dev enviroenment or on the Linux based server instances.
Requirenments:
- Docker runtime (building container images).
- Docker copose installed.
- Access Docker Hub (pull necesary images).
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 dev enviroenment.
This time, we will look at the docker compose examples, which we created within Chronos project, to run application with advanced configurations.
# clone the code repository from GitHub
git clone git@github.com:popularowl/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 container image
# on your machine
docker build -f Dockerfile.local -t chronos:local ..Follow the above steps to build local Chronos container image. Let's explore the options for running it.
Data stores
Its important to understand option for Chronos to store data. Chronos supports the following databases:
- SQLite (default, dev, testing)
- PostgreSQL (recomended production)
- MySQL (production alternative)
- MariaDB (production alternative)
Database usage is configured via environment variables. The default behaviour is that Chronos uses sqlite file based database. See the below enviroenment variables for instructing Cronos to use choose 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 passwordRun with docker compose
- The first
docker-compose.ymlfile in the directory showcases Chronos setup with PostgreSQL database. Chronos container image is started 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 advanced service / worker mode enabled, where 1 isntance of Chronos runs as the main service and 1 or more instances join as workers. Event queue supported by Redis database. This setup also includes PostgreSQL as datastore. - Third example
docker-compose-vectordb.ymlshows the use of Chronos running together with Qdrant vector database, and the local instance of Ollama for using embedding and text gen AI 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:11434Next steps
Once you get Chronos running and accessible, follow the other Chronos tutorial parts to start building AI agents within visual builder canvas.
Similar posts
- Which LLM evaluation framework?
- Chronos. Getting started
- Chronos AI agent builder tutotials
- n8n workflow automation. Getting started