Ralph provides multiple packaging formats to support different deployment scenarios: Debian packages for Ubuntu, Docker images, and Python packages via setup.py.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/allegro/ralph/llms.txt
Use this file to discover all available pages before exploring further.
Python Package (setup.py)
Package Configuration
Ralph uses setuptools for Python packaging. The main configuration is insetup.py:1:
Requirements
Ralph requires Python 3.10 or higher (setup.py:9):
Entry Points
Ralph provides multiple console scripts and extension points: Console Scripts:ralph- Production serverdev_ralph- Development server with additional featurestest_ralph- Test runnervalidate_ralph- Cross-validation tool
back_office.transition_action.email_context- Email context for transitionsaccount.views.get_asset_list_class- Custom asset list viewsralph.cloud_sync_processors- Cloud synchronization processors
setup.py:37 for all entry points.
Version Generation
Ralph uses a shell script to generate versions based on git tags:YYYYMMDD.PATCH (e.g., 20240315.1).
Debian Packages
Ralph provides official Debian packages for Ubuntu usingdh_virtualenv, which packages the application and all dependencies into a self-contained virtualenv.
Why dh_virtualenv?
Ralph’s dependency requirements make traditional Debian packaging challenging. Usingdh_virtualenv provides a compromise between package availability and maintenance effort by:
- Installing all dependencies into a virtualenv
- Packaging the entire virtualenv as a
.debfile - Avoiding conflicts with system Python packages
- Simplifying dependency management
Package Details
Package Name:ralph-core
Build Dependencies (debian/control:5):
debhelper (>= 9)dh-virtualenvgitlibmysqlclient-devpython3 (>=3.10)libffi-devnodejs (>= 22.0.0)npm
debian/control:10):
python3 (>=3.10)libmysqlclient21python3-distutilsdebconf
mysql-serverredis
Building Packages
Ralph supports two build modes: snapshot (testing) and release (production).Building Snapshot Packages
Snapshot packages can be built from any commit for testing purposes:build/ directory with a name like:
- Builds a Docker container with build dependencies
- Generates a snapshot changelog
- Builds the package
- Copies it to
build/ - Cleans up the container
Makefile:33 for implementation.
Building Release Packages
Release packages should be built from tagged commits on theng branch:
Makefile:28 for implementation.
Publishing Packages
Packages are published to packagecloud.io/allegro/ralph by Ralph maintainers. Publishing is triggered automatically when a new GitHub release is created.Docker Images
Ralph provides multiple Docker images for different purposes.Available Images
ralph: Main application imageallegro/ralph:latestallegro/ralph:<VERSION>
allegro/ralph-static-nginx:latestallegro/ralph-static-nginx:<VERSION>
allegro/inkpy:<VERSION>
Makefile:40 for build configuration.
Building Snapshot Docker Images
Build snapshot images for testing:- Build a snapshot Debian package
- Build Docker images using the snapshot package
- Tag images with snapshot version
Makefile:57 for implementation.
Publishing Docker Images
Makefile:73 and Makefile:80 for publishing targets.
Customizing Docker Repository
Set theDOCKER_REPO_NAME variable to push to a different repository:
Package Ecosystem Design
Ralph’s packaging system is designed to be environment-agnostic:Key Principles
- No specific environment required: All operations can be performed using tools a regular Ralph developer already has
- Docker-based builds: Everything runs in Docker containers to avoid platform dependencies
- Container rebuilds: Containers are rebuilt for each operation to avoid IO performance issues with mounted volumes on certain platforms
- Official repository: Packages are published to packagecloud.io, owned by Allegro
- GitHub integration: Package publishing is triggered by creating GitHub releases
Why Docker for Building?
Using Docker for package building provides several benefits:- Platform independence: Developers on macOS, Windows, or Linux can build packages
- Consistent environment: Same build environment for all maintainers
- No system pollution: Build dependencies don’t affect the host system
- Reproducible builds: Same Dockerfile produces same packages
Makefile Targets
Package Management
Docker Images
Development
Makefile:1 for all available targets.
Installation from Packages
Installing Debian Package
Installing from PyPI
Installing from Source
Best Practices
- Use snapshot packages for testing: Never deploy snapshot packages to production
- Verify package contents: After building, inspect the package to ensure all files are included
- Test in containers: Use Docker to test packages in clean environments
- Follow semantic versioning: Version numbers should reflect the release date and patch level
-
Document build dependencies: Keep
debian/controland setup.py requirements in sync -
Clean builds: Always use
--force-rmwith Docker builds to avoid stale layers
Troubleshooting
Build Fails with Missing Dependencies
Ensure all build dependencies are listed indebian/control. Check the build log for specific missing packages.
Version Mismatch
The version is generated from git tags. Ensure you have the latest tags:Docker Build Timeout
Increase Docker’s memory and CPU allocation in Docker Desktop settings.Package Installation Fails
Check that all runtime dependencies are installed:Related Documentation
- Maintainer Tools - Tools for Ralph maintainers
- Development Environment - Setting up your development environment