Skip to main content

Deployment modes

Peekaping runs in one of two modes. Both run the same code and have the same features. They differ in how the server's two parts, the API and the probe that runs the checks, are split into processes, and so in how far an install can scale.

  • Single mode is the default for new installs. One process runs both. It runs from one image, with SQLite or with PostgreSQL.
  • Cluster mode is for installs that need to scale out: Kubernetes with the Helm chart, or the cluster Docker Compose stack.

There is no setting that switches between them. The mode is the image you run. The MODE setting (dev, prod or test) has nothing to do with it.

Single mode​

In single mode, Peekaping is one process, peekaping, that is both the API and the local probe. It passes work and events between its parts in memory, so there is no Redis. The same process serves the web app, the API and the websocket on port 8383.

You run it from one image, 0xfurai/peekaping. It holds peekaping and nothing else, and DB_TYPE picks the database:

  • With DB_TYPE unset or sqlite, it keeps its data in a SQLite file in /app/data.
  • With DB_TYPE=postgres, it connects to the PostgreSQL server that DB_HOST, DB_PORT, DB_USER, DB_PASS and DB_NAME name. That server runs in a container of its own, the official postgres image, beside peekaping in Docker Compose. It can also be any other PostgreSQL, such as a managed one. See Docker + PostgreSQL.

Single mode supports SQLite and PostgreSQL only. It doesn't scale out: one process runs every check.

The image has a new name from release 0.0.48: see The image has a new name.

Because the peekaping process checks the local probe's monitors, a peekaping-probe connects to single mode only as a remote probe, with that probe's own token. A probe instance that uses the local probe's token would check the same monitors a second time, so peekaping refuses it with a message that says why, and the probe logs that message. peekaping also ignores PROBE_BOOTSTRAP_TOKEN: it doesn't store it, and logs a warning at startup when it is set.

Cluster mode​

In cluster mode, the API and the probe are separate processes:

  • The API replicas share the database and talk to each other through Redis. The API stores the results, and one replica, the leader, runs the stale-monitor watchdog, the probe offline sweep and the push monitors' checks.
  • The probe instances (peekaping-probe) check the local probe's monitors. They connect to the API, get their monitors, run the checks and send the results back, as a remote probe does. They need no database and no Redis.

You can run several of each, for scale and high availability. To check more monitors, add probe replicas. Use cluster mode when one process isn't enough.

The probe instances find the API with PEEKAPING_URL and prove they are the local probe with a token. The API stores that token at startup from PROBE_BOOTSTRAP_TOKEN, and the probes send the same value as PROBE_TOKEN. It is at least 32 characters, such as the output of openssl rand -hex 32. The Compose files and the Helm chart set both for you: the Compose files stop with a message until you put PROBE_BOOTSTRAP_TOKEN in .env, and the chart makes a Secret with a random token.

You run cluster mode in one of two ways:

The cluster images run as a non-root user. See Cluster user and permissions.

In cluster mode the local probe is online while one of its instances is connected, like a remote probe. If you stop the probe deployment, Peekaping tells the local probe's own notification channels, or, when it has none (the default), the channels of its monitors, that the local probe is offline. In single mode the local probe is never offline.

Coming from the layout with a producer, a worker and an ingester? Their images are no longer published. See Upgrading to probes.

What each mode runs​

Single modeCluster mode
Images0xfurai/peekaping, and postgres for PostgreSQL0xfurai/peekaping-api, -probe, -web and -migrate
Processespeekaping. With PostgreSQL, the database runs in a container of its own.The API, the probe and a web server. migrate runs once to set up the database.
Who checks the local probe's monitorsThe peekaping processThe probe instances
Web appServed by peekaping on port 8383The web image. Docker Compose puts an nginx gateway on port 8383 in front of it, and Helm uses an ingress or Istio.
RedisNoneRequired, between the API replicas
Storage backendsSQLite or PostgreSQLPostgreSQL with Helm. PostgreSQL or SQLite with Docker Compose.
ScalingOne processSeveral API replicas and several probe instances
Set up withDocker + SQLite, Docker + PostgreSQLKubernetes (Helm), the Cluster mode sections of Docker + PostgreSQL and Docker + SQLite

Which mode to use​

Start with single mode. In single mode you choose the storage backend with DB_TYPE. Supported databases compares SQLite and PostgreSQL.

Use cluster mode when you need to scale out, for example to run several API replicas and probe instances, or when you already run on Kubernetes. It needs a Redis, and more containers or pods to run and update.

Upgrading to single mode​

The bundle images from 0.0.44 to 0.0.47 ran Redis, Caddy and supervisord beside Peekaping's processes, and the PostgreSQL bundle ran PostgreSQL in the same container. To move one to single mode, follow Upgrading to single mode.

Helm and the Docker Compose stacks stay in cluster mode.

Remote probes​

Both modes can check monitors from other machines, with remote probes. A probe connects out to the API, so it works with either mode and needs no extra service on the server. See Remote probes.