Skip to content

Configuration

Justin Forest edited this page Apr 10, 2024 · 9 revisions

This section describes how to configure components.

Table of Contents:

Backend

JWT_SECRET

This is a password used when creating and verifying JWT tokens, used for authenticating users. By default, a built in value is used, which is known to everyone, so anyone can forge authentication tokens and impersonate users. In a production environment, you should set it to something actually secret using the JWT_SECRET environment variable.

You can use an online generator like this one to generate a unique secret.

SQLITE_PATH

When using the SQLite backend, you need to specify the name of the database to use. This variable does just that. The value is the file path, relative or absolute. Example:

$ SQLITE_PATH=./database.sqlite ./treemap

Or, you can put the path in your .env file, see this example.

To create the database, use the provided schema file, like this:

$ sqlite3 ./database.sqlite < dev/schema-sqlite.sql

TREEMAP_WORKERS

This environment variable controls how many worker threads will be running. For development purpose, one thread is enough. For production environment, it is recommended to run as many as you have CPU cores. It makes sense to run a few times more workers in case there are blocking tasks inside requests (we'll need to measure this).

Configuring Docker

When running the app from a Docker image, environment variables can be set using the -e command line switch, for example:

$ docker run -p 8000:8000 -v $PWD/var:/app/var \
  -e TREEMAP_WORKERS=100 \
  ghcr.io/umonkey/treemap:latest

This will run 100 worker threads instead of whatever is the default value.

Clone this wiki locally