StarRocks / starrocks

The world's fastest open query engine for sub-second analytics both on and off the data lakehouse. With the flexibility to support nearly any scenario, StarRocks provides best-in-class performance for multi-dimensional analytics, real-time analytics, and ad-hoc queries. A Linux Foundation project.
https://starrocks.io
Apache License 2.0
9.01k stars 1.81k forks source link

Have a way to create a database (or run a sql script) on allinone allin1 container startup #40843

Closed alberttwong closed 9 months ago

alberttwong commented 9 months ago

I'd like to create a database on container startup or load a database with sample data on container startup. How would I do this? @kevincai

alberttwong commented 9 months ago
version: "3.9"
services:
  starrocks:
    image: starrocks/allin1-ubuntu
    hostname: starrocks-fe
    container_name: allin1-ubuntu
    ports:
      - 8030:8030
      - 8040:8040
      - 9030:9030
    healthcheck:
      test: bash -c "exec 6<> /dev/tcp/localhost/9030"
    volumes:
      - ./data:/home/data

  starrocks-toolkit:
    image: atwong/starrocks-tool-box
    hostname: starrocks-toolkit
    container_name: starrocks-toolkit
    volumes:
      - ./srtooldata:/home/data
    depends_on:
      starrocks:
        condition: service_healthy
    entrypoint: >
      /bin/sh -c "
      mysql -P 9030 -h starrocks-fe -u root -e \"create database demo\";
      exit 0;
      "