|
| 1 | +--- |
| 2 | +# FOR DEVELOPMENT ONLY |
| 3 | +# docker-compose -f docker-compose.mysql.yaml up --build |
| 4 | +services: |
| 5 | + mysql: |
| 6 | + image: "mysql:latest" |
| 7 | + restart: "unless-stopped" |
| 8 | + ports: |
| 9 | + - "3306:3306" |
| 10 | + environment: |
| 11 | + - "MYSQL_ROOT_PASSWORD=secret" |
| 12 | + - "MYSQL_DATABASE=spicedb" |
| 13 | + healthcheck: |
| 14 | + test: |
| 15 | + [ |
| 16 | + "CMD", |
| 17 | + "mysqladmin", |
| 18 | + "ping", |
| 19 | + "-h", |
| 20 | + "localhost", |
| 21 | + "-u", |
| 22 | + "root", |
| 23 | + "-psecret", |
| 24 | + ] |
| 25 | + interval: "3s" |
| 26 | + timeout: "3s" |
| 27 | + retries: 10 |
| 28 | + migrate: |
| 29 | + depends_on: |
| 30 | + mysql: |
| 31 | + condition: "service_healthy" |
| 32 | + build: "." |
| 33 | + container_name: "migrate" |
| 34 | + environment: |
| 35 | + - "SPICEDB_DATASTORE_ENGINE=mysql" |
| 36 | + - "SPICEDB_DATASTORE_CONN_URI=root:secret@(mysql:3306)/spicedb?parseTime=true" |
| 37 | + command: "datastore migrate head" |
| 38 | + networks: |
| 39 | + - "default" |
| 40 | + nginx: |
| 41 | + image: "nginx:latest" |
| 42 | + ports: |
| 43 | + - "50051:50051" # grpc |
| 44 | + - "8443:8443" # http |
| 45 | + volumes: |
| 46 | + - "./development/nginx.conf:/etc/nginx/nginx.conf" |
| 47 | + depends_on: |
| 48 | + spicedb-1: |
| 49 | + condition: "service_healthy" |
| 50 | + spicedb-2: |
| 51 | + condition: "service_healthy" |
| 52 | + spicedb-1: |
| 53 | + container_name: "spicedb-1" |
| 54 | + build: "." |
| 55 | + command: "serve" |
| 56 | + restart: "no" |
| 57 | + ports: |
| 58 | + - "9090" # prometheus metrics |
| 59 | + - "50051" # grpc endpoint |
| 60 | + - "8443" # http endpoint |
| 61 | + - "50053" # dispatch endpoint |
| 62 | + environment: |
| 63 | + - "SPICEDB_LOG_FORMAT=json" |
| 64 | + - "SPICEDB_LOG_LEVEL=info" |
| 65 | + - "SPICEDB_HTTP_ENABLED=true" |
| 66 | + - "SPICEDB_GRPC_PRESHARED_KEY=foobar" |
| 67 | + - "SPICEDB_DATASTORE_ENGINE=mysql" |
| 68 | + - "SPICEDB_DATASTORE_CONN_URI=root:secret@(mysql:3306)/spicedb?parseTime=true" |
| 69 | + - "SPICEDB_DISPATCH_CLUSTER_ENABLED=true" |
| 70 | + - "SPICEDB_DISPATCH_UPSTREAM_ADDR=spicedb-2:50053" |
| 71 | + - "SPICEDB_OTEL_PROVIDER=otlpgrpc" |
| 72 | + - "SPICEDB_OTEL_SAMPLE_RATIO=1" |
| 73 | + - "SPICEDB_TELEMETRY_ENDPOINT=" |
| 74 | + - "SPICEDB_GRPC_LOG_REQUESTS_ENABLED=false" |
| 75 | + - "SPICEDB_GRPC_LOG_RESPONSES_ENABLED=false" |
| 76 | + - "SPICEDB_STREAMING_API_RESPONSE_DELAY_TIMEOUT=0s" |
| 77 | + - "OTEL_EXPORTER_OTLP_ENDPOINT=http://otel-collector:4317" |
| 78 | + depends_on: |
| 79 | + migrate: |
| 80 | + condition: "service_completed_successfully" |
| 81 | + otel-collector: |
| 82 | + condition: "service_started" |
| 83 | + healthcheck: |
| 84 | + test: ["CMD", "/bin/grpc_health_probe", "-addr=localhost:50051"] |
| 85 | + interval: "5s" |
| 86 | + timeout: "30s" |
| 87 | + retries: 3 |
| 88 | + spicedb-2: |
| 89 | + container_name: "spicedb-2" |
| 90 | + build: "." |
| 91 | + command: "serve" |
| 92 | + restart: "no" |
| 93 | + ports: |
| 94 | + - "9090" # prometheus metrics |
| 95 | + - "50051" # grpc endpoint |
| 96 | + - "8443" # http endpoint |
| 97 | + - "50053" # dispatch endpoint |
| 98 | + environment: |
| 99 | + - "SPICEDB_LOG_FORMAT=json" |
| 100 | + - "SPICEDB_LOG_LEVEL=info" |
| 101 | + - "SPICEDB_HTTP_ENABLED=true" |
| 102 | + - "SPICEDB_GRPC_PRESHARED_KEY=foobar" |
| 103 | + - "SPICEDB_DATASTORE_ENGINE=mysql" |
| 104 | + - "SPICEDB_DATASTORE_CONN_URI=root:secret@(mysql:3306)/spicedb?parseTime=true" |
| 105 | + - "SPICEDB_DISPATCH_CLUSTER_ENABLED=true" |
| 106 | + - "SPICEDB_DISPATCH_UPSTREAM_ADDR=spicedb-1:50053" |
| 107 | + - "SPICEDB_OTEL_PROVIDER=otlpgrpc" |
| 108 | + - "SPICEDB_OTEL_SAMPLE_RATIO=1" |
| 109 | + - "SPICEDB_TELEMETRY_ENDPOINT=" |
| 110 | + - "SPICEDB_GRPC_LOG_REQUESTS_ENABLED=true" |
| 111 | + - "SPICEDB_GRPC_LOG_RESPONSES_ENABLED=false" |
| 112 | + - "SPICEDB_STREAMING_API_RESPONSE_DELAY_TIMEOUT=0s" |
| 113 | + - "OTEL_EXPORTER_OTLP_ENDPOINT=http://otel-collector:4317" |
| 114 | + depends_on: |
| 115 | + migrate: |
| 116 | + condition: "service_completed_successfully" |
| 117 | + otel-collector: |
| 118 | + condition: "service_started" |
| 119 | + healthcheck: |
| 120 | + test: ["CMD", "/bin/grpc_health_probe", "-addr=localhost:50051"] |
| 121 | + interval: "5s" |
| 122 | + timeout: "30s" |
| 123 | + retries: 3 |
| 124 | + prometheus: |
| 125 | + image: "prom/prometheus:v2.47.0" |
| 126 | + command: |
| 127 | + - "--config.file=/etc/prometheus/prometheus.yaml" |
| 128 | + - "--storage.tsdb.path=/prometheus" |
| 129 | + volumes: |
| 130 | + - "./development/prometheus.yaml:/etc/prometheus/prometheus.yaml" |
| 131 | + ports: |
| 132 | + - "9091:9090" # Prometheus UI |
| 133 | + restart: "unless-stopped" |
| 134 | + otel-collector: |
| 135 | + image: "otel/opentelemetry-collector:0.60.0" |
| 136 | + command: "--config /etc/otel-config.yaml" |
| 137 | + volumes: |
| 138 | + - "./development/otel-config.yaml:/etc/otel-config.yaml" |
| 139 | + ports: |
| 140 | + - "4317:4317" # OTLP gRPC |
| 141 | + - "8888" # Prometheus metrics for collector |
| 142 | + depends_on: |
| 143 | + - "tempo" |
| 144 | + loki: |
| 145 | + image: "grafana/loki:2.9.0" |
| 146 | + command: "-config.file=/etc/loki/loki.yaml" |
| 147 | + volumes: |
| 148 | + - "./development/loki.yaml:/etc/loki/loki.yaml" |
| 149 | + ports: |
| 150 | + - "3100" # Loki API |
| 151 | + restart: "unless-stopped" |
| 152 | + tempo: |
| 153 | + image: "grafana/tempo:1.5.0" |
| 154 | + command: "-search.enabled=true -config.file=/etc/tempo.yaml" |
| 155 | + volumes: |
| 156 | + - "./development/tempo.yaml:/etc/tempo.yaml" |
| 157 | + restart: "unless-stopped" |
| 158 | + ports: |
| 159 | + - "4317" # OTLP gRPC |
| 160 | + - "3100" # tempo |
| 161 | + grafana: |
| 162 | + image: "grafana/grafana:9.1.5-ubuntu" |
| 163 | + volumes: |
| 164 | + - "./development/grafana/provisioning/datasources:/etc/grafana/provisioning/datasources" |
| 165 | + - "./development/grafana/provisioning/dashboards:/etc/grafana/provisioning/dashboards" |
| 166 | + - "./development/grafana/dashboards:/etc/grafana/dashboards" |
| 167 | + environment: |
| 168 | + - "GF_AUTH_ANONYMOUS_ENABLED=true" |
| 169 | + - "GF_AUTH_ANONYMOUS_ORG_ROLE=Admin" |
| 170 | + - "GF_AUTH_DISABLE_LOGIN_FORM=true" |
| 171 | + ports: |
| 172 | + - "3000:3000" # UI |
| 173 | + depends_on: |
| 174 | + - "tempo" |
| 175 | + - "prometheus" |
| 176 | + - "loki" |
0 commit comments