GitHub user dosubot[bot] added a comment to the discussion: Production 
deployment issue in

<!-- Answer -->
The error happens because the redis Python module is missing in your running 
containers. Installing it at runtime with bootstrapScript or extraPipPackages 
is unreliable for production—these only affect some pods and not always before 
the app starts, so you get ModuleNotFoundError and CrashLoopBackOff.

The robust solution is to build a custom Docker image that includes all 
required Python dependencies (like redis and psycopg2-binary) ahead of time. 
This ensures every Superset pod (web, worker, init) has what it needs at 
startup, and is the recommended approach for production deployments with Helm 
[reference](https://github.com/apache/superset/issues/33691).

Here’s how you can do it:

1. **Create a Dockerfile** based on your current image (e.g., 
preset/superset:latest-python3.9):

   ```dockerfile
   FROM preset/superset:latest-python3.9
   RUN pip install --no-cache-dir redis psycopg2-binary
   ```

2. **Build and push** your image to your registry (Docker Hub, Azure Container 
Registry, etc):

   ```sh
   docker build -t <your-registry>/superset-custom:latest .
   docker push <your-registry>/superset-custom:latest
   ```

3. **Update your Helm values.yaml** to use your custom image:

   ```yaml
   image:
     repository: <your-registry>/superset-custom
     tag: latest
   ```

4. **Remove pip install lines for redis/psycopg2-binary** from bootstrapScript 
and extraPipPackages, since they’re now in the image.

5. **Redeploy with Helm**. All pods should now start without the redis module 
error.

This approach is reliable and matches best practices for production 
[reference](https://github.com/apache/superset/blob/b7ad8dba89efbd674c2fa20659dfab0e1723c2aa/helm/superset/README.md).
 If you need to add more Python packages in the future, just update your 
Dockerfile and repeat the build/push steps.

Let me know if you need a more detailed example or run into any issues with the 
custom image build!


<!-- Dosu Comment Footer -->
*To reply, just mention [@dosu](https://go.dosu.dev/dosubot).*

---
<sup>How did I do? 
[Good](https://app.dosu.dev/response-feedback/973df892-6e8f-4665-8de8-2238704fd6b9?feedback_type=great_response)
 | 
[Irrelevant](https://app.dosu.dev/response-feedback/973df892-6e8f-4665-8de8-2238704fd6b9?feedback_type=irrelevant_answer)
 | 
[Incorrect](https://app.dosu.dev/response-feedback/973df892-6e8f-4665-8de8-2238704fd6b9?feedback_type=incorrect_sources)
 | 
[Verbose](https://app.dosu.dev/response-feedback/973df892-6e8f-4665-8de8-2238704fd6b9?feedback_type=too_verbose)
 | 
[Hallucination](https://app.dosu.dev/response-feedback/973df892-6e8f-4665-8de8-2238704fd6b9?feedback_type=hallucination)
 | [Report 
🐛](https://app.dosu.dev/response-feedback/973df892-6e8f-4665-8de8-2238704fd6b9?feedback_type=bug_report)
 | 
[Other](https://app.dosu.dev/response-feedback/973df892-6e8f-4665-8de8-2238704fd6b9?feedback_type=other)</sup>&nbsp;&nbsp;[![Join
 
Discord](https://img.shields.io/badge/join-5865F2?logo=discord&logoColor=white&label=)](https://go.dosu.dev/discord-bot)&nbsp;[![Sh
 are on 
X](https://img.shields.io/badge/X-share-black)](https://twitter.com/intent/tweet?text=%40dosu_ai%20helped%20me%20solve%20this%20issue!&url=https%3A//github.com/apache/superset/issues/33945)

GitHub link: 
https://github.com/apache/superset/discussions/33957#discussioncomment-13599735

----
This is an automatically sent email for [email protected].
To unsubscribe, please send an email to: 
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to