Skip to content

hyrex-labs/hyrex-python-foss-example

Repository files navigation

Hyrex Docker Compose Example

A Hyrex application with PostgreSQL database running in Docker containers.

Prerequisites

  • Docker
  • Docker Compose

Quick Start

  1. Clone the repository and navigate to the project directory

  2. Build and start the services:

    docker compose up --build

    Or run in detached mode:

    docker compose up -d --build
  3. The application will be available with:

    • PostgreSQL database on u:5432
    • Hyrex worker running and connected to the database
    • Hyrex Studio UI on https//local.hyrex.studio

Configuration

Database Connection

The application connects to PostgreSQL using the following default credentials:

  • Database: hyrex_db
  • User: hyrex_user
  • Password: hyrex_password
  • Host: localhost (from host machine) or postgres (from within Docker network)
  • Port: 5432

Environment Variables

Copy .env.example to .env to customize configuration:

cp .env.example .env

Docker Commands

Start services

docker compose up

Stop services

docker compose down

Stop and remove volumes

docker compose down -v

View logs

docker compose logs -f

View specific service logs

docker compose logs -f app
docker compose logs -f postgres
docker compose logs -f studio

Rebuild containers

docker compose build

Development

Local Development

For local development without Docker:

  1. Create a virtual environment:

    python -m venv venv
    source venv/bin/activate  # On Windows: venv\Scripts\activate
  2. Install dependencies:

    pip install -r requirements.txt
  3. Set up environment variables:

    cp .env.example .env
    # Edit .env with your local database configuration
  4. Run the Hyrex worker:

    hyrex run-worker hyrex_app:app

Project Structure

.
├── Dockerfile           # Docker image configuration
├── docker-compose.yml   # Docker Compose services configuration
├── hyrex_app.py        # Main Hyrex application
├── tasks.py            # Task definitions
├── requirements.txt    # Python dependencies
├── .env.example        # Example environment variables
└── README.md          # This file

Troubleshooting

Database connection issues

  • Ensure PostgreSQL container is healthy: docker compose ps
  • Check logs: docker compose logs postgres
  • Verify environment variables in .env file

Container not starting

  • Check Docker daemon is running
  • Review logs: docker compose logs
  • Ensure ports 5432 is not already in use

Reset everything

docker compose down -v
docker compose up --build

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •