Skip to content

Commit

Permalink
Merge branch 'bind-port-from-env' into 'main'
Browse files Browse the repository at this point in the history
Specify port and interface in app.env

See merge request reportcreator/reportcreator!395
  • Loading branch information
MWedl committed Jan 8, 2024
2 parents 9b50fa6 + 12a0b3b commit bb9f8f7
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 1 deletion.
3 changes: 3 additions & 0 deletions deploy/app.env.example
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ SECRET_KEY="TODO-change-me-Z6cuMithzO0fMn3ZqJ7nTg0YJznoHiJXoJCNngQM4Kqzzd3fiYKdV
# https://docs.sysreptor.com/setup/configuration/#fido2webauthn
# MFA_FIDO2_RP_ID="sysreptor.example.com"

# https://docs.sysreptor.com/setup/configuration/#bind-to-different-port-or-interface
BIND_PORT="127.0.0.1:8000:8000"

# Do not use debug mode in production environments
# https://docs.sysreptor.com/setup/configuration/#debug-mode
DEBUG=off
Expand Down
2 changes: 1 addition & 1 deletion deploy/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ services:
expose:
- 8000
ports:
- "127.0.0.1:8000:8000"
- ${BIND_PORT:-127.0.0.1:8000:8000}
environment:
DATABASE_HOST: db
DATABASE_NAME: reportcreator
Expand Down
13 changes: 13 additions & 0 deletions docs/docs/setup/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,19 @@ ENCRYPTION_KEYS='[{"id": "TODO-change-me-unique-key-id-5cdda4c0-a16c-4ae2-8a16-a
DEFAULT_ENCRYPTION_KEY_ID="TODO-change-me-unique-key-id-5cdda4c0-a16c-4ae2-8a16-aa2ff258530d"
```

### Bind to different port or interface
SysReptor is bound to port 8000 on localhost by default. If you want to bind it to a different port, use the `BIND_PORT` environment variable.
The format is `IP:HOST_PORT:CONTAINER_PORT`(note that `CONTAINER_PORT` should always be 8000).

``` title="Examples:"
BIND_PORT="127.0.0.1:8000:8000"
BIND_PORT="127.0.0.1:80:8000" # Bind to localhost port 80
BIND_PORT="8000:8000" # Bind to all interfaces
BIND_PORT="1.1.1.1:8000:8000" # Bind to dedicated interface
```

Binding SysReptor to a publicly reachable network port exposes the application to untrusted networks without encryption. We recommend setting up a [web server](webserver/).

### Debug mode
Debug mode enables Django's debug toolbar and stack traces. Do not use debug mode in production environments.

Expand Down

0 comments on commit bb9f8f7

Please sign in to comment.