Skip to content

Files

Latest commit

 

History

History

docker

Docker Commands

Docker Build

# Build all services
VERSION=dev docker compose -f docker-compose.build.yaml build

# Build a specific service alone
VERSION=dev docker compose -f docker-compose.build.yaml build frontend

Docker Run

NOTE: First copy sample.*.env files to *.env and update as required.

# Up all services
VERSION=dev docker compose -f docker-compose.yaml up -d

# Up a specific service alone
VERSION=dev docker compose -f docker-compose.yaml up -d frontend

Now access frontend at http://frontend.unstract.localhost

Docker Build and Run Optional Services

Some services are kept optional and will not be built or started by default. Run them as follows.

# Build optional services also
VERSION=dev docker compose -f docker-compose.build.yaml --profile optional build
# Up optional services also
VERSION=dev docker compose -f docker-compose.yaml --profile optional up -d

Overriding a service's config

By making use of the merge compose files feature its possible to override some configuration that's used by the services.

Copy and rename the sample.compose.override.yaml to compose.override.yaml and update it as necessary.

cp sample.compose.override.yaml compose.override.yaml

# Configuration in docker-compose.yaml gets overridden
VERSION=dev docker compose -f docker-compose.yaml -f compose.override.yaml up -d

This can be useful during development to

  • not run some memory intensive services
  • use commands with different arguments to save resources
  • mount additional volumes or define additional env to configure behaviour

src Folder Layout and gunicorn

For the following project structure:

scheduler
  |- src
  |   |- unstract
  |       |- scheduler
  |           |- main.py
  |- pdm.lock
  |- pyproject.toml

Add the following in pyproject.toml to detect package in src:

[tool.pdm.build]
includes = ["src"]
package-dir = "src"

This will install the project to:

.venv/lib/python3.12/site-packages/unstract/scheduler/main.py

This will allow gunicorn to refer the package directly as:

$ gunicorn "-c" "python:unstract.scheduler.config.gunicorn" "unstract.scheduler.main:app"