Self-host 2FAuth with Levelrail

Verified

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

  • AuthorBubkaVerified by Levelrail
  • LicenceAGPL-3.0
  • Memory128 MiB
  • Archarm64
  • Services1

How to self-host 2FAuth

  1. Pull the images

    One image is pulled on your server.

    Show images
    • 2fauth/2fauth:8.0.2
  2. Create the app

    One service starts in a single Compose app, with 1 named volume mount for your data, on port 8000.

  3. Fill in the secrets

    1 secret is generated and stored encrypted, 3 settings are preset, you do not have to fill in anything.

  4. Open it

    Without a domain the app gets an sslip.io address; add --domain SERVICE=HOST to use your own.

2FAuth requirements

Memory
About 128 MiB
Architectures
amd64 image published, arm64 tested
Ports
8000
Domain
Optional, an sslip.io address is used without one
Settings
none to fill in
License
AGPL-3.0, network copyleft (agpl) license
  • Verified. Verified on arm64 with image tag 8.0.2. Our CI ran this exact image version and it answered on its health path. Evidence
  • Host ports. It publishes port 8000 on the host, so open them in the VPS firewall only if you want that.

Install Levelrail first

On a server with Levelrail running, run the command above, or open the dashboard: Apps, New app, Browse templates, then 2FAuth. New to Levelrail? Install it on a fresh VPS first.

docker pull ghcr.io/glincker/levelrail:latest

Then levelrail-cli login --device. See Getting started and the 2FAuth docs page.

Deploy 2FAuth your way

Every format below deploys the same pinned images. Pick the one that fits how you work.

Deploy 2FAuth from the CLI

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

Deploy 2FAuth with the API

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

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

2FAuth configuration

2FAuth services

ServiceImagePortsVolumes
2fauth 2fauth/2fauth:8.0.2 8000 twofauth_data -> /2fauth

2FAuth environment variables

VariableServiceValue
APP_KEY 2fauth Generated at deploy
APP_URL 2fauth Preset by the template
DB_CONNECTION 2fauth Preset by the template
SITE_OWNER 2fauth Preset by the template

Ports and volumes

Ports
8000
Volumes
1 named mount: twofauth_data -> /2fauth

2FAuth FAQ

How much memory does 2FAuth need?

The catalog lists about 128 MiB of memory for 2FAuth.

Does 2FAuth run on arm64?

For 2FAuth, arm64 is tested; amd64 is image published.

What licence is 2FAuth under?

2FAuth is licensed under AGPL-3.0, which is network copyleft, so source sharing also applies when it is offered as a hosted service.

Does 2FAuth need configuration before it starts?

No. The template fills in its own defaults and generates secrets at deploy time.

Which ports does 2FAuth use?

2FAuth listens on port 8000 inside the stack.

Where does 2FAuth keep its data?

In a named volume: twofauth_data mounted at /2fauth.

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.

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