Stronghold¶
Fief Stronghold is the private edition of Fief, accessible to our paid backers, which includes exclusive features.
-
Knight ($5 per month)
Unlock premium content with exclusive tutorials and sneak peeks. As a gesture of appreciation, receive majestic stickers to proudly display your allegiance.
- Access to Stronghold, the private edition
- Stickers delivered to your mailbox
-
Baron ($20 per month)
Revel in exclusive tutorials, sneak peeks, and command priority email support. Your noble journey includes majestic stickers, ensuring your status as a revered patron of Fief.
- Access to Stronghold, the private edition
- Priority email support
- Stickers delivered to your mailbox
Usage¶
Fief Stronghold is only accessible through the Docker image. Since it's a private repository, you'll need to authenticate your Docker CLI to GitHub Registry.
Basically, you'll need to generate a Personal access tokens (classic) on GitHub, with at least the repo
and read:packages
scopes.
Then, you can authenticate your Docker CLI:
You'll then be prompted for your GitHub Username, and the token you just created as password.
Finally, you'll be able to pull the image:
You can now swap the Fief image by the Stronghold one. Configuration and usage is common.
Features¶
Hide Fief branding¶
To hide Fief branding on authentication pages, you can set the environment variable BRANDING
to False
.
Override authentication page templates¶
If you want to fully customize authentication pages (login, registration, forgot password, etc.), you can override the built-in templates. Fief templates are powered by Jinja, a powerful templating system for Python.
Step 1: implement your templates¶
We recommend you to start from the built-in templates of Fief and copy them into a local folder. The files you override should have the same name as the original ones and nested in a folder named auth
.
Here is a simple example of an override of layout.html
, which is the base layout for all authentication pages, using the Bootstrap framework.
{% extends "auth/base.html" %}
{% block style %}
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-QWTKZyjpPEjISv5WaRU9OFeRpok6YctnYmDr5pNlyT2bRjXh0JMhjY6hW+ALEwIH" crossorigin="anonymous">
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js" integrity="sha384-YvpcrYf0tY3lHB60NNkmXc5s9fDVZLESaAA55NDzOxhy9GkcIdslK1eN7N6jIeHz" crossorigin="anonymous"></script>
{% endblock %}
{% block body %}
<div class="px-4 py-5 my-5 text-center">
{% if tenant.logo_url %}
<img src="{{ tenant.logo_url }}" alt="{{ tenant.name }}" class="d-block mx-auto mb-4" />
{% endif %}
<h1 class="display-5 fw-bold text-body-emphasis">{{ tenant.name }}</h1>
<div class="col-lg-6 mx-auto">
{% if error is defined %}
<p class="text-danger">{{error}}</p>
{% endif %}
{% if success is defined %}
<p class="text-success">{{success}}</p>
{% endif %}
{% if not fatal_error %}
{% block auth_form %}
{% endblock %}
{% endif %}
</div>
</div>
{% endblock %}
Step 2: adding your templates to your Docker build¶
You should now add your templates to your Docker image. For this, create a Dockerfile
(if not already) in your project. In its simplest form, it can look like this:
FROM ghcr.io/fief-dev/stronghold:latest
COPY templates /app/templates
ENV OVERRIDE_TEMPLATES_DIRECTORY=/app/templates
Basically, we start from the base Stronghold image, copy our templates and set the OVERRIDE_TEMPLATES_DIRECTORY
environment variable.
You don't need to override every files
If you just want to override some files but not the others, you can just provide the one you're interested in. If some templates don't exist, Fief will simply fall back to the default ones.
Step 3: build and run your image¶
Now, all you need is to build and run your image to see the result.