Skip to content

feat: modify s3 to use urlib3#4

Open
razbroc wants to merge 14 commits into
masterfrom
feat/modS3-to-urlib3
Open

feat: modify s3 to use urlib3#4
razbroc wants to merge 14 commits into
masterfrom
feat/modS3-to-urlib3

Conversation

@razbroc

@razbroc razbroc commented Apr 14, 2026

Copy link
Copy Markdown
Collaborator

This pull request introduces several important improvements to the build and deployment process, focusing on enhanced Redis and S3 cache resilience, support for custom patching of MapProxy cache backends, and improved Kubernetes/Helm integration. The changes include new environment defaults for Redis, mechanisms for patching MapProxy's Redis and S3 cache modules at build time, and the addition of Helm chart files for Kubernetes deployments.

Key changes:

MapProxy Cache Backend Patching & Resilience

  • Added support for applying custom patches to MapProxy's redis.py and s3.py cache backends at build time using bind mounts in the Dockerfile. This allows for hotfixes or customizations without modifying upstream images. Patch application is controlled via the PATCH_FILES build argument.
  • Introduced a custom-patched redis.py with improved error handling, connection resilience, and support for environment-configured timeouts and SSL options for Redis cache operations.
  • Added a custom-patched s3.py with enhanced error handling and support for alternate S3 endpoints, credentials, and HTTP fallback for S3 cache operations.
  • Added new environment variables for Redis connection resilience (timeouts, SSL, health checks) to the Dockerfile defaults.

Kubernetes & Helm Integration

  • Added a new helm/Chart.yaml and .helmignore file to support Helm-based Kubernetes deployments, including dependencies on nginx and mclabels charts. [1] [2]
  • Improved the entrypoint.sh script to better support Kubernetes by ensuring required directories are created and providing clearer error messages if the uWSGI config is missing (as provided by a ConfigMap).

These changes collectively improve the reliability, configurability, and deployability of the MapProxy service in modern containerized environments.

@razbroc
razbroc changed the base branch from refactor/orgnize-dockerfile-structure to master April 15, 2026 13:22
Comment thread config/patch/redis.py

ssl_enabled = get_redis_variable("REDIS_TLS")
cert_reqs = os.environ.get("SSL_CERT_REQS", None)
health_check_interval = int(os.environ.get("REDIS_HEALTH_CHECK_INTERVAL", "0"))

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is that nessacery?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When set to 0 (the default), it's disabled. When set to a positive integer (seconds), the redis client periodically sends a PING to the server on idle connections to detect broken connections early — at the cost of extra network traffic.

it's intentionally disabled — the socket timeouts already handle unresponsive Redis quickly enough without needing background keepalive pings.

i suppose it's nice to have as an option

Comment thread config/patch/redis.py
"retry_on_timeout": False,
}

if username:

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if username is defined does it mean all http requests should be included within the request?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not relevant

Comment thread config/patch/s3.py Outdated
pass

def __getattr__(self, name):
return getattr(self.wrapped, name) No newline at end of file

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

EOF

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

kk

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add tgz file to gitignore

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

kk

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add tgz file to gitignore

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

kk

Comment thread helm/.helmignore

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

EOF

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

kk

Comment thread helm/Chart.lock

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add to git ignore

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

kk

Comment thread Dockerfile
# errors return False (cache-miss) so MapProxy falls back to the next source.
# REDIS_POOL_TIMEOUT: max seconds to wait for a free connection from the pool.
# SSL_CERT_REQS: server-cert verification ('required'/'optional'/'none').
ENV SOCKET_TIMEOUT_SECONDS="0.1" \

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

check if needed

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This controls how long Redis operations (reads/writes) can block before timing out. Without it, a slow or unresponsive Redis would stall the tile request indefinitely

Comment thread Dockerfile Outdated
SSL_CERT_REQS="required"

# Environment defaults — uWSGI tuning
ENV PROCESSES="6" \

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

check if needed

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

removed

Comment thread src/app.py Outdated
"access-control-max-age",
}

if os.getenv("CORS_ENABLED", "false").lower() == "true":

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this CORS section should be handled by the nginx after the upgrade

@razbroc razbroc Apr 26, 2026

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we decided to remove as this can be configured in mapproxy yaml

… update related documentation

Co-authored-by: Copilot <copilot@github.com>
@razbroc
razbroc requested a review from CL-SHLOMIKONCHA April 26, 2026 10:19
Co-authored-by: Copilot <copilot@github.com>
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.

2 participants