Skip to main content
This guide covers setting up Ralph using Docker containers. This approach provides a consistent development environment across different platforms and requires minimal local dependencies.

Prerequisites

Only Docker is required:
  • Docker 24.0.0 or later
  • docker-compose (usually bundled with Docker Desktop)
On Apple Silicon (M1/M2/M3) Macs, you’ll need to enable x86/amd64 emulation in Docker settings.

Quick Start

1

Clone the repository

2

Start the containers

Launch all services using docker-compose:
This builds and starts:
  • web - Ralph application (port 8000)
  • db - MySQL 5.7 database
  • redis - Redis cache server
  • inkpy - Background job processor
  • nginx - Static file server (port 80)
3

Initialize the database (first run only)

On first launch or after removing the database volume, initialize Ralph:
This command may take several minutes to complete on first run.
This script performs:
  • Database migrations (ralph migrate --noinput)
  • Menu synchronization (ralph sitetree_resync_apps)
  • Superuser creation (username: ralph, password: ralph)

Access Ralph

Once all services are running, access Ralph at:
Default credentials:
  • Username: ralph
  • Password: ralph

Docker Architecture

Service Overview

The docker/docker-compose-local-dev.yml defines these services:
docker/docker-compose-local-dev.yml

Volume Mounts

The web container mounts your local source directory:
This means:
  • Code changes are immediately reflected in the container
  • You can edit files on your host machine
  • No container rebuild needed for code changes

Database Persistence

Database data is stored in a Docker volume:
To reset the database:

Development Workflow

Rebuilding Static Assets

When you modify JavaScript, CSS, or install new npm packages:
This script:
  1. Runs npm install to update dependencies
  2. Executes gulp to rebuild static files
Known Issue: Static file building may fail or hang on Apple Silicon using Rosetta emulation. If this occurs, try rebuilding the container or running static builds on the host machine instead.

Viewing Logs

Monitor all services:
View specific service logs:

Running Django Management Commands

Execute Django commands inside the web container:

Running Tests

Execute the test suite:
Run specific tests:

Accessing the Container Shell

Open a bash session in the web container:

PyCharm IDE Integration

Ralph supports remote Python interpreter configuration in PyCharm Professional.
1

Add Docker interpreter

  1. Go to Settings → Project: ralph → Python Interpreter
  2. Click Add Interpreter → On Docker
  3. Select docker/Dockerfile-local-interpreter as the Dockerfile
  4. Change context folder to . (project root)
2

Configure platform (Apple Silicon only)

If using Apple Silicon architecture:Under Options → Build options, add:
This requires amd64 emulation enabled in Docker Desktop.
3

Verify interpreter

After clicking Next:
  • Verify the interpreter path is correct
  • Confirm all Ralph dependencies are detected

Container Build Details

The development Dockerfile (docker/Dockerfile-local-dev) is based on Ubuntu Jammy and includes:

System Packages

Entry Point Script

The container runs /opt/local/docker-local-dev-entrypoint.sh:
docker/provision/docker-local-dev-entrypoint.sh
This automatically:
  1. Installs Python dependencies
  2. Builds static files if missing
  3. Starts the development server

Environment Variables

Customize container behavior with environment variables:

Useful Commands

Container Management

Database Operations

Troubleshooting

Port Already in Use

If port 80 or 8000 is already bound:

Container Won’t Start

Check logs for errors:
Common issues:
  • Platform mismatch (use --platform linux/amd64 on ARM)
  • Out of disk space
  • Port conflicts

Static Files Not Building

On Apple Silicon, Node.js builds may hang. Try:
  1. Build static files on host:
  2. Or disable Rosetta emulation in Docker settings

Database Connection Failed

Ensure the database container is healthy:
Wait for MySQL to fully initialize (may take 30-60 seconds on first run).

Comparison with Local Setup

Next Steps

Local Setup

Switch to local development setup

Architecture

Learn about Ralph’s architecture