Skip to content

Commit 7d32cea

Browse files
authored
chore/Allow for a different server port via env var (Unstructured-IO#410)
Closes Unstructured-IO#409 Use PORT in app-start.sh to allow us to change the server port. To verify, make sure that these commands both run the server at the expected port: ``` make docker-build docker run -p 9200:9200 -e PORT=9200 -it --rm pipeline-family-general-dev:latest curl localhost:9200/healthcheck {"healthcheck":"HEALTHCHECK STATUS: EVERYTHING OK!"} docker run -p 8000:8000 -it --rm pipeline-family-general-dev:latest curl localhost:8000/healthcheck {"healthcheck":"HEALTHCHECK STATUS: EVERYTHING OK!"} ```
1 parent 386df41 commit 7d32cea

File tree

3 files changed

+14
-4
lines changed

3 files changed

+14
-4
lines changed

CHANGELOG.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
## 0.0.67-dev1
1+
## 0.0.67
22

3+
* Allow for a different server port with the PORT variable
34
* Change pdf_infer_table_structure parameter from being disabled in auto strategy.
45

56
## 0.0.66

README.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -407,7 +407,13 @@ docker pull downloads.unstructured.io/unstructured-io/unstructured-api:latest
407407
Once pulled, you can launch the container as a web app on localhost:8000.
408408

409409
```bash
410-
docker run -p 8000:8000 -d --rm --name unstructured-api downloads.unstructured.io/unstructured-io/unstructured-api:latest --port 8000 --host 0.0.0.0
410+
docker run -p 8000:8000 -d --rm --name unstructured-api downloads.unstructured.io/unstructured-io/unstructured-api:latest
411+
```
412+
413+
You can pass in a PORT variable to run the server on a different port in the container.
414+
415+
```bash
416+
docker run -p 9500:9500 -d --rm --name unstructured-api -e PORT=9500 downloads.unstructured.io/unstructured-io/unstructured-api:latest
411417
```
412418

413419
## Security Policy

scripts/app-start.sh

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
#!/usr/bin/env bash
22

3+
export PORT=${PORT:-8000}
4+
35
NUMREGEX="^[0-9]+$"
46
GRACEFUL_SHUTDOWN_PERIOD_SECONDS=3600
57
TIMEOUT_COMMAND='timeout'
@@ -21,8 +23,9 @@ fi
2123

2224
${OPTIONAL_TIMEOUT} \
2325
uvicorn prepline_general.api.app:app \
24-
--log-config logger_config.yaml \
25-
--host 0.0.0.0
26+
--log-config logger_config.yaml \
27+
--host 0.0.0.0 \
28+
--port "$PORT"
2629

2730
echo "Server was shutdown"
2831
[ -n "$MAX_LIFETIME_SECONDS" ] && echo "Reached timeout of $MAX_LIFETIME_SECONDS seconds"

0 commit comments

Comments
 (0)