|
| 1 | +# Deployment Guide for stac-fastapi-eodag |
| 2 | + |
| 3 | +This document provides guidance on deploying stac-fastapi-eodag in production environments, with specific focus on configuration management and graceful shutdowns. |
| 4 | + |
| 5 | +## Automatic Configuration Reloading with Reloader |
| 6 | + |
| 7 | +The stac-fastapi-eodag Helm chart supports automatic configuration reloading using [Reloader](https://github.com/stakater/Reloader). This allows pods to be automatically restarted when ConfigMaps or Secrets are updated. |
| 8 | + |
| 9 | +### Available Reloader Annotations |
| 10 | + |
| 11 | +| Annotation | Purpose | Example | |
| 12 | +|------------|---------|---------| |
| 13 | +| `configmap.reloader.stakater.com/reload` | Restart pods when specified ConfigMaps change | `"config-name1,config-name2"` | |
| 14 | +| `secret.reloader.stakater.com/reload` | Restart pods when specified Secrets change | `"secret-name1,secret-name2"` | |
| 15 | +| `reloader.stakater.com/auto` | Auto-discover and reload on any ConfigMap/Secret change | `"true"` | |
| 16 | + |
| 17 | +### Example Configuration |
| 18 | + |
| 19 | +```yaml |
| 20 | +# values.yaml |
| 21 | +deployment: |
| 22 | + annotations: |
| 23 | + # Reload when main config changes |
| 24 | + configmap.reloader.stakater.com/reload: "stac-fastapi-eodag-config,data-repo-commit-hash" |
| 25 | + # Reload when credentials change |
| 26 | + secret.reloader.stakater.com/reload: "eodag-server-credentials" |
| 27 | +``` |
| 28 | +
|
| 29 | +### Installing Reloader |
| 30 | +
|
| 31 | +If Reloader is not already installed in your cluster, you can install it using: |
| 32 | +
|
| 33 | +```bash |
| 34 | +# Using Helm |
| 35 | +helm repo add stakater https://stakater.github.io/stakater-charts |
| 36 | +helm repo update |
| 37 | +helm install reloader stakater/reloader |
| 38 | + |
| 39 | +# Or using kubectl |
| 40 | +kubectl apply -f https://raw.githubusercontent.com/stakater/Reloader/master/deployments/kubernetes/reloader.yaml |
| 41 | +``` |
| 42 | + |
| 43 | +## Graceful Shutdown with terminationGracePeriodSeconds |
| 44 | + |
| 45 | +The `terminationGracePeriodSeconds` parameter controls how long Kubernetes waits before forcefully killing a pod during shutdown. This is crucial for stac-fastapi-eodag when handling long-running operations like data downloads. |
| 46 | + |
| 47 | +### Configuring Termination Grace Period |
| 48 | + |
| 49 | +```yaml |
| 50 | +# values.yaml |
| 51 | +# Default Kubernetes value is 30 seconds |
| 52 | +terminationGracePeriodSeconds: 7200 # 2 hours for long downloads |
| 53 | +``` |
| 54 | +
|
| 55 | +### Troubleshooting |
| 56 | +
|
| 57 | +If pods are being forcefully killed: |
| 58 | +
|
| 59 | +1. **Increase Grace Period**: Adjust `terminationGracePeriodSeconds` |
| 60 | +2. **Check Application Logs**: Ensure the app handles SIGTERM |
| 61 | +3. **Monitor Resource Usage**: High CPU/memory might slow shutdown |
| 62 | +4. **Review Health Checks**: Ensure probes don't interfere with shutdown |
0 commit comments