vitess.io/vitess@v0.16.2/examples/compose/docker-compose.yml (about) 1 services: 2 consul1: 3 command: agent -server -bootstrap-expect 3 -ui -disable-host-node-id -client 0.0.0.0 4 hostname: consul1 5 image: consul:latest 6 ports: 7 - 8400:8400 8 - 8500:8500 9 - 8600:8600 10 consul2: 11 command: agent -server -retry-join consul1 -disable-host-node-id 12 depends_on: 13 - consul1 14 expose: 15 - "8400" 16 - "8500" 17 - "8600" 18 hostname: consul2 19 image: consul:latest 20 consul3: 21 command: agent -server -retry-join consul1 -disable-host-node-id 22 depends_on: 23 - consul1 24 expose: 25 - "8400" 26 - "8500" 27 - "8600" 28 hostname: consul3 29 image: consul:latest 30 external_db_host: 31 build: 32 context: ./external_db/mysql 33 dockerfile: Dockerfile 34 command: 35 - --server-id=1 36 - --log-bin=mysql-bin 37 - --gtid_mode=ON 38 - --enforce_gtid_consistency 39 - --general_log=1 40 - --slow_query_log=1 41 environment: 42 MYSQL_DATABASE: ${DB:-commerce} 43 MYSQL_PASSWORD: ${DB_PASS:-external_db_password} 44 MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD:-pass} 45 MYSQL_USER: ${DB_USER:-external_db_user} 46 healthcheck: 47 retries: 10 48 test: /usr/bin/mysql --user=root --password=$${MYSQL_ROOT_PASSWORD} --execute 49 "SHOW DATABASES;" 50 timeout: 10s 51 ports: 52 - "3306" 53 restart: always 54 volumes: 55 - ./external_db/mysql/:/docker-entrypoint-initdb.d/ 56 - ./external_db/mysql/log:/var/log/mysql 57 schemaload_lookup_keyspace: 58 command: 59 - sh 60 - -c 61 - /script/schemaload.sh 62 depends_on: 63 vttablet301: 64 condition: service_healthy 65 environment: 66 - TOPOLOGY_FLAGS=--topo_implementation consul --topo_global_server_address consul1:8500 67 --topo_global_root vitess/global 68 - WEB_PORT=8080 69 - GRPC_PORT=15999 70 - CELL=test 71 - KEYSPACE=lookup_keyspace 72 - TARGETTAB=test-0000000301 73 - SLEEPTIME=15 74 - VSCHEMA_FILE=lookup_keyspace_vschema.json 75 - SCHEMA_FILES=lookup_keyspace_schema_file.sql 76 - POST_LOAD_FILE= 77 - EXTERNAL_DB=0 78 image: vitess/lite:v16.0.2 79 volumes: 80 - .:/script 81 schemaload_test_keyspace: 82 command: 83 - sh 84 - -c 85 - /script/schemaload.sh 86 depends_on: 87 vttablet101: 88 condition: service_healthy 89 vttablet201: 90 condition: service_healthy 91 environment: 92 - TOPOLOGY_FLAGS=--topo_implementation consul --topo_global_server_address consul1:8500 93 --topo_global_root vitess/global 94 - WEB_PORT=8080 95 - GRPC_PORT=15999 96 - CELL=test 97 - KEYSPACE=test_keyspace 98 - TARGETTAB=test-0000000101 99 - SLEEPTIME=15 100 - VSCHEMA_FILE=test_keyspace_vschema.json 101 - SCHEMA_FILES=test_keyspace_schema_file.sql 102 - POST_LOAD_FILE= 103 - EXTERNAL_DB=0 104 image: vitess/lite:v16.0.2 105 volumes: 106 - .:/script 107 set_keyspace_durability_policy: 108 command: 109 - sh 110 - -c 111 - /script/set_keyspace_durability_policy.sh 112 depends_on: 113 - vttablet101 114 - vttablet301 115 environment: 116 - KEYSPACES=test_keyspace lookup_keyspace 117 - GRPC_PORT=15999 118 image: vitess/lite:v16.0.2 119 volumes: 120 - .:/script 121 vreplication: 122 command: 123 - sh 124 - -c 125 - '[ $$EXTERNAL_DB -eq 1 ] && /script/externaldb_vreplication.sh || exit 0' 126 depends_on: 127 - vtctld 128 environment: 129 - TOPOLOGY_FLAGS=--topo_implementation consul --topo_global_server_address consul1:8500 130 --topo_global_root vitess/global 131 - EXTERNAL_DB=0 132 image: vitess/lite:v16.0.2 133 volumes: 134 - .:/script 135 vtctld: 136 command: 137 - sh 138 - -c 139 - ' /vt/bin/vtctld --topo_implementation consul --topo_global_server_address consul1:8500 140 --topo_global_root vitess/global --cell test 141 --service_map ''grpc-vtctl,grpc-vtctld'' --backup_storage_implementation file --file_backup_storage_root 142 /vt/vtdataroot/backups --logtostderr=true --port 8080 --grpc_port 15999 ' 143 depends_on: 144 external_db_host: 145 condition: service_healthy 146 image: vitess/lite:v16.0.2 147 ports: 148 - 15000:8080 149 - "15999" 150 volumes: 151 - .:/script 152 vtgate: 153 command: 154 - sh 155 - -c 156 - '/script/run-forever.sh /vt/bin/vtgate --topo_implementation consul --topo_global_server_address 157 consul1:8500 --topo_global_root vitess/global --logtostderr=true --port 8080 --grpc_port 158 15999 --mysql_server_port 15306 --mysql_auth_server_impl none --cell test --cells_to_watch 159 test --tablet_types_to_wait PRIMARY,REPLICA,RDONLY --service_map ''grpc-vtgateservice'' 160 --normalize_queries=true ' 161 depends_on: 162 - vtctld 163 image: vitess/lite:v16.0.2 164 ports: 165 - 15099:8080 166 - "15999" 167 - 15306:15306 168 volumes: 169 - .:/script 170 vtorc: 171 command: 172 - sh 173 - -c 174 - /script/vtorc-up.sh 175 depends_on: 176 - vtctld 177 - set_keyspace_durability_policy 178 environment: 179 - TOPOLOGY_FLAGS=--topo_implementation consul --topo_global_server_address consul1:8500 180 --topo_global_root vitess/global 181 - WEB_PORT=8080 182 - EXTERNAL_DB=0 183 - DB_USER= 184 - DB_PASS= 185 image: vitess/lite:v16.0.2 186 ports: 187 - 13000:8080 188 volumes: 189 - .:/script 190 vttablet101: 191 command: 192 - sh 193 - -c 194 - /script/vttablet-up.sh 101 195 depends_on: 196 - vtctld 197 environment: 198 - TOPOLOGY_FLAGS=--topo_implementation consul --topo_global_server_address consul1:8500 199 --topo_global_root vitess/global 200 - WEB_PORT=8080 201 - GRPC_PORT=15999 202 - CELL=test 203 - KEYSPACE=test_keyspace 204 - SHARD=-80 205 - ROLE=primary 206 - VTHOST=vttablet101 207 - EXTERNAL_DB=0 208 - DB_PORT= 209 - DB_HOST= 210 - DB_USER= 211 - DB_PASS= 212 - DB_CHARSET= 213 healthcheck: 214 interval: 30s 215 retries: 15 216 test: 217 - CMD-SHELL 218 - curl -s --fail --show-error localhost:8080/debug/health 219 timeout: 10s 220 image: vitess/lite:v16.0.2 221 ports: 222 - 15101:8080 223 - "15999" 224 - "3306" 225 volumes: 226 - .:/script 227 vttablet102: 228 command: 229 - sh 230 - -c 231 - /script/vttablet-up.sh 102 232 depends_on: 233 - vtctld 234 environment: 235 - TOPOLOGY_FLAGS=--topo_implementation consul --topo_global_server_address consul1:8500 236 --topo_global_root vitess/global 237 - WEB_PORT=8080 238 - GRPC_PORT=15999 239 - CELL=test 240 - KEYSPACE=test_keyspace 241 - SHARD=-80 242 - ROLE=replica 243 - VTHOST=vttablet102 244 - EXTERNAL_DB=0 245 - DB_PORT= 246 - DB_HOST= 247 - DB_USER= 248 - DB_PASS= 249 - DB_CHARSET= 250 healthcheck: 251 interval: 30s 252 retries: 15 253 test: 254 - CMD-SHELL 255 - curl -s --fail --show-error localhost:8080/debug/health 256 timeout: 10s 257 image: vitess/lite:v16.0.2 258 ports: 259 - 15102:8080 260 - "15999" 261 - "3306" 262 volumes: 263 - .:/script 264 vttablet201: 265 command: 266 - sh 267 - -c 268 - /script/vttablet-up.sh 201 269 depends_on: 270 - vtctld 271 environment: 272 - TOPOLOGY_FLAGS=--topo_implementation consul --topo_global_server_address consul1:8500 273 --topo_global_root vitess/global 274 - WEB_PORT=8080 275 - GRPC_PORT=15999 276 - CELL=test 277 - KEYSPACE=test_keyspace 278 - SHARD=80- 279 - ROLE=primary 280 - VTHOST=vttablet201 281 - EXTERNAL_DB=0 282 - DB_PORT= 283 - DB_HOST= 284 - DB_USER= 285 - DB_PASS= 286 - DB_CHARSET= 287 healthcheck: 288 interval: 30s 289 retries: 15 290 test: 291 - CMD-SHELL 292 - curl -s --fail --show-error localhost:8080/debug/health 293 timeout: 10s 294 image: vitess/lite:v16.0.2 295 ports: 296 - 15201:8080 297 - "15999" 298 - "3306" 299 volumes: 300 - .:/script 301 vttablet202: 302 command: 303 - sh 304 - -c 305 - /script/vttablet-up.sh 202 306 depends_on: 307 - vtctld 308 environment: 309 - TOPOLOGY_FLAGS=--topo_implementation consul --topo_global_server_address consul1:8500 310 --topo_global_root vitess/global 311 - WEB_PORT=8080 312 - GRPC_PORT=15999 313 - CELL=test 314 - KEYSPACE=test_keyspace 315 - SHARD=80- 316 - ROLE=replica 317 - VTHOST=vttablet202 318 - EXTERNAL_DB=0 319 - DB_PORT= 320 - DB_HOST= 321 - DB_USER= 322 - DB_PASS= 323 - DB_CHARSET= 324 healthcheck: 325 interval: 30s 326 retries: 15 327 test: 328 - CMD-SHELL 329 - curl -s --fail --show-error localhost:8080/debug/health 330 timeout: 10s 331 image: vitess/lite:v16.0.2 332 ports: 333 - 15202:8080 334 - "15999" 335 - "3306" 336 volumes: 337 - .:/script 338 vttablet301: 339 command: 340 - sh 341 - -c 342 - /script/vttablet-up.sh 301 343 depends_on: 344 - vtctld 345 environment: 346 - TOPOLOGY_FLAGS=--topo_implementation consul --topo_global_server_address consul1:8500 347 --topo_global_root vitess/global 348 - WEB_PORT=8080 349 - GRPC_PORT=15999 350 - CELL=test 351 - KEYSPACE=lookup_keyspace 352 - SHARD=- 353 - ROLE=primary 354 - VTHOST=vttablet301 355 - EXTERNAL_DB=0 356 - DB_PORT= 357 - DB_HOST= 358 - DB_USER= 359 - DB_PASS= 360 - DB_CHARSET= 361 healthcheck: 362 interval: 30s 363 retries: 15 364 test: 365 - CMD-SHELL 366 - curl -s --fail --show-error localhost:8080/debug/health 367 timeout: 10s 368 image: vitess/lite:v16.0.2 369 ports: 370 - 15301:8080 371 - "15999" 372 - "3306" 373 volumes: 374 - .:/script 375 vttablet302: 376 command: 377 - sh 378 - -c 379 - /script/vttablet-up.sh 302 380 depends_on: 381 - vtctld 382 environment: 383 - TOPOLOGY_FLAGS=--topo_implementation consul --topo_global_server_address consul1:8500 384 --topo_global_root vitess/global 385 - WEB_PORT=8080 386 - GRPC_PORT=15999 387 - CELL=test 388 - KEYSPACE=lookup_keyspace 389 - SHARD=- 390 - ROLE=replica 391 - VTHOST=vttablet302 392 - EXTERNAL_DB=0 393 - DB_PORT= 394 - DB_HOST= 395 - DB_USER= 396 - DB_PASS= 397 - DB_CHARSET= 398 healthcheck: 399 interval: 30s 400 retries: 15 401 test: 402 - CMD-SHELL 403 - curl -s --fail --show-error localhost:8080/debug/health 404 timeout: 10s 405 image: vitess/lite:v16.0.2 406 ports: 407 - 15302:8080 408 - "15999" 409 - "3306" 410 volumes: 411 - .:/script 412 version: "2.1"