/fava-service

💸 Deploy Beancount Fava as a Docker service with authentication, dark theme, and auto refresh

Primary LanguageCSS

Beancount Fava Docker Service

Deploy Beancount Fava as a Docker service, including:

Banner

Installation

Build the Docker image

  1. Set the port for the Fava service in the nginx.conf file (80 by default):

    ...
        server {
            listen 80;
    ...
    
  2. Set new credentials (User: admin & Password: admin by default):

    htpasswd -c .htpasswd <user>

    Note: Install apache2-utils if you don't have htpasswd.

  3. Set the refresh rate of the Ledger (i.e. pull your repository) as a Cron schedule in the Dockerfile file (0 * * * * by default).

  4. [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 the Dockerfile file:

    # Comment the following line to use the default Fava theme
    COPY ./style.css ./fava/frontend/css/style.css
  5. Build the Docker image:

    docker build -t fava-service .

    Note: You can change the name of the image (fava-service) to whatever you want.

Run the Docker container

  1. Set the URL to your Ledger repository as (1.) an environment variable, OR (2.) a Docker secret:

    1. Set REPOSITORY_URL to the URL of your Ledger repository in example/user.conf:
      echo "REPOSITORY_URL=https://git.server/ledger.git" >> ./example/user.conf
    2. 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 secret ledger-git if both are set.

  2. Set BEAN_FILE to the path of your main Beancount file in your Ledger repository in example/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
  3. Start the Docker service:

    docker compose -f example/docker-compose.yml up