From 5b59c3296fa5f18540c970281ff1e06e694b9358 Mon Sep 17 00:00:00 2001 From: simon Date: Thu, 16 Dec 2021 17:42:59 +0700 Subject: [PATCH] port overwrite with TA_PORT and TA_UWSGI_PORT for collisions, #103 --- README.md | 9 +++++++++ run.sh | 10 ++++++++++ 2 files changed, 19 insertions(+) diff --git a/README.md b/README.md index 38fa36a..a4075ed 100644 --- a/README.md +++ b/README.md @@ -55,6 +55,15 @@ The main Python application that displays and serves your video collection, buil - Change the environment variables `TA_USERNAME` and `TA_PASSWORD` to create the initial credentials. - `ELASTIC_PASSWORD` is for the password for Elasticsearch. The environment variable `ELASTIC_USER` is optional, should you want to change the username from the default *elastic*. +### Port collisions +If you have a collision on port `8000`, best solution is to use dockers *HOST_PORT* and *CONTAINER_PORT* distinction: To for example change the interface to port 9000 use `9000:8000` in your docker-compose file. + +Should that not be an option, the Tube Archivist container takes these two additional environment variables: +- **TA_PORT**: To actually change the port where nginx listens, make sure to also change the ports value in your docker-compose file. +- **TA_UWSGI_PORT**: To change the default uwsgi port 8080 used for container internal networking between uwsgi serving the django application and nginx. + +Changing any of these two environment variables will change the files *nginx.conf* and *uwsgi.ini* at startup using `sed` in your container. + ### Elasticsearch Stores video meta data and makes everything searchable. Also keeps track of the download queue. - Needs to be accessible over the default port `9200` diff --git a/run.sh b/run.sh index 514f5d8..163a554 100644 --- a/run.sh +++ b/run.sh @@ -14,6 +14,16 @@ for each in "${ENV_VARS[@]}"; do fi done +# ugly nginx and uwsgi port overwrite with env vars +if [[ -n "$TA_PORT" ]]; then + sed -i "s/8000/$TA_PORT/g" /etc/nginx/conf.d/nginx.conf +fi + +if [[ -n "$TA_UWSGI_PORT" ]]; then + sed -i "s/8080/$TA_UWSGI_PORT/g" /etc/nginx/conf.d/nginx.conf + sed -i "s/8080/$TA_UWSGI_PORT/g" /app/uwsgi.ini +fi + # wait for elasticsearch counter=0 until curl -u "$ELASTIC_USER":"$ELASTIC_PASSWORD" "$ES_URL" -fs; do