-
Notifications
You must be signed in to change notification settings - Fork 27
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Set root-path from uvicorn #221
Conversation
Sets the root path in uvicorn to match that set via FastAPI. This is required with updates to starlette, which were included previously. Fixes microsoft/PlanetaryComputer#360
@@ -16,7 +16,7 @@ services: | |||
- azurite | |||
- redis | |||
command: > | |||
bash -c "pypgstac pgready && uvicorn pcstac.main:app --host 0.0.0.0 --port 8081 --reload --proxy-headers" | |||
bash -c "pypgstac pgready && uvicorn pcstac.main:app --host 0.0.0.0 --port 8081 --reload --proxy-headers --root-path '/stac'" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Locally, this is the actual fix to the issue.
# is typically set via the APP_ROOT_PATH environment variable. | ||
ENV APP_ROOT_PATH="" | ||
|
||
CMD uvicorn pcstac.main:app --host ${APP_HOST} --port ${APP_PORT} --root-path ${APP_ROOT_PATH} --log-level info |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Similarly, this fixes the issue in the deployed environment. APP_ROOT_PATH
is already set in the Helm chart.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just confirming the behavior here: The "default" APP_ROOT_PATH
is set to ""
, but if the Helm chart defines it it'll override that?
And is the default of ""
is correct? Not "/"
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In practice, I didn't want to give it a default value. Locally and on PCT, it's /stac
and in PC its /api/stac/v1
. The value is always set by either docker-compose or helm. I believe you need to declare the ENV in order for it be available when the container is run.
RUN --mount=type=cache,target=/root/.cache \ | ||
--mount=type=bind,source=requirements-dev.txt,target=requirements-dev.txt \ | ||
pip install -r requirements-dev.txt | ||
|
||
RUN --mount=type=cache,target=/root/.cache \ | ||
pip install -e ./pccommon[dev] -e ./pcstac | ||
pip install --no-deps -e ./pccommon[dev] -e ./pcstac |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ensures that pcstac dependencies aren't overwritten by pccommon
flake8==3.8.4 | ||
isort==5.9.2 | ||
mypy==1.8.0 | ||
openapi-spec-validator==0.3.0 | ||
cachetools<=4.2. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not a dev dependency and conflicted with installed dependencies on server images.
Description
Sets the root path in uvicorn to match that set via FastAPI. This is required with updates to starlette, which were included previously.
Fixes microsoft/PlanetaryComputer#360
Also updates the tests to more closely match the FastAPI setup (including the use of root_path) as well as ensures that the dev dependencies are equivalent to those in the running container.