Skip to content

Add docker compose sample #647

@const

Description

@const

I think that a docker compose sample for simple scenarios would be useful for those who are trying to create a simple configuration for testing. My final sample for fixed toxics is like below, but possibly something even simpler could be created.

services:
  db:
    container_name: sample_postgres_container
    image: postgres:17.5
    environment:
      POSTGRES_USER: ${POSTGRES_USER:-postgres}
      POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-postgres}
      POSTGRES_DB: sample
      PGDATA: /data/postgres
    volumes:
       - sample_postgres:/data/postgres
    ports:
      - "5433:5432"
    networks:
      - sample_postgres
  toxiproxy:
    container_name: sample_toxiproxy_container
    image: ghcr.io/shopify/toxiproxy:2.12.0
    links:
      - db
    ports:
      - "8474:8474"
      - "5434:5434"
    environment:
      LOG_LEVEL: info
    networks:
      - sample_postgres
    post_start:
      - command: "/toxiproxy-cli create -l 0.0.0.0:5434 -u db:5432 postgres1ms"
      - command: "/toxiproxy-cli toxic add -t latency -a latency=1 postgres1ms"

networks:
  sample_postgres:
    driver: bridge

volumes:
    sample_postgres:

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions