Using Docker Compose's include feature

I am migrating a project from Flowable to Camunda 8 Self Managed.
I started by following the steps in the ‘Install and start with Docker Compose’ section of the docs.
And then added an ‘include’ at the start of my project’s docker compose file:

include:
  - path: ./services/camunda/docker-compose/8.9/docker-compose-full.yaml
    env_file: ./services/camunda/docker-compose/8.9/.env

services:
  ...

It’s important to leverage env_file scoping in order to isolate environment variables as Camunda’s docker compose files use generic environment variables, for example:

## Database Configuration ##
# Identity/Keycloak PostgreSQL Database
POSTGRES_DB=bitnami_keycloak
POSTGRES_USER=bn_keycloak
POSTGRES_PASSWORD=demo-postgres-password

## Keycloak Admin Credentials ##
# WARNING: Change these for production deployments!
KEYCLOAK_ADMIN_USER=admin
KEYCLOAK_ADMIN_PASSWORD=admin

Could Camunda implement strict environment variable and service namespacing?

Because service names must be unique within the final merged project network, you should treat each included file as its own “namespace.” E.g., append a unique, context-specific prefix to every service in a sub-module.

For example:

indentity -> camunda-identity-service

## Keycloak Admin Credentials ##
# WARNING: Change these for production deployments!
CAMUNDA_IDENTITY_SERVICE_ADMIN_USER=admin
CAMUNDA_IDENTITY_SERVICE_ADMIN_PASSWORD=admin

Your request for strict environment variable and service namespacing in Camunda’s Docker Compose files is a valid concern for integration scenarios. I found the following relevant resources:

Does this help? If not, can anyone from the community jump in? :waving_hand:


:light_bulb: Hints: Use the Ask AI feature in Camunda’s documentation to chat with AI and get fast help. Report bugs and features in Camuda’s GitHub issue tracker. Trust the process. :robot:

Don’t forget to add the camunda-platform network to your BFF’s networks:

  serendipity-web-bff:
    container_name: serendipity-web-bff
    build:
      context: ./modules/web-bff
      dockerfile: Dockerfile
    environment:
      PARTY_SERVICE_URI: http://serendipity-party-service:8080/api/party-service
      WORKFLOW_SERVICE_URI: http://orchestration:8080/v2/user-tasks
    restart: unless-stopped
    networks:
      - serendipity
      - camunda-platform
      # - identity-network
      # - web-modeler
    extra_hosts:
      - "host.docker.internal:host-gateway"
    depends_on:
      - serendipity-storage-service

So that it can resolve the service names.

BFF application.yaml:

...

spring:
  cloud:
    gateway:
      server:
        webmvc:
          routes:
            - id: party-service-route
              uri: http://serendipity-party-service:8080/api/party-service
              predicates:
                - Path=/api/party-service/**
            - id: workflow-service-route
              uri: http://orchestration:8080/v2/user-tasks
              predicates:
                - Path=/v2/user-tasks/**
  main:
    banner-mode: off
  profiles:
    active: @spring.profiles.active@