From 646fd88aad8ceaf7e17db6387670efd1ec715930 Mon Sep 17 00:00:00 2001 From: perennial Date: Fri, 9 Feb 2024 18:33:39 +1100 Subject: [PATCH] Expand Docker documentation and allow using .env Fix seccomp error for Docker Compose --- .env.example | 46 +++++++++++++++++++++++++ README.md | 94 +++++++++++++++++++++++++++++++++++++--------------- compose.yaml | 13 ++++---- 3 files changed, 120 insertions(+), 33 deletions(-) create mode 100644 .env.example diff --git a/.env.example b/.env.example new file mode 100644 index 00000000..e9a9cf8b --- /dev/null +++ b/.env.example @@ -0,0 +1,46 @@ +# Redlib configuration +# See the Configuration section of the README for a more detailed explanation of these settings. + +# Instance-specific settings +# Enable SFW-only mode for the instance +REDLIB_SFW_ONLY=off +# Set a banner message for the instance +REDLIB_BANNER= +# Disable search engine indexing +REDLIB_ROBOTS_DISABLE_INDEXING=off +# Set the Pushshift frontend for "removed" links +REDLIB_PUSHSHIFT_FRONTEND=www.unddit.com + +# Default user settings +# Set the default theme (options: system, light, dark, black, dracula, nord, laserwave, violet, gold, rosebox, gruvboxdark, gruvboxlight) +REDLIB_DEFAULT_THEME=system +# Set the default front page (options: default, popular, all) +REDLIB_DEFAULT_FRONT_PAGE=default +# Set the default layout (options: card, clean, compact) +REDLIB_DEFAULT_LAYOUT=card +# Enable wide mode by default +REDLIB_DEFAULT_WIDE=off +# Set the default post sort method (options: hot, new, top, rising, controversial) +REDLIB_DEFAULT_POST_SORT=hot +# Set the default comment sort method (options: confidence, top, new, controversial, old) +REDLIB_DEFAULT_COMMENT_SORT=confidence +# Enable showing NSFW content by default +REDLIB_DEFAULT_SHOW_NSFW=off +# Enable blurring NSFW content by default +REDLIB_DEFAULT_BLUR_NSFW=off +# Enable HLS video format by default +REDLIB_DEFAULT_USE_HLS=off +# Hide HLS notification by default +REDLIB_DEFAULT_HIDE_HLS_NOTIFICATION=off +# Disable autoplay videos by default +REDLIB_DEFAULT_AUTOPLAY_VIDEOS=off +# Define a default list of subreddit subscriptions (format: sub1+sub2+sub3) +REDLIB_DEFAULT_SUBSCRIPTIONS= +# Hide awards by default +REDLIB_DEFAULT_HIDE_AWARDS=off +# Disable the confirmation before visiting Reddit +REDLIB_DEFAULT_DISABLE_VISIT_REDDIT_CONFIRMATION=off +# Hide score by default +REDLIB_DEFAULT_HIDE_SCORE=off +# Enable fixed navbar by default +REDLIB_DEFAULT_FIXED_NAVBAR=on diff --git a/README.md b/README.md index a335fbcd..158d9f1d 100644 --- a/README.md +++ b/README.md @@ -132,21 +132,44 @@ cargo install libreddit ## 2) Docker -Deploy the [Docker image](https://quay.io/repository/redlib/redlib) of Redlib: +[Docker](https://www.docker.com) lets you run containerized applications. Containers are loosely isolated environments that are lightweight and contain everything needed to run the application, so there's no need to rely on what's installed on the host. + +Docker images for Redlib are available at [quay.io](https://quay.io/repository/redlib/redlib), with support for `amd64`, `arm64`, and `armv7` platforms. + +For configuration options, see the [Deployment section](#Deployment). + +### Docker CLI + +Deploy Redlib: + ``` -docker pull quay.io/redlib/redlib -docker run -d --name redlib -p 8080:8080 quay.io/redlib/redlib +docker pull quay.io/redlib/redlib:latest +docker run -d --name redlib -p 8080:8080 quay.io/redlib/redlib:latest ``` -Deploy using a different port (in this case, port 80): +Deploy using a different port on the host (in this case, port 80): + ``` -docker pull quay.io/redlib/redlib -docker run -d --name redlib -p 80:8080 quay.io/redlib/redlib +docker pull quay.io/redlib/redlib:latest +docker run -d --name redlib -p 80:8080 quay.io/redlib/redlib:latest ``` -To deploy on `arm64` platforms, simply replace `quay.io/redlib/redlib` in the commands above with `quay.io/redlib/redlib:latest-arm`. +If you're using a reverse proxy in front of Redlib, prefix the port numbers with `127.0.0.1` so that Redlib only listens on the host port **locally**. For example, if the host port for Redlib is `8080`, specify `127.0.0.1:8080:8080`. + +If deploying on: -To deploy on `armv7` platforms, simply replace `quay.io/redlib/redlib` in the commands above with `quay.io/redlib/redlib:latest-armv7`. +- an `arm64` platform, use the `quay.io/redlib/redlib:latest-arm` image instead. +- an `armv7` platform, use the `quay.io/redlib/redlib:latest-armv7` image instead. + +### Docker Compose + +Copy `compose.yaml` and modify any relevant values (for example, the ports Redlib should listen on). + +Start Redlib in detached mode (running in the background): + +```bash +docker compose up -d +```