From 9b83d16fe0677395cf10232883309997bea3042d Mon Sep 17 00:00:00 2001 From: Radoslav Date: Fri, 29 Dec 2023 23:24:16 +0000 Subject: [PATCH] Updated docker-compose and README for new setup --- README.md | 26 ++++++++------------------ docker-compose.yml | 24 ++++++++++++++++-------- 2 files changed, 24 insertions(+), 26 deletions(-) diff --git a/README.md b/README.md index 9d3c226..dd2d4b7 100644 --- a/README.md +++ b/README.md @@ -5,30 +5,20 @@ The server is written in C# using ASP.NET Core. The codebase can be developed, b
-# Self-hosting - +# Self-hosting Librum-Server can easily be self-hosted. This way all your data and books remain on your own devices and are not synchronized to the official cloud. -
-
-There are two options for self-hosting Librum-Server: -1. The first one is running a service on your linux server for which you can find instructions [here](self-hosting/self-host-installation.md).
-2. The other option is to run it via Docker which is described in the [next section](https://github.com/Librum-Reader/Librum-Server#running-with-docker).
- -
- -# Running with Docker - -Librum-Server can be run with Docker. We currently do not provide images in DockerHub so you'll need to build it yourself. +## 🐋 With Docker +Librum-Server can be run with Docker. We provide a [docker-compose.yml](docker-compose.yml) file as well as our own images. We are using GitHub's `ghrc.io` Container Registry. ```bash -git clone https://github.com/Librum-Reader/Librum-Server -cd Librum-Server -docker build . -t librum -``` +wget https://github.com/Librum-Reader/Librum-Server/raw/main/docker-compose.yml -Librum will also need a database. You can use [our sample docker-compose.yml file](docker-compose.yml) as a guide for setting it up. +docker compose up -d +``` +## 📃 Manual installation +If you don't like Docker, you can also selfhost Librum-Server by running it as a service on your linux server. Instructions can be found [here](self-hosting/self-host-installation.md).
diff --git a/docker-compose.yml b/docker-compose.yml index f221f27..00d02cd 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -2,7 +2,7 @@ version: "3.8" services: librum: - image: librum + image: ghcr.io/librum-reader/librum-server:latest hostname: librum container_name: librum ports: @@ -12,18 +12,20 @@ services: volumes: - librum:/var/lib/librum-server/librum_storage environment: - - JWTValidIssuer=exampleIssuer - - JWTKey=exampleOfALongSecretToken - - SMTPEndpoint=smtp.example.com - - SMTPUsername=mailuser123 + - JWTValidIssuer=exampleIssuer # Optional. You can leave it as-is + - JWTKey=exampleOfALongSecretToken # Optional. You can leave it as-is + - SMTPEndpoint=smtp.example.com # Example for Gmail: smtp.gmail.com:587 + - SMTPUsername=mailuser123 - SMTPPassword=smtpUserPassword123 - SMTPMailFrom=mailuser123@example.com - DBConnectionString=Server=mariadb;port=3306;Database=librum;Uid=librum;Pwd=mariadb; - - AdminEmail=admin@example.com - - AdminPassword=strongPassword123 + - AdminEmail=admin@example.com # Admin login username + - AdminPassword=strongPassword123 # Admin login password + #- OpenAIToken= # Optional. Generate here: https://platform.openai.com/api-keys restart: unless-stopped depends_on: - - librum_db + librum_db: + condition: service_healthy # Ensures the DB is up before the server. librum_db: image: mariadb:latest @@ -39,6 +41,12 @@ services: - MARIADB_DATABASE=librum - MARIADB_ROOT_PASSWORD=mariadb restart: unless-stopped + healthcheck: # Ensures the DB is up before the server. + test: ["CMD", "mariadb-admin", "ping", "-u", "librum", "-p'mariadb'", "-h", "localhost"] + interval: 20s + timeout: 40s + retries: 3 + start_period: 30s networks: librum: