This section sets up the docker container ln-history-api
which connects to the ln-history-database and processes those requests.
The backend authorizes requests via a specified ApiKey
.
In case you want to get a deeper understanding about the backend, feel free to check out the source code.
We will start by setting up the directory structure and continue with the docker container
From the project root we create the ln-history-api
directory with the following command.
Create an .env
file and fill in the ConnectionStrings__PostgreSQL
of the ln-history-database as well as the ApiKey
and the DOTNET_ENV
.
The ApiKey
will be later used to authorize requests sent to the backend.
This is a naive way to limit spam. You might want to consider using alternatives, like:
🔐 Important: Never commit .env
files containing credentials to version control.
Create the docker-compose.yml
and paste the following content into it.
Ultimatly the folder structure should look like this:
We start the container by using docker compose up -d
(The flag -d
abbreviates deamon
, meaning background process).
See the logs of the docker container.
ln-history-api | info: Microsoft.Hosting.Lifetime[14] ln-history-api | Now listening on: http://[::]:8080 ln-history-api | info: Microsoft.Hosting.Lifetime[0] ln-history-api | Application started. Press Ctrl+C to shut down. ln-history-api | info: Microsoft.Hosting.Lifetime[0] ln-history-api | Hosting environment: Production ln-history-api | info: Microsoft.Hosting.Lifetime[0] ln-history-api | Content root path: /app