# Self-host CrowdSec Local API

> Collaborative security engine run here as the local API that other agents and bouncers register with. The log reading agent and the online API are switched off.

- Page: https://levelrail.com/templates/crowdsec/
- JSON: https://levelrail.com/templates/crowdsec.json
- Category: Security
- Licence: MIT (Permissive license)
- Source: https://github.com/crowdsecurity/crowdsec
- Upstream docs: https://docs.crowdsec.net/

## Requirements
- Memory: about 256 MiB
- amd64: unknown, arm64: unknown
- Needs configuration before start: no
- Pinned image tag: v1.8.2

## Services

| Service | Image | Tag | Ports | Volumes |
| --- | --- | --- | --- | --- |
| crowdsec | crowdsecurity/crowdsec | v1.8.2 | 8080 | config -> /etc/crowdsec; data -> /var/lib/crowdsec/data |

## Environment

| Service | Variable | Kind |
| --- | --- | --- |
| crowdsec | DISABLE_AGENT | preset |
| crowdsec | DISABLE_ONLINE_API | preset |

## Deploy

### CLI

```bash
levelrail-cli templates deploy crowdsec --name my-crowdsec
```

### API

```bash
curl -X POST -H "Authorization: Bearer $TOKEN" \
  https://levelrail.example.com/api/v1/service-templates/crowdsec/deploy
```

Create a token in the dashboard first. This one-click route deploys it as a trial app you can keep or remove.

## First run
1. Register an agent or bouncer with cscli machines add or cscli bouncers add inside the container, then point it at this address.

## Questions

### Can I deploy CrowdSec Local API on Dokploy or Dokku?

The services and pinned images on this page can be run on any Docker host. The public Dokploy templates list has an entry with the id crowdsec for this app, so check that entry as well. Dokku deploys container images with its own commands, so the pinned image crowdsecurity/crowdsec:v1.8.2 is what you deploy there.

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