Skip to main content

Deployment Platforms

Deploy marimo notebooks to production environments using cloud platforms, Docker containers, Kubernetes, and more. This guide covers best practices for production deployments across various platforms.

Docker Deployment

Official Docker Images

marimo provides official Docker images for quick deployment:

Custom Dockerfile

Build a custom image with your dependencies:

Docker Compose

Orchestrate multi-container deployments:
Run with:

Cloud Platform Deployment

Railway

Deploy to Railway with one click:
1

Create railway.toml

2

Add requirements.txt

3

Deploy

Connect your GitHub repo to Railway and deploy automatically on push.
See the Railway deployment guide for details.

Hugging Face Spaces

Deploy as a Hugging Face Space:
1

Create README.md

2

Create Dockerfile

3

Push to Hugging Face

Upload files to a new Space and it will build automatically.
See the Hugging Face guide.

Google Cloud Run

Deploy serverless on Google Cloud:

AWS ECS/Fargate

Deploy on AWS Elastic Container Service:

Azure Container Instances

Kubernetes Deployment

Basic Deployment

Deploy to Kubernetes cluster:
See the Kubernetes guide for more details.

HPC and Research Computing

Slurm Clusters

Deploy on HPC clusters with Slurm:
See the Slurm deployment guide.

SkyPilot

Deploy to any cloud with SkyPilot:
Launch:
See the SkyPilot guide.

Reverse Proxy Configuration

Nginx

Configure nginx as reverse proxy:
See the nginx guide for more examples.

Caddy

Use Caddy for automatic HTTPS:
Run:

Environment Configuration

Environment Variables

Configure marimo with environment variables:

Secrets Management

Never commit secrets to version control. Use environment variables, secret managers, or mount secrets as files.

Production Best Practices

Security

1

Use authentication

Enable token authentication or implement custom auth middleware:
2

Run as non-root user

Create and use a dedicated user in Docker:
3

Enable HTTPS

Use TLS/SSL certificates via reverse proxy (nginx, Caddy).
4

Configure CORS

Restrict allowed origins:
5

Use security headers

Add via reverse proxy: HSTS, X-Frame-Options, CSP, etc.

Performance

Optimize production deployments:
  1. Resource limits: Set appropriate CPU/memory limits
  2. Session TTL: Configure based on expected usage:
  3. Connection pooling: For database-backed apps
  4. Caching: Use Redis/Memcached for shared state
  5. Load balancing: Run multiple replicas behind load balancer
  6. Health checks: Configure liveness/readiness probes
  7. Monitoring: Track metrics with Prometheus, Datadog, etc.

Reliability

Monitoring

Monitor your deployment:

Troubleshooting

Common Issues

  • Check firewall rules
  • Verify port binding (0.0.0.0 not 127.0.0.1)
  • Check health endpoint: curl http://localhost:8080/health
  • Configure reverse proxy for WebSocket upgrade
  • Check timeout settings (increase for long operations)
  • Verify SSL/TLS termination handling
  • Increase container memory limits
  • Reduce session TTL to clean up faster
  • Profile memory usage
  • Use more efficient data structures
  • Check resource limits (CPU/memory)
  • Profile application performance
  • Add caching for expensive operations
  • Scale horizontally with more replicas

Examples

Complete Production Setup

Next Steps

Deploy as App

Configure app deployment options

Authentication

Secure your deployment

Docker Guide

Detailed Docker deployment guide

Kubernetes

Advanced Kubernetes patterns