Skip to content

starchenko.dev

Blog
All posts

A side project with a hundred repos: inside hermesproject

· 11 min read · DevOps · Kubernetes · Proxmox

Monitoring the entire crypto market by hand isn't realistic. Something unusual is always happening, and we wanted a system that would spot those movements itself. Our indicators grew out of that idea. Around them, hermesproject gradually took shape: market data services, an app, build pipelines and our own Kubernetes cluster.

It started over a beer with a friend at a bar. I initially worked on infrastructure, while he handled the backend. I already had experience with OpenShift, and here I could build everything from scratch, from virtual machines to delivering a new service version. The project gave us concrete tasks: receive a stream of data, process it, store it and get the result to the user.

What the indicators look for

The first two indicators were named Athena and Kairos. The goal was to develop rules that could help us understand a coin's direction using several market metrics.

Athena looks for an upward impulse. Rising price and open interest are checked against trade flow: volume, turnover and CVD, the balance of aggressive buying and selling. Current values are compared with historical ones.

Kairos follows a different sequence: a sharp price rise, followed by signs of weakness in CVD or open interest over consecutive time windows. It looks for a setup in which a rise may be followed by a downward move.

The rules process incoming events, including the current unfinished window. That's why a stream-processing layer grew around the indicators.

How a market event becomes a signal

Handler services maintain WebSocket connections to the exchange and send events to Kafka. The stream then branches out to several consumers.

Market events pass through Kafka, parallel Flink jobs, and signal and metrics services
Kafka is shown by topic type; there is one Kafka cluster. Indicator calculation and metric collection run in parallel.

The indicators run as Flink jobs. Events are grouped by instrument and processed in the relevant windows. The result goes back to Kafka as a signal. The signal service receives it, saves it and publishes an update for the app.

A market metrics collector runs alongside the indicators. It receives Kafka events, calculates metrics and sends batches to other topics. A separate service saves that data to PostgreSQL for historical records and later queries about market state.

Rule configuration lives in PostgreSQL, and updates reach Flink through Kafka. Inside the jobs, the market event stream is connected to the configuration stream. Rule parameters can change independently of code releases.

This explains the different kinds of applications in the project. Regular Java services handle APIs and data, handlers receive exchange feeds, and Flink performs calculations on events.

Where a hundred repos came from

The core was built with microservices from the start. We knew we'd be adding services and integrations. Separate repositories for contracts, shared libraries and client apps followed.

Each service has its own code and release cycle. API contracts live in *-api repos, while shared configuration and integrations live in *-starter libraries. The starters handle repeated work with logs, metrics, Kafka and the database. The frontend has separate projects and shared components too. Builds and infrastructure account for more of the repositories.

Internal library versions are collected in hp-bom. A service selects a BOM version and gets a consistent set of dependencies. The release order for dependent starters is automated too. I covered that in detail in the article about our Maven hell.

So the hundred repos have a fairly ordinary breakdown: dozens of services, their contracts, libraries, frontends, and everything needed to build and run the project.

How the infrastructure changed

Initially, each service built in its own repository. Deployment ran from GitHub Actions in the repository containing the Helm charts. The workflow applied shared configuration and ran helm upgrade --install for the applications.

CD then moved to ArgoCD. Next, the shared CI scenarios were extracted into a separate repository, and services began calling reusable workflows. As the project grew, we also added our own VM layout on Proxmox, provisioned with Ansible and running Kubernetes through k3s.

At first, infrastructure work covered the project's needs. Later, I also tried things I wanted to learn. The two often overlapped: a real task came up, I learned a technology for it, and the result stayed in the project.

How Proxmox is divided up for the cluster

Proxmox runs on a dedicated server. It hosts virtual machines for the gateway, control plane and k3s workers. Worker nodes are grouped by workload.

One Proxmox host contains a separate gateway VM and worker groups inside k3s
The k3s enclosure shows workload placement groups, without specifying how many VMs each group contains.

Application Java services run in apps. Kafka and Redis run in data. PostgreSQL and Flink have their own groups. The infra group hosts infrastructure components, including Traefik and monitoring. The gateway VM sits outside Kubernetes and handles networking for the virtual machines.

To allocate resources, I listed the services in Excel and distributed CPU using Grafana data from the test cluster. We could already see how much the different parts consumed. The allocation worked out well after the move.

A node's role is recorded in its nodegroup label. Charts use selectors and affinity to control placement. A new application service goes into apps, while streaming jobs stay in the Flink group. The VMs themselves are described in the Ansible inventory.

How the cluster is built

Provisioning has two levels: the virtual machines and Kubernetes first, then the components running inside it.

Ansible prepares the Proxmox host and internal network bridge, creates a cloud-init template from an Ubuntu cloud image and provisions VMs from it. It then performs the base OS and gateway setup. The control plane gets k3s server, workers get k3s agents, and the nodes receive their labels.

The bundled Traefik and ServiceLB in k3s are disabled. The ingress controller is installed separately with its own configuration.

The next level is described in the bootstrap script. Order matters: CRDs and base cluster resources first, then Vault Transit, the main Vault and External Secrets Operator. CloudNativePG with PostgreSQL, Traefik, database restoration and Keycloak follow. ArgoCD is installed last, together with projects and root Applications.

Components are then divided into three layers: core, infra and business. Each has a root Application that picks up child Applications from Git. This structure manages both infrastructure charts and applications.

How the network works

Public ingress, administrative access and outbound connections use different routes.

Public traffic enters through Cloudflare and the gateway; admin traffic uses VPN, with separate outbound NAT and DNS routes
The main logical routes. Repeated gateway and Traefik drawings represent the same components on different traffic paths.

A user's HTTP request passes through Cloudflare to the gateway VM. DNAT forwards it to Traefik, which selects a Kubernetes Service according to the route. This path serves the app and public APIs.

Administrative access uses a VPN and a separate entry point on the Proxmox host. Requests for ArgoCD, Grafana and other tool interfaces are forwarded to Traefik. The Kubernetes API has a separate route.

Ordinary outbound pod connections use NAT on the gateway VM. This is how handlers connect to exchange APIs and other apps reach external systems. Traefik handles incoming HTTP requests; outbound connections go through the gateway.

NodeLocal DNSCache runs on the nodes. Cluster names go to CoreDNS, and external names go to upstream resolvers. CoreDNS rewrites internal tool domains to Traefik, so a request from inside the cluster reaches the ingress controller's internal Service.

How a new version reaches the cluster

A build still runs in the service's repository. That repo defines triggers and parameters, while the steps live in shared workflows. They set up Java and Maven, build the application and run tests. Release workflows publish Maven artifacts and container images to Nexus, which runs outside Kubernetes.

Shared GitHub Actions workflows publish artifacts to Nexus, while ArgoCD applies Helm configuration from Git
The upper path produces artifacts. The lower path selects a version for an environment; Kubernetes nodes pull the image from the registry.

To deploy, a developer changes the image version in the Helm chart's values.yaml and merges the change. ArgoCD sees the new configuration and syncs the application.

Backend apps have auto-sync enabled. Infrastructure and core components are synced manually. Developers received permissions to release backend services, while I retained control over applying infrastructure changes.

Flink jobs have their own configuration: the Flink cluster's values specify the JARs. This application code is released separately from regular service containers. The JARs are published to private S3 storage.

The move from deployment in Actions to this setup is covered in more detail in the CI/CD article.

What runs alongside the app

Strimzi manages Kafka, and CloudNativePG manages PostgreSQL. Secrets live in Vault; where Kubernetes Secrets are needed, External Secrets Operator retrieves them. Keycloak handles sign-in to the tools.

Market data is also connected to a Langflow chat. The agent receives the asset context and calls APIs through custom tools. Model requests go through LiteLLM, with token usage tracked per customer. That part has its own detailed article.

Where the data lives

PostgreSQL stores signals, rule configuration and historical market metrics. Kafka carries events consumed by different handlers. Redis is used for pub/sub among other things: services publish their latest state through it.

Application data in PostgreSQL, Kafka and Redis; backups, Flink state and JARs in private S3
Application data and S3 contents: PostgreSQL backups, Flink calculation state and artifacts used to launch jobs.

PostgreSQL backups and WAL archiving are configured to use S3. Flink saves checkpoints and savepoints there too. Streaming calculations accumulate data for instruments and time windows, which they need to continue processing.

The job JARs live there as well. Before startup, an init container downloads the required artifact from private S3. Flink then launches it from the pod's local directory. The artifact version is set in the job configuration.

What Grafana shows

Prometheus collects metrics, and Grafana displays the dashboards. Alloy and Loki handle logs. Dashboards are grouped by purpose: infrastructure, backend, frontend and business metrics. Kafka, Flink and Kubernetes have their own sets of screens.

Grafana dashboard catalog grouped into infrastructure, services, frontend and business metrics
Grafana dashboard catalog grouped into infrastructure, services, frontend and business metrics

At the Kubernetes level, we can inspect CPU and memory use by namespace and container, then compare it with requests and limits. This is the kind of data I used when allocating resources to VMs.

Kafka container CPU and memory use compared with requests and limits
Kafka namespace resources, with requested and actual usage shown together.

Exchange handlers have a separate dashboard. It brings together connections, streams, trading pairs and message rates. From there, we can select a specific handler, market or event type.

Exchange feed handler overview and an event processing time chart
Exchange feed handler overview and an event processing time chart

The delay in receiving an event from the exchange and the time spent processing it inside the handler are measured separately. Both have p50, p95 and p99 values, showing typical times and the long tail. Indicators depend on fresh input data, so these two parts of the path are tracked separately.

Percentiles for event processing time and the delay in receiving events from the exchange
Percentiles for event processing time and the delay in receiving events from the exchange

Alerts arrive in a Telegram chat through a bot. They include log errors, pod restarts, high HTTP latency and spikes in 401/403 responses. Each message identifies the service or pod, the time and the metric value. Log alerts link to Grafana with the service and log level already selected.

Telegram notifications about errors, restarts and metric thresholds, with internal addresses hidden
Telegram notifications about errors, restarts and metric thresholds, with internal addresses hidden

What the user sees

Later, I started working on the frontend too. I took on the interface design and implementation and built a design system for mobile and desktop screens. It all came together as a Telegram Mini App.

A signal card brings together the chart, market metrics and the conditions that triggered the indicator. It also explains what happened and which data supports it.

An Athena signal card in the desktop layout of the Telegram Mini App
An Athena signal card in the desktop layout of the Telegram Mini App

Each asset also has a risk screen showing its current score, score history and a breakdown by factor.

The asset risk screen in hermesproject shows the current score, its history and contributing factors
The asset risk screen in hermesproject shows the current score, its history and contributing factors

The app also has a guides section covering navigation, indicators and the metrics behind signals. Explanations use illustrations and short walkthroughs.

hermesproject guides covering the app, indicators and metrics
hermesproject guides covering the app, indicators and metrics

It started with wanting to stop following every coin by hand. Now it's a full-scale system for monitoring and analysing the market.

ReadTime spent working with AI: how we collect the metrics