Self-Hosted Deployment
Learn how to deploy your Motia project to production using motia-docker
Run your Motia app in Docker containers. Same environment everywhere - dev, staging, production.
Quick Start
Important: Run these commands from your project root (where your package.json is).
Getting ENOENT: no such file or directory, open package.json?
You're not in your project directory. Run cd /path/to/your/project first.
Manual Docker Setup
Want more control? Build it yourself.
The docker setup command creates a Dockerfile for you, but here's what's in it:
Python Steps?
If you have Python steps, uncomment this line in the Dockerfile:
And make sure you have a requirements.txt file in your project.
.dockerignore
Create a .dockerignore file to keep your image small:
Build and Run Manually
Build your image
Run it
Open http://localhost:3000 - your app should be running!
Deploy to Cloud
AWS Lightsail
Lightsail needs ARM. Update your Dockerfile:
Then build and deploy.
Railway
Connect your GitHub repo. Railway detects the Dockerfile automatically.
Fly.io
Create fly.toml:
Deploy: fly deploy
Render
Create a Web Service, point to your repo. Render builds automatically.
Configuring Adapters for Production
When deploying multiple Motia instances, you need distributed adapters to share state, events, and streams across instances. Without them, each instance operates in isolation.
When to Use Distributed Adapters
Use default adapters when:
- Running a single Motia instance
- Development and testing
- Simple deployments
Use distributed adapters when:
- Running multiple Motia instances (horizontal scaling)
- Production deployments requiring high availability
- Need shared state/events/streams across instances
Docker Compose with Redis
For production deployments, use Docker Compose to run Motia with Redis:
Configure Adapters in motia.config.ts
Update your configuration to use distributed adapters:
Install Adapter Packages
Add the adapter packages to your package.json:
Scaling Multiple Instances
With distributed adapters configured, you can scale to multiple instances:
All instances share the same state, events, and streams through Redis and RabbitMQ.
Without distributed adapters, each Motia instance has isolated state and events. Use Redis/RabbitMQ adapters for multi-instance deployments.
Resources
- Docker Hub - Official Motia image
- Example Project - Full deployment example
- CLI Reference - All docker commands