# Self-host 2FAuth

> A web app to manage your two-factor authentication accounts and generate one-time codes.

- Page: https://levelrail.com/templates/2fauth/
- JSON: https://levelrail.com/templates/2fauth.json
- Category: Security
- Licence: AGPL-3.0 (Network copyleft (AGPL) license)
- Source: https://github.com/Bubka/2FAuth
- Upstream docs: https://docs.2fauth.app

## Requirements
- Memory: about 128 MiB
- amd64: published, arm64: tested
- Needs configuration before start: no
- Pinned image tag: 8.0.2

## Services

| Service | Image | Tag | Ports | Volumes |
| --- | --- | --- | --- | --- |
| 2fauth | 2fauth/2fauth | 8.0.2 | 8000 | twofauth_data -> /2fauth |

## Environment

| Service | Variable | Kind |
| --- | --- | --- |
| 2fauth | APP_KEY | generated |
| 2fauth | APP_URL | preset |
| 2fauth | DB_CONNECTION | preset |
| 2fauth | SITE_OWNER | preset |

## Deploy

### CLI

```bash
levelrail-cli templates deploy 2fauth --name my-2fauth
```

### API

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

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

## Questions

### Can I deploy 2FAuth 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 2fauth for this app, so check that entry as well. Dokku deploys container images with its own commands, so the pinned image 2fauth/2fauth:8.0.2 is what you deploy there.

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