From c16e87f9c7737df08315bcb6f88e6d90262b7e07 Mon Sep 17 00:00:00 2001 From: Christoph Schmatzler Date: Sat, 26 Mar 2022 10:24:38 +0100 Subject: [PATCH] Allow specifying port through LD_SERVER_PORT environment variable (#156) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Allow specifying port through LD_SERVER_PORT environment variable Co-authored-by: Christoph Schmatzler Co-authored-by: Sascha Ißbrücker --- bootstrap.sh | 4 +++- docs/Options.md | 8 +++++++- uwsgi.ini | 1 - 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/bootstrap.sh b/bootstrap.sh index 1ccf9a0..ef72f4c 100755 --- a/bootstrap.sh +++ b/bootstrap.sh @@ -1,6 +1,8 @@ #!/usr/bin/env bash # Bootstrap script that gets executed in new Docker containers +LD_SERVER_PORT="${LD_SERVER_PORT:-9090}" + # Create data folder if it does not exist mkdir -p data @@ -18,4 +20,4 @@ if [ "$LD_DISABLE_BACKGROUND_TASKS" != "True" ]; then fi # Start uwsgi server -uwsgi uwsgi.ini +uwsgi --http :$LD_SERVER_PORT uwsgi.ini diff --git a/docs/Options.md b/docs/Options.md index bb57b03..2e3d924 100644 --- a/docs/Options.md +++ b/docs/Options.md @@ -44,4 +44,10 @@ This can be useful if you intend to store non fully qualified domain name URLs, Values: `Integer` as seconds | Default = `60` -Configures the request timeout in the uwsgi application server. This can be useful if you want to import a bookmark file with a high number of bookmarks and run into request timeouts. \ No newline at end of file +Configures the request timeout in the uwsgi application server. This can be useful if you want to import a bookmark file with a high number of bookmarks and run into request timeouts. + +### `LD_SERVER_PORT` + +Values: Valid port number | Default = `9090` + +Allows to set a custom port for the UWSGI server running in the container. While Docker containers have their own IP address namespace and port collisions are impossible to achieve, there are other container solutions that share one. Podman, for example, runs all containers in a pod under one namespace, which results in every port only being allowed to be assigned once. This option allows to set a custom port in order to avoid collisions with other containers. \ No newline at end of file diff --git a/uwsgi.ini b/uwsgi.ini index 8cdf20e..a23b0c5 100644 --- a/uwsgi.ini +++ b/uwsgi.ini @@ -1,5 +1,4 @@ [uwsgi] -http = :9090 chdir = /etc/linkding module = siteroot.wsgi:application env = DJANGO_SETTINGS_MODULE=siteroot.settings.prod