Skip to content

Install with Docker

Andreas Backström edited this page Jan 2, 2025 · 3 revisions

Note

There are multiple ways you can host BookLogr. This guide goes through the recommended way of installing it on your own hardware but depending on your needs certain steps can be altered as you deem neccessary.

Versions

There are older versions of this document, pick the one most suitable to you.

Prerequisites

  • Linux server (tested with Ubuntu 24.04)
  • Docker

Step 1

Create a directory to store docker-compose.yml and .env files in and move to that directory.

mkdir ./booklogr
cd ./booklogr

Step 2

Download docker-compose.yml and .env.example files from the repository

curl --output docker-compose.yml "https://raw.githubusercontent.com/Mozzo1000/booklogr/refs/heads/main/docker-compose.yml"
curl --output .env "https://raw.githubusercontent.com/Mozzo1000/booklogr/refs/heads/main/.env.example"

Step 3

Edit the .env file as needed along with the environment variables for the web service in the docker-compose.yml file. See ENV-variables.md for more information.

Step 4

Start all containers

docker compose up -d

🎉 The web interface should now be available on http://localhost:5150

(optional) Reverse proxy (nginx)

It is recommended to use a reverse proxy for the docker containers when wanting to access them externally. This will guide you through how to set it up with Nginx but other software may work as well.

Step 1 - Create Nginx configuration file for api service

sudo nano /etc/nginx/sites-available/api.booklogr

Paste the following inside the file,

server {
    server_name api.YOUR_DOMAIN;

    location / {
            proxy_pass http://127.0.0.1:5002;
            proxy_set_header Host $host;
            proxy_set_header X-Real-IP $remote_addr;
            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    }
}

Change api.YOURDOMAIN to the public domain you want the api service to be accessible from.

Step 2 - Create Nginx configuration file for auth service

sudo nano /etc/nginx/sites-available/auth.booklogr

Paste the following inside the file,

server {
    server_name auth.YOUR_DOMAIN;

    location / {
            proxy_pass http://127.0.0.1:5001;
            proxy_set_header Host $host;
            proxy_set_header X-Real-IP $remote_addr;
            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    }
}

Change auth.YOURDOMAIN to the public domain you want the api service to be accessible from.

Step 3 - Create Nginx configuration file for web interface

Create Nginx configuration file for auth service sudo nano /etc/nginx/sites-available/booklogr

Paste the following inside the file,

server {
    server_name YOUR_DOMAIN;

    location / {
            proxy_pass http://127.0.0.1:5150;
            proxy_set_header Host $host;
            proxy_set_header X-Real-IP $remote_addr;
            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    }
}

Change YOURDOMAIN to the public domain you want the api service to be accessible from.

Step 5 - Enable configuration files

sudo ln -s /etc/nginx/sites-available/api.booklogr /etc/nginx/sites-enabled/
sudo ln -s /etc/nginx/sites-available/auth.booklogr /etc/nginx/sites-enabled/
sudo ln -s /etc/nginx/sites-available/booklogr /etc/nginx/sites-enabled/

Step 6 - Restart Nginx service

sudo systemctl restart nginx

🎉 You should now be able to go to YOUR_DOMAIN and have a working BookLogr service running! 🎉

Tip

It is recommended to use an SSL certificate for all web services, especially if you are hosting BookLogr for external use.