Local Development

This guide covers setting up the Arculus FIDO2 Server for local development and testing. This is the fastest way to get started developing with the FIDO2 server on your local machine.

Before you begin: Contact your Arculus representative to obtain the FIDO2 Server distribution package (ZIP file) containing all necessary files for local development.

For deployment overview and other deployment options, see 3. Deployment.

Prerequisites

Before setting up local development, ensure you have the following installed:

  • Docker and Docker Compose (for containerized deployment)

  • Python 3.12+ (if running directly without Docker)

  • MongoDB (or use Docker for MongoDB)

Obtaining the Distribution Package

Arculus provides the FIDO2 Server files in a distribution package (ZIP file). Contact your Arculus representative to obtain the latest distribution package.

The distribution package includes:

  • Dockerfile.pyfido - Docker image definition

  • pyfidoMongo.yml - Docker Compose configuration for MongoDB

  • docker-compose.dev.yml - Combined Docker Compose setup (optional)

  • Source code and dependencies (if running Python directly)

  • Configuration examples and documentation

Extract the distribution package to a directory of your choice:

Quick Start

The fastest way to get started is using Docker Compose with both MongoDB and PyFIDO Server:

This option runs both MongoDB and PyFIDO Server in containers, ideal for development.

Step 1: Start MongoDB

This starts:

  • MongoDB on port 27017

  • Mongo Express (database UI) on port 8081 (admin/pass)

Step 2: Build and Start PyFIDO Server

Access Points:

  • PyFIDO Server: http://localhost:5001

  • Health Check: http://localhost:5001/health

  • Mongo Express: http://localhost:8081 (admin/pass)

Note: For a single command setup, see the "Combined Docker Compose" section below.

Option 2: Docker with External MongoDB

If you already have MongoDB running locally or want to use a different MongoDB instance:

Note: host.docker.internal allows the container to access services running on your host machine.

Option 3: Python Direct Execution

For development without Docker, run the server directly with Python. Ensure you have extracted the distribution package and have Python 3.12+ installed:

Note: The distribution package includes all necessary source files. If requirements.txt is not included, contact your Arculus representative for dependency information.

Development Configuration

Environment Variables

For local development, use these recommended settings:

Variable
Development Value
Description

DEVMODE

3

Development mode (verbose logging, relaxed security)

LOGLEVEL

3

Log verbosity (1=minimal, 5=verbose)

AUTH

off

Disable JWT authentication for easier testing

METADATA

off

Disable MDS verification (not needed for development)

AAGUID

off

Disable AAGUID whitelist

SESSION

60

Session timeout (seconds)

PROTOCOL

http

Use HTTP (not HTTPS) for local development

PORT

5001

Server port

THREADS

12

Worker threads

Combined Docker Compose Configuration

For convenience, the distribution package may include a combined docker-compose.dev.yml file that includes MongoDB, Mongo Express, and PyFIDO Server. If not included, you can create one based on this example:

Create a file docker-compose.dev.yml in the distribution package directory:

Then start everything with:

Key Development Settings:

  • PYARMOR_ENABLED=false: Disables source encryption for easier debugging

  • PYTHONUNBUFFERED=1: Ensures Python output is not buffered (see logs immediately)

  • AUTH=off: No JWT authentication required

  • METADATA=off: No FIDO Metadata Service verification

  • PROTOCOL=http: HTTP instead of HTTPS for local development

Building the Docker Image

Development Build (No Encryption)

For local development, build without PyArmor encryption:

This makes debugging easier and builds faster.

Production Build (With Encryption)

For testing production-like builds:

Running and Managing Containers

Start Services

Stop Services

View Logs

Restart Services

Database Management

Using Mongo Express

Mongo Express provides a web-based UI for MongoDB:

  1. Start services: docker-compose -f pyfidoMongo.yml up -d

  2. Open browser: http://localhost:8081

  3. Login: admin / pass

Note: Some versions of Mongo Express have pagination issues. If collections don't load, hover over the button, copy the link, and remove the &runAggregate=false parameter.

Using MongoDB Shell

Database Location

MongoDB data is persisted in ~/data (home directory) by default. To change the location, modify the volume mount in pyfidoMongo.yml:

Testing the Server

Health Check

Version Information

Test Registration Endpoint

Development Tips

Python Output Buffering

When running in Docker, Python output is buffered by default. The PYTHONUNBUFFERED=1 environment variable ensures logs appear immediately:

Hot Reloading

For active development with Python direct execution (not Docker), you can modify source files directly in the distribution package directory. Changes will be reflected on the next server restart.

Note: Hot reloading is not available for Docker deployments or PyArmor-encrypted builds. For development, use the unencrypted build (PYARMOR_ENABLED=false).

Debugging

Interactive Shell

View Container Status

Network Debugging

Common Development Scenarios

Scenario 1: Fresh Start

Scenario 2: Update Code

If you receive an updated distribution package from Arculus:

Scenario 3: Reset Database

Scenario 4: Use External MongoDB

If you have MongoDB running elsewhere:

Troubleshooting

Container Won't Start

Can't Connect to MongoDB

Port Already in Use

Health Check Failing

Next Steps

Once your local development environment is running:

Last updated