This guide provides the steps to deploy a Papermerge instance using Docker with Keycloak as the OIDC identity provider and OAuth2-Proxy for authentication.
1. Generate Cookie Secret
Before starting, generate a unique secret for session cookies and save it to a .env file in the docker/oidc/ directory:
cd <project root>/docker/oidc/
export OAUTH2_COOKIE_SECRET=$(openssl rand -base64 32)
echo "OAUTH2_COOKIE_SECRET=$OAUTH2_COOKIE_SECRET" > .env
2. Start Services
Run the following command to start the stack in detached mode:
cd <project root>/docker/oidc/
docker compose up -d
To build from scratch or redirect logs to a file, use:
# Build and run
cd <project root>/docker/oidc/
docker compose up --build
# Build and redirect logs to compose.log
cd <project root>/docker/oidc/
docker compose up --build 2>&1 | tee compose.log
3. Initialization and Verification
Keycloak requires 1-2 minutes to initialize and import the realm. Monitor the status and logs to ensure services are ready:
# Check container status
docker compose ps
# Follow logs
docker compose logs -f
4. Access and Default Credentials
| Service | URL | Credentials |
|---|
| Papermerge | http://localhost:8080 | (via Keycloak) |
| Keycloak Admin | http://localhost:9090 | admin / admin |
Pre-configured test users:
| Username | Password | Role | Description |
|---|
| admin | admin | admin | Full administrator |
| demo | demo | user | Regular user |
cd <project root>/docker/oidc/
export OAUTH2_COOKIE_SECRET=$(openssl rand -base64 32)
echo "OAUTH2_COOKIE_SECRET=$OAUTH2_COOKIE_SECRET" > .env
docker compose up -d