Deploy Beancount Fava as a Docker service, including:
- Automatic refresh of your Ledger hosted on a Git repository;
- Nginx reverse proxy with Basic Authentication;
- Nord Theme for Fava;
-
Set the port for the Fava service in the
nginx.conf
file (80
by default):... server { listen 80; ...
-
Set new credentials (User:
admin
& Password:admin
by default):htpasswd -c .htpasswd <user>
Note: Install
apache2-utils
if you don't havehtpasswd
. -
Set the refresh rate of the Ledger (i.e.
pull
your repository) as a Cron schedule in theDockerfile
file (0 * * * *
by default). -
[Optional] Customize the Fava theme by editing the
style.css
file (Nord Theme by default). Or, if you want to use the default Fava theme, comment the following line in theDockerfile
file:# Comment the following line to use the default Fava theme COPY ./style.css ./fava/frontend/css/style.css
-
Build the Docker image:
docker build -t fava-service .
Note: You can change the name of the image (
fava-service
) to whatever you want.
-
Set the URL to your Ledger repository as (1.) an environment variable, OR (2.) a Docker secret:
- Set
REPOSITORY_URL
to the URL of your Ledger repository inexample/user.conf
:echo "REPOSITORY_URL=https://git.server/ledger.git" >> ./example/user.conf
- Update
example/ledger-git
to use the URL of your Ledger repository:echo -n "https://<user>:<password>@git.server/ledger.git" > ./example/ledger-git
Note: The environment variable
REPOSITORY_URL
has priority over the Docker secretledger-git
if both are set. - Set
-
Set
BEAN_FILE
to the path of your main Beancount file in your Ledger repository inexample/user.conf
. Do not use trailing slashes. For example:echo "BEAN_FILE=main.beancount" >> ./example/user.conf echo "BEAN_FILE=my-ledger/main.beancount" >> ./example/user.conf
-
Start the Docker service:
docker compose -f example/docker-compose.yml up