๐Ÿ“ฆ juspay / hyperswitch

๐Ÿ“„ docker-compose.yaml ยท 128 lines
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128version: "2"

networks:
  loadtest_net:

services:
  db:
    image: postgres
    restart: always
    environment:
      POSTGRES_USER: postgres
      POSTGRES_PASSWORD: postgres
      POSTGRES_DB: loadtest_router
    networks:
      - loadtest_net
    healthcheck:
      test: [ "CMD-SHELL", "pg_isready -U postgres" ]
      interval: 5s
      timeout: 5s
      retries: 5

  stripe-mock:
    image: heyrutvik/stripe-mock:latest
    networks:
      - loadtest_net

  redis-queue:
    image: redis:7
    networks:
      - loadtest_net

  router-server:
    build:
      context: ..
      dockerfile: ./loadtest/Dockerfile
    cpuset: "0"
    volumes:
      - ./config:/config
      - ./logs.tmp:/app/logs
    command:
      - /bin/bash
      - -c
      - |
        ./diesel migration run
        ./router -f /config/development.toml
    ports:
      - "8080"
    environment:
      DATABASE_URL: postgres://postgres:postgres@db/loadtest_router
      RUST_LOG: INFO
      RUN_ENV: development
      OTEL_EXPORTER_OTLP_ENDPOINT: http://otel-collector:4317
    networks:
      - loadtest_net
    healthcheck:
      test: curl --fail http://router-server:8080/health || exit 1
      interval: 5s
      timeout: 5s
      retries: 5
    depends_on:
      db:
        condition: service_healthy
      stripe-mock:
        condition: service_started
      redis-queue:
        condition: service_started
      influxdb:
        condition: service_started
      otel-collector:
        condition: service_started
      tempo:
        condition: service_started
      grafana:
        condition: service_started

  k6:
    image: loadimpact/k6:latest
    volumes:
      - ./k6:/scripts
    command: run /scripts/${LOADTEST_K6_SCRIPT}
    networks:
      - loadtest_net
    environment:
      - LOADTEST_RUN_NAME=${LOADTEST_RUN_NAME}
      - K6_OUT=influxdb=http://influxdb:8086/scripts
    depends_on:
      router-server:
        condition: service_healthy

  influxdb:
    image: influxdb:1.8
    networks:
      - loadtest_net
    environment:
      - INFLUXDB_DB=scripts

  otel-collector:
    image: otel/opentelemetry-collector:latest
    command: --config=/etc/otel-collector.yaml
    networks:
      - loadtest_net
    volumes:
      - ./config/otel-collector.yaml:/etc/otel-collector.yaml

  tempo:
    image: grafana/tempo:latest
    command: -config.file=/etc/tempo.yaml
    volumes:
      - ./config/tempo.yaml:/etc/tempo.yaml
      - ./tempo.tmp:/tmp/tempo
    networks:
      - loadtest_net

  grafana:
    image: grafana/grafana:latest
    ports:
      - "3002:3000"
    networks:
      - loadtest_net
    environment:
      - GF_AUTH_ANONYMOUS_ORG_ROLE=Admin
      - GF_AUTH_ANONYMOUS_ENABLED=true
      - GF_AUTH_BASIC_ENABLED=false
    volumes:
      - ./grafana/dashboards:/var/lib/grafana/dashboards
      - ./grafana/grafana-dashboard.yaml:/etc/grafana/provisioning/dashboards/dashboard.yaml
      - ./grafana/grafana-datasource.yaml:/etc/grafana/provisioning/datasources/datasource.yaml