Skip to content

Make PyGeoAPI to run rootless (Tested in Openshift) #2088

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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

cmotadev
Copy link
Contributor

Overview

This PR aims to modify mininal things in entrypoint script to allow the container to run as a non-root user. This is specially important to Openshift because it was denied by default to run rooted containers.

this PR could be summarized in two items:

  1. Allow to modify PYGEOAPI_CONFIG e PYGEOAPI_OPENAPI in runtime.
  2. Remove the necessity to chmod python files on hot reload execution, due of using less privileged uids.

This is important because the entrypoint script tries to generate OpenAPI yaml, and the pygeoapi executable can't create on his own dir. We set the env to write in /tmp dir.

Related Issue / discussion

Add/Update container offerings: #1753

Additional information

This two modifications, in addition to set CONTAINER_PORT > 1024 (we used 8080) allowed us to run pygeoapi in OpenShift with default security configurations.

docker run example:

# Using a local-builded image
docker run \
  -p 5000:8080 \
  -d \
  --rm \
  -v ./pygeoapi-config.yml:/tmp/local.config.yml \
  -e "PYGEOAPI_CONFIG=/tmp/local.config.yml" \
  -e "PYGEOAPI_OPENAPI=/tmp/local.openapi.yml" \
  -e "CONTAINER_PORT=8080" \
  -u 1000 
ndscprm/pygeoapi:dev run-with-hot-reload

Dependency policy (RFC2)

  • I have ensured that this PR meets RFC2 requirements

Updates to public demo

Contributions and licensing

(as per https://github.com/geopython/pygeoapi/blob/master/CONTRIBUTING.md#contributions-and-licensing)

  • I'd like to contribute [feature X|bugfix Y|docs|something else] to pygeoapi. I confirm that my contributions to pygeoapi will be compatible with the pygeoapi license guidelines at the time of contribution
  • I have already previously agreed to the pygeoapi Contributions and Licensing Guidelines

@cmotadev
Copy link
Contributor Author

This commit does the same as this PR: #2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant