Skip to content

Commit

Permalink
Overwrite server.conf settings only for provided env vars (#76)
Browse files Browse the repository at this point in the history
* Overwrite server.conf settings only for provided env vars

Currently on every start the whole server.conf file gets replaced which causes any changed settings during runtime to get lost

* Fix readme formatting

* Add "webUIEnabled" env variable

This is the only setting that can not be changed via the UI

* Remove default values from readme
  • Loading branch information
schroda authored Jan 21, 2024
1 parent 81ee2a7 commit d93e8c3
Show file tree
Hide file tree
Showing 5 changed files with 122 additions and 118 deletions.
8 changes: 7 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,12 @@ RUN apt-get update && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*

# install unzip to unzip the server-reference.conf from the jar
RUN apt-get update && \
apt-get -y install -y unzip && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*

# Create a user to run as
RUN groupadd --gid 1000 suwayomi && \
useradd --uid 1000 --gid suwayomi --no-log-init suwayomi && \
Expand All @@ -36,8 +42,8 @@ WORKDIR /home/suwayomi

# Copy the app into the container
RUN curl -s --create-dirs -L $TACHIDESK_RELEASE_DOWNLOAD_URL -o /home/suwayomi/startup/tachidesk_latest.jar
COPY scripts/create_server_conf.sh /home/suwayomi/create_server_conf.sh
COPY scripts/startup_script.sh /home/suwayomi/startup_script.sh
COPY server.conf.template /home/suwayomi/server.conf.template

# update permissions of files.
# we grant o+rwx because we need to allow non default UIDs (eg via docker run ... --user)
Expand Down
75 changes: 43 additions & 32 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Tachidesk-docker

| Status | Stable |Preview | Discord Support|
|:-:|:-:|:-:|:-:|
| Status | Stable | Preview | Discord Support |
|:-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------:|:---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------:|:----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------:|:----------------------------------------------------------------------------------------------------------------------------------------------------------:|
| [![Build Docker Images](https://github.com/suwayomi/docker-tachidesk/actions/workflows/build_container_images.yml/badge.svg)](https://github.com/suwayomi/docker-tachidesk/actions/workflows/build_container_images.yml) [![Docker Pulls](https://img.shields.io/badge/dynamic/json?url=https://github.com/suwayomi/docker-tachidesk/raw/main/scripts/tachidesk_version.json&label=docker_pulls&query=$.total_downloads&color=blue)](https://github.com/orgs/suwayomi/packages/container/package/tachidesk) | [![Latest](https://img.shields.io/badge/dynamic/json?url=https://github.com/suwayomi/docker-tachidesk/raw/main/scripts/tachidesk_version.json&label=version&query=$.stable&color=blue)](https://github.com/orgs/suwayomi/packages/container/package/tachidesk/) | [![Preview](https://img.shields.io/badge/dynamic/json?url=https://github.com/suwayomi/docker-tachidesk/raw/main/scripts/tachidesk_version.json&label=version&query=$.preview&color=blue)](https://github.com/orgs/suwayomi/packages/container/package/tachidesk) | [![Discord](https://img.shields.io/discord/801021177333940224.svg?label=discord&labelColor=7289da&color=2c2f33&style=flat)](https://discord.gg/DDZdqZWaHA) |

Run [Tachidesk-Server](https://github.com/Suwayomi/Tachidesk-Server) inside docker container as non-root user. The server will be running on http://localhost:4567 open this url in your browser.
Expand All @@ -17,42 +17,53 @@ Docker images are mutli-arch (linux/amd64, linux/arm/v7, linux/arm64, linux/ppc6
Logs are sent to stdout and are not written to disk.

### Docker compose

Use the template [docker-compose.yml](./docker-compose.yml) in this repo for creating and starting tachidesk docker container.

# Environment Variables

> [!NOTE]
> See [server-reference.conf](https://github.com/Suwayomi/Suwayomi-Server/blob/master/server/src/main/resources/server-reference.conf) in the [Suwayomi-Server](https://github.com/Suwayomi/Suwayomi-Server) repository for the default values
> [!Tip]
> Settings can be changed during runtime via the webUI.
> [!CAUTION]
> Providing an environment variable will overwrite the current value in the server.conf file.
There are a number of environment variables available to configure Suwayomi:

| Variable | Default | Description |
|:-:|:-:|:-:|
| **TZ** | `Etc/UTC` | What time zone the container thinks it is. |
| **BIND_IP** | `0.0.0.0` | The interface to listen on, inside the container. You almost never want to change this. |
| **BIND_PORT** | `4567` | Which port Suwayomi will listen on |
| **SOCKS_PROXY_ENABLED** | `false` | Whether Suwayomi will connect through a SOCKS5 proxy |
| **SOCKS_PROXY_HOST** | `""` | The TCP host of the SOCKS5 proxy |
| **SOCKS_PROXY_PORT** | `""` | The port of the SOCKS5 proxy |
| **DOWNLOAD_AS_CBZ** | `false` | Whether Suwayomi should save the manga to disk in CBZ format |
| **BASIC_AUTH_ENABLED** | `false` | Whether Suwayomi requires HTTP Basic Auth to get in. |
| **BASIC_AUTH_USERNAME** | `""` | The username to log in to Suwayomi. |
| **BASIC_AUTH_PASSWORD** | `""` | The password to log in to Suwayomi. |
| **DEBUG** | `true` | If extra logging is enabled. Useful for development and troubleshooting. |
| **GQL_DEBUG** | `false` | If graphql logging is enabled. Useful for development and troubleshooting. Can overload the log output. |
| **WEB_UI_FLAVOR** | `"WebUI"` | "WebUI" or "Custom" |
| **WEB_UI_CHANNEL** | `"stable"` | "bundled" (the version bundled with the server release), "stable" or "preview" - the webUI version that should be used |
| **WEB_UI_UPDATE_INTERVAL** | `23` | Time in hours - 0 to disable auto update - range: 1 <= n < 24 - how often the server should check for webUI updates |
| **AUTO_DOWNLOAD_CHAPTERS** | `false` | If new chapters that have been retrieved should get automatically downloaded |
| **AUTO_DOWNLOAD_EXCLUDE_UNREAD** | `true` | Ignore automatic chapter downloads of entries with unread chapters
| **AUTO_DOWNLOAD_AHEAD_LIMIT** | `0` | 0 to disable - how many unread downloaded chapters should be available - if the limit is reached, new chapters won't be downloaded automatically
| **EXTENSION_REPOS** | `"[]"` | Any additional extension repos to use, the format is `["https://github.com/MY_ACCOUNT/MY_REPO/tree/repo", "https://github.com/MY_ACCOUNT_2/MY_REPO_2/"]`
| **MAX_SOURCES_IN_PARALLEL** | `6` | Range: 1 <= n <= 20 - Sets how many sources can do requests (updates, downloads) in parallel. Updates/Downloads are grouped by source and all mangas of a source are updated/downloaded synchronously |
| **UPDATE_EXCLUDE_UNREAD** | `true` | If unread manga should be excluded from updates |
| **UPDATE_EXCLUDE_STARTED** | `true` | If manga that haven't been started should be excluded from updates |
| **UPDATE_EXCLUDE_COMPLETED** | `true` | If completed manga should be excluded from updates |
| **UPDATE_INTERVAL** | `12` | Time in hours - 0 to disable it - (doesn't have to be full hours e.g. 12.5) - range: 6 <= n < ∞ - Interval in which the global update will be automatically triggered |
| **UPDATE_MANGA_INFO** | `true` | If manga info should be updated along with the chapters |
| **BACKUP_TIME** | `"00:00"` | Range: hour: 0-23, minute: 0-59 - Time of day at which the automated backup should be triggered |
| **BACKUP_INTERVAL** | `1` | # Time in days - 0 to disable it - range: 1 <= n < ∞ - Interval in which the server will automatically create a backup |
| **BACKUP_TTL** | `14` | # Time in days - 0 to disable it - range: 1 <= n < ∞ - How long backup files will be kept before they will get deleted |
| Variable | Default | Description |
|:--------------------------------:|:---------:|:-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------:|
| **TZ** | `Etc/UTC` | What time zone the container thinks it is. |
| **BIND_IP** | `-` | The interface to listen on, inside the container. You almost never want to change this. |
| **BIND_PORT** | `-` | Which port Suwayomi will listen on |
| **SOCKS_PROXY_ENABLED** | `-` | Whether Suwayomi will connect through a SOCKS5 proxy |
| **SOCKS_PROXY_HOST** | `-` | The TCP host of the SOCKS5 proxy |
| **SOCKS_PROXY_PORT** | `-` | The port of the SOCKS5 proxy |
| **DOWNLOAD_AS_CBZ** | `-` | Whether Suwayomi should save the manga to disk in CBZ format |
| **BASIC_AUTH_ENABLED** | `-` | Whether Suwayomi requires HTTP Basic Auth to get in. |
| **BASIC_AUTH_USERNAME** | `-` | The username to log in to Suwayomi. |
| **BASIC_AUTH_PASSWORD** | `-` | The password to log in to Suwayomi. |
| **DEBUG** | `-` | If extra logging is enabled. Useful for development and troubleshooting. |
| **GQL_DEBUG** | `-` | If graphql logging is enabled. Useful for development and troubleshooting. Can overload the log output. |
| **WEB_UI_ENABLED** | `-` | If the server should serve a webUI |
| **WEB_UI_FLAVOR** | `-` | "WebUI" or "Custom" |
| **WEB_UI_CHANNEL** | `-` | "bundled" (the version bundled with the server release), "stable" or "preview" - the webUI version that should be used |
| **WEB_UI_UPDATE_INTERVAL** | `-` | Time in hours - 0 to disable auto update - range: 1 <= n < 24 - how often the server should check for webUI updates |
| **AUTO_DOWNLOAD_CHAPTERS** | `-` | If new chapters that have been retrieved should get automatically downloaded |
| **AUTO_DOWNLOAD_EXCLUDE_UNREAD** | `-` | Ignore automatic chapter downloads of entries with unread chapters |
| **AUTO_DOWNLOAD_AHEAD_LIMIT** | `-` | 0 to disable - how many unread downloaded chapters should be available - if the limit is reached, new chapters won't be downloaded automatically |
| **EXTENSION_REPOS** | `-` | Any additional extension repos to use, the format is `["https://github.com/MY_ACCOUNT/MY_REPO/tree/repo", "https://github.com/MY_ACCOUNT_2/MY_REPO_2/"]` |
| **MAX_SOURCES_IN_PARALLEL** | `-` | Range: 1 <= n <= 20 - Sets how many sources can do requests (updates, downloads) in parallel. Updates/Downloads are grouped by source and all mangas of a source are updated/downloaded synchronously |
| **UPDATE_EXCLUDE_UNREAD** | `-` | If unread manga should be excluded from updates |
| **UPDATE_EXCLUDE_STARTED** | `-` | If manga that haven't been started should be excluded from updates |
| **UPDATE_EXCLUDE_COMPLETED** | `-` | If completed manga should be excluded from updates |
| **UPDATE_INTERVAL** | `-` | Time in hours - 0 to disable it - (doesn't have to be full hours e.g. 12.5) - range: 6 <= n < ∞ - Interval in which the global update will be automatically triggered |
| **UPDATE_MANGA_INFO** | `-` | If manga info should be updated along with the chapters |
| **BACKUP_TIME** | `-` | Range: hour: 0-23, minute: 0-59 - Time of day at which the automated backup should be triggered |
| **BACKUP_INTERVAL** | `-` | # Time in days - 0 to disable it - range: 1 <= n < ∞ - Interval in which the server will automatically create a backup |
| **BACKUP_TTL** | `-` | # Time in days - 0 to disable it - range: 1 <= n < ∞ - How long backup files will be kept before they will get deleted |

# Docker tags

Expand Down
14 changes: 14 additions & 0 deletions scripts/create_server_conf.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/bin/bash

# exit early in case the file already exists
if [ -f /home/suwayomi/.local/share/Tachidesk/server.conf ]; then
exit 0
fi

mkdir -p /home/suwayomi/.local/share/Tachidesk

# extract the server reference config from the jar
unzip -q -j /home/suwayomi/startup/tachidesk_latest.jar "server-reference.conf" -d /home/suwayomi/startup

# move and rename the reference config
mv /home/suwayomi/startup/server-reference.conf /home/suwayomi/.local/share/Tachidesk/server.conf
Loading

0 comments on commit d93e8c3

Please sign in to comment.