# How to Run MoneyPrinterTurbo as a Service: Docker and Systemd Deployment Guide

> Deploy MoneyPrinterTurbo as a service using Docker Compose or systemd. Learn to run this background process efficiently and access its API and Web UI.

- Repository: [Harry/MoneyPrinterTurbo](https://github.com/harry0703/MoneyPrinterTurbo)
- Tags: how-to-guide
- Published: 2026-03-23

---

**Run MoneyPrinterTurbo as a persistent background service using either Docker Compose for containerized deployments or systemd for native Linux process management, exposing the API on port 8080 and the Web UI on port 8501.**

MoneyPrinterTurbo is an open-source AI video generation platform that ships with two distinct runtime components. Deploying it as a service requires orchestrating both the FastAPI backend and the Streamlit frontend to run continuously and restart automatically on failure. This guide covers production-ready deployment strategies using the official source files from the `harry0703/MoneyPrinterTurbo` repository.

## Architecture Overview

MoneyPrinterTurbo operates as two independent processes that share the same codebase but serve different traffic patterns.

### The Two-Process Architecture

| Component | Entry Point | Default Port | Protocol |
|-----------|-------------|--------------|----------|
| **API Service** | [`main.py`](https://github.com/harry0703/MoneyPrinterTurbo/blob/main/main.py) | **8080** | HTTP REST (Uvicorn/FastAPI) |
| **Web UI** | [`webui/Main.py`](https://github.com/harry0703/MoneyPrinterTurbo/blob/main/webui/Main.py) | **8501** | Streamlit interactive interface |

The **API service** defined in [`main.py`](https://github.com/harry0703/MoneyPrinterTurbo/blob/main/main.py) launches a Uvicorn ASGI server that mounts the FastAPI application from `app/asgi:app`. It exposes REST endpoints under `app/controllers/v1/*.py` for programmatic video generation. The **Web UI** defined in [`webui/Main.py`](https://github.com/harry0703/MoneyPrinterTurbo/blob/main/webui/Main.py) renders a browser-based interface that imports services directly from `app.services.llm` and `app.services.voice`, though it can optionally be configured to call the external API.

### Key Source Files

Understanding the entry points is critical for service configuration:

- **[`main.py`](https://github.com/harry0703/MoneyPrinterTurbo/blob/main/main.py)** – Executes `uvicorn.run()` with the ASGI app, reading configuration from [`app/config/config.py`](https://github.com/harry0703/MoneyPrinterTurbo/blob/main/app/config/config.py) which loads [`config.toml`](https://github.com/harry0703/MoneyPrinterTurbo/blob/main/config.toml).
- **[`webui/Main.py`](https://github.com/harry0703/MoneyPrinterTurbo/blob/main/webui/Main.py)** – The Streamlit entry point that renders the graphical interface.
- **[`docker-compose.yml`](https://github.com/harry0703/MoneyPrinterTurbo/blob/main/docker-compose.yml)** – Orchestrates both services with shared volumes for configuration persistence.
- **[`webui.sh`](https://github.com/harry0703/MoneyPrinterTurbo/blob/main/webui.sh)** – Convenience shell script that wraps the `streamlit run` command with default flags.

## Method 1: Docker Compose Deployment

Docker Compose is the recommended approach for production deployments, as the `Dockerfile` pre-installs system dependencies including **ffmpeg** and **ImageMagick**, ensuring consistent runtime environments.

### Prerequisites and Setup

Clone the repository and prepare the configuration:

```bash
git clone https://github.com/harry0703/MoneyPrinterTurbo.git
cd MoneyPrinterTurbo

# Create runtime configuration from template

cp config.example.toml config.toml

```

Edit [`config.toml`](https://github.com/harry0703/MoneyPrinterTurbo/blob/main/config.toml) to configure your LLM provider API keys and storage paths according to the settings defined in [`app/config/config.py`](https://github.com/harry0703/MoneyPrinterTurbo/blob/main/app/config/config.py).

### Building and Starting Services

Build the image and launch both services in detached mode:

```bash
docker compose build
docker compose up -d

```

The [`docker-compose.yml`](https://github.com/harry0703/MoneyPrinterTurbo/blob/main/docker-compose.yml) defines two services:
- **`api`** – Runs `python main.py` exposing port **8080**
- **`webui`** – Runs `streamlit run webui/Main.py` exposing port **8501**

Both services mount the host's [`config.toml`](https://github.com/harry0703/MoneyPrinterTurbo/blob/main/config.toml) and `storage/` directory as volumes, ensuring that video outputs and configuration changes persist across container restarts.

### Verification

Confirm both containers are healthy:

```bash
docker ps
curl http://localhost:8080/docs  # Access Swagger UI

open http://localhost:8501       # Access Streamlit interface

```

To stop the services:

```bash
docker compose down

```

## Method 2: Systemd Service Deployment

For bare-metal Linux servers, systemd provides native process supervision with automatic restart capabilities and log aggregation via journalctl.

### Installation Steps

Install the code and dependencies to a dedicated directory:

```bash
sudo mkdir -p /opt/moneyprinterturbo
sudo chown $(whoami):$(whoami) /opt/moneyprinterturbo
git clone https://github.com/harry0703/MoneyPrinterTurbo.git /opt/moneyprinterturbo

# Create unprivileged service user

sudo useradd -r -s /usr/sbin/nologin moneyprinter

# Install system dependencies

sudo apt-get update && sudo apt-get install -y ffmpeg imagemagick

# Install Python dependencies in virtual environment

cd /opt/moneyprinterturbo
python3 -m venv venv
source venv/bin/activate
pip install -r requirements.txt

# Copy and edit configuration

cp config.example.toml config.toml

# Edit config.toml with your API keys

```

### API Service Unit

Create `/etc/systemd/system/moneyprinterturbo-api.service`:

```ini
[Unit]
Description=MoneyPrinterTurbo API Service
After=network.target

[Service]
WorkingDirectory=/opt/moneyprinterturbo
ExecStart=/opt/moneyprinterturbo/venv/bin/python /opt/moneyprinterturbo/main.py
Environment="PYTHONPATH=/opt/moneyprinterturbo"
Restart=on-failure
User=moneyprinter
Group=moneyprinter

[Install]
WantedBy=multi-user.target

```

### Web UI Service Unit

Create `/etc/systemd/system/moneyprinterturbo-webui.service`:

```ini
[Unit]
Description=MoneyPrinterTurbo Web UI (Streamlit)
After=network.target

[Service]
WorkingDirectory=/opt/moneyprinterturbo
ExecStart=/opt/moneyprinterturbo/venv/bin/streamlit run ./webui/Main.py \
    --browser.serverAddress=0.0.0.0 \
    --server.enableCORS=True \
    --browser.gatherUsageStats=False
Environment="PYTHONPATH=/opt/moneyprinterturbo"
Restart=on-failure
User=moneyprinter
Group=moneyprinter

[Install]
WantedBy=multi-user.target

```

### Managing Systemd Services

Enable and start both services:

```bash
sudo cp moneyprinterturbo-api.service /etc/systemd/system/
sudo cp moneyprinterturbo-webui.service /etc/systemd/system/
sudo systemctl daemon-reload

sudo systemctl enable --now moneyprinterturbo-api.service
sudo systemctl enable --now moneyprinterturbo-webui.service

```

Monitor status and logs:

```bash
sudo systemctl status moneyprinterturbo-api.service
journalctl -u moneyprinterturbo-webui.service -f

```

## Essential Commands Reference

| Task | Docker Compose | Systemd |
|------|---------------|---------|
| **Start services** | `docker compose up -d` | `sudo systemctl start moneyprinterturbo-api.service` |
| **View logs** | `docker compose logs -f` | `journalctl -u moneyprinterturbo-api.service -f` |
| **Restart** | `docker compose restart` | `sudo systemctl restart moneyprinterturbo-api.service` |
| **Stop** | `docker compose down` | `sudo systemctl stop moneyprinterturbo-api.service` |

## Summary

- **MoneyPrinterTurbo** consists of two distinct services: a **FastAPI backend** ([`main.py`](https://github.com/harry0703/MoneyPrinterTurbo/blob/main/main.py)) on port 8080 and a **Streamlit frontend** ([`webui/Main.py`](https://github.com/harry0703/MoneyPrinterTurbo/blob/main/webui/Main.py)) on port 8501.
- **Docker Compose** provides the simplest deployment path, handling dependency installation via the `Dockerfile` and ensuring consistent environments across hosts.
- **Systemd** offers tighter integration with Linux host systems, providing automatic startup on boot and centralized logging through `journalctl`.
- Both methods require the [`config.toml`](https://github.com/harry0703/MoneyPrinterTurbo/blob/main/config.toml) file for LLM API keys and ffmpeg paths, loaded at runtime by [`app/config/config.py`](https://github.com/harry0703/MoneyPrinterTurbo/blob/main/app/config/config.py).

## Frequently Asked Questions

### What ports does MoneyPrinterTurbo use by default?

The API service binds to **port 8080** and serves the REST API with Swagger documentation available at `/docs`. The Web UI service binds to **port 8501** and provides the Streamlit graphical interface. These ports are hardcoded in the default startup commands but can be modified via environment variables or command-line arguments in your service definitions.

### Can I run only the API without the Web UI?

Yes. The components are decoupled by design. To run only the API service, start [`main.py`](https://github.com/harry0703/MoneyPrinterTurbo/blob/main/main.py) directly without launching [`webui/Main.py`](https://github.com/harry0703/MoneyPrinterTurbo/blob/main/webui/Main.py). This is useful for headless deployments where you intend to interact with MoneyPrinterTurbo programmatically via the REST API rather than through the browser interface.

### How do I persist data when using Docker Compose?

The [`docker-compose.yml`](https://github.com/harry0703/MoneyPrinterTurbo/blob/main/docker-compose.yml) mounts the `./storage` directory from the host into the container. All generated videos, audio files, and temporary assets are written to this directory by the service layer (`app/services`). Ensure this directory has appropriate permissions for the container user or bind-mount to a specific host path in your compose override file.

### Where are the logs stored when running as a systemd service?

Systemd captures stdout and stderr from both the API and Web UI processes in the system journal. Access logs using `journalctl -u moneyprinterturbo-api.service` for the backend and `journalctl -u moneyprinterturbo-webui.service` for the frontend. Add the `-f` flag to follow logs in real-time, similar to `tail -f`.