# Self-host Apache Cassandra

> A single node Apache Cassandra wide-column database on the official image, with a persistent volume. It is not published on the host and starts without authentication, so reach it only from other services in this project at cassandra:9042. A node needs about 2 GB of memory.

- Page: https://levelrail.com/templates/cassandra/
- JSON: https://levelrail.com/templates/cassandra.json
- Category: Database Tools
- Licence: Apache-2.0 (Permissive license)
- Source: https://github.com/apache/cassandra
- Upstream docs: https://cassandra.apache.org/doc/latest/

## Requirements
- Memory: about 2 GiB
- amd64: unknown, arm64: unknown
- Needs configuration before start: no
- Pinned image tag: 5.0.9

## Services

| Service | Image | Tag | Ports | Volumes |
| --- | --- | --- | --- | --- |
| cassandra | cassandra | 5.0.9 | 9042 | cassandra_data -> /var/lib/cassandra |

## Environment

| Service | Variable | Kind |
| --- | --- | --- |
| cassandra | CASSANDRA_CLUSTER_NAME | preset |
| cassandra | HEAP_NEWSIZE | preset |
| cassandra | MAX_HEAP_SIZE | preset |

## Deploy

### CLI

```bash
levelrail-cli templates install cassandra --name my-cassandra
```

Add --domain SERVICE=HOST to serve a service on your own domain, for example --domain cassandra=app.example.com.

### API

```bash
curl -X POST -H "Authorization: Bearer $TOKEN" -H "Content-Type: application/json" \
  https://levelrail.example.com/api/v1/service-templates/cassandra/install \
  -d '{
    "name": "my-cassandra"
  }'
```

Create a token in the dashboard first. Name, env and domains are the request fields.

## First run
1. The first start takes a few minutes. Connect from a service in the same project at cassandra:9042 with the CQL native protocol.

## Questions

### Can I deploy Apache Cassandra on Dokploy or Dokku?

The services and pinned images on this page can be run on any Docker host. The public Dokploy templates list we compared does not have an entry with the same id for Apache Cassandra, so on Dokploy you would use a Docker Compose application with the file from this page. Dokku deploys container images with its own commands, so the pinned image cassandra:5.0.9 is what you deploy there.

Self-host Apache Cassandra, Apache Cassandra docker compose file, deploy Apache Cassandra on a VPS: this page lists the pinned image, ports, volumes and the commands for each.
