feat: add internal_port env var

This commit is contained in:
Herculino Trotta
2025-11-09 15:42:42 -03:00
parent f2abeff31a
commit 5d7dd622f5
6 changed files with 14 additions and 4 deletions

3
.gitignore vendored
View File

@@ -160,3 +160,6 @@ cython_debug/
# and can be added to the global gitignore or merged into this file. For a more nuclear
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
.idea/
postgres_data/
.prod.env

View File

@@ -126,6 +126,7 @@ To create the first user, open the container's console using Unraid's UI, by cli
| variable | type | default | explanation |
|-------------------------------|-------------|-----------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| INTERNAL_PORT | int | 8000 | The port on which the app listens on. Defaults to 8000 if not set. |
| DJANGO_ALLOWED_HOSTS | string | localhost 127.0.0.1 | A list of space separated domains and IPs representing the host/domain names that WYGIWYH site can serve. [Click here](https://docs.djangoproject.com/en/5.1/ref/settings/#allowed-hosts) for more details |
| HTTPS_ENABLED | true\|false | false | Whether to use secure cookies. If this is set to true, the cookie will be marked as “secure”, which means browsers may ensure that the cookie is only sent under an HTTPS connection |
| URL | string | http://localhost http://127.0.0.1 | A list of space separated domains and IPs (with the protocol) representing the trusted origins for unsafe requests (e.g. POST). [Click here](https://docs.djangoproject.com/en/5.1/ref/settings/#csrf-trusted-origins ) for more details |

View File

@@ -15,7 +15,7 @@ services:
- ./frontend/:/usr/src/frontend:z
- wygiwyh_temp:/usr/src/app/temp/
ports:
- "${OUTBOUND_PORT}:8000"
- "${OUTBOUND_PORT:-8000}:${INTERNAL_PORT:-8000}"
env_file:
- .env
depends_on:

View File

@@ -4,7 +4,7 @@ services:
container_name: ${SERVER_NAME}
command: /start-single
ports:
- "${OUTBOUND_PORT}:8000"
- "${OUTBOUND_PORT:-8000}:${INTERNAL_PORT:-8000}"
env_file:
- .env
depends_on:

View File

@@ -4,6 +4,9 @@ set -o errexit
set -o pipefail
set -o nounset
# Set INTERNAL_PORT with default value of 8000
INTERNAL_PORT=${INTERNAL_PORT:-8000}
rm -f /tmp/migrations_complete
python manage.py migrate
@@ -13,4 +16,4 @@ touch /tmp/migrations_complete
python manage.py setup_users
exec python manage.py runserver 0.0.0.0:8000
exec python manage.py runserver 0.0.0.0:$INTERNAL_PORT

View File

@@ -4,6 +4,9 @@ set -o errexit
set -o pipefail
set -o nounset
# Set INTERNAL_PORT with default value of 8000
INTERNAL_PORT=${INTERNAL_PORT:-8000}
# Remove flag file if it exists from previous run
rm -f /tmp/migrations_complete
@@ -15,4 +18,4 @@ touch /tmp/migrations_complete
python manage.py setup_users
exec gunicorn WYGIWYH.wsgi:application --bind 0.0.0.0:8000 --timeout 600
exec gunicorn WYGIWYH.wsgi:application --bind 0.0.0.0:$INTERNAL_PORT --timeout 600