GithubHelp home page GithubHelp logo

surrealdb / docker.surrealdb.com Goto Github PK

View Code? Open in Web Editor NEW
35.0 4.0 5.0 16 KB

Configuration files for running a multi-node SurrealDB cluster using Docker

Home Page: https://docker.surrealdb.com

License: Apache License 2.0

Makefile 34.08% Shell 50.47% JavaScript 15.46%
database nosql serverless surreal surrealdb

docker.surrealdb.com's Issues

Error unknown --profile command

With the --profile monitoring command we have slight changes the order of command to solved error unknown --profile command:
docker compose --profile monitoring up --pull always -d

Kubernetes support

Hello, maybe this is out of scope here, but having used ArangoDB before, they have an excellent Kubernetes operator to deploy DB instances quickly.

I could transform the docker-compose.yml file automatically to make it run on Kubernetes, but having an actual operator managing the DB on Kubernetes is another level of coolness.

Keep up the excellent work!

PD cluster failed to respond

Hi there,

I'm new to surrealDB, tikz and all the database world, trying to get the docker-compose setup here to work.
For some reason it seems that the tikv instances cant reach the pd instances. Did anyone ran into the same issue before?

surrealdb-pd1 | 2023-01-22 12:07:42.679445 W | etcdserver: could not get cluster response from http://pd2:2380: Get "http://pd2:2380/members": dial tcp 172.27.0.5:2380: connect: connection refused
surrealdb     | [2023-01-22 12:07:43] INFO  surrealdb::iam Root authentication is enabled
surrealdb     | [2023-01-22 12:07:43] INFO  surrealdb::iam Root username is 'root'
surrealdb     | [2023-01-22 12:07:43] INFO  surrealdb::dbs Database strict mode is enabled
surrealdb     | [2023-01-22 12:07:43] INFO  surrealdb::kvs Connecting to kvs store at tikv://pd0:2379
surrealdb     | [2023-01-22 12:07:44] INFO  surrealdb::kvs Connected to kvs store at tikv://pd0:2379
surrealdb     | [2023-01-22 12:07:44] ERROR surrealdb::cli There was a problem with the database: There was a problem with the underlying datastore: [/home/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/tikv-client-pd-0.1.0/src/cluster.rs:174]: PD cluster failed to respond

docker images

pingcap/pd                 v6.1.0     a2227c6c7298   7 months ago    150MB
pingcap/tikv               v6.1.0     50813a53fbec   7 months ago    438MB
surrealdb/surrealdb        latest     1fdaf659c2c4   3 months ago    50.7MB

The following docker-compose.yaml is simply called via docker-compose up

version: '3.8'

services:

  pd0:
    container_name: surrealdb-pd0
    image: pingcap/pd:v6.1.0
    ports:
      - "2379"
    volumes:
      - ${SURREAL_DB_PATH}/data:/data
      - ${SURREAL_DB_PATH}/logs:/logs
    command:
      - --name=pd0
      - --client-urls=http://0.0.0.0:2379
      - --peer-urls=http://0.0.0.0:2380
      - --advertise-client-urls=http://pd0:2379
      - --advertise-peer-urls=http://pd0:2380
      - --initial-cluster=pd0=http://pd0:2380,pd1=http://pd1:2380,pd2=http://pd2:2380
      - --data-dir=/data/pd0
      - --log-file=/logs/pd0.log
    restart: on-failure

  pd1:
    container_name: surrealdb-pd1
    image: pingcap/pd:v6.1.0
    ports:
      - "2379"
    volumes:
      - ${SURREAL_DB_PATH}/data:/data
      - ${SURREAL_DB_PATH}/logs:/logs
    command:
      - --name=pd1
      - --client-urls=http://0.0.0.0:2379
      - --peer-urls=http://0.0.0.0:2380
      - --advertise-client-urls=http://pd1:2379
      - --advertise-peer-urls=http://pd1:2380
      - --initial-cluster=pd0=http://pd0:2380,pd1=http://pd1:2380,pd2=http://pd2:2380
      - --data-dir=/data/pd1
      - --log-file=/logs/pd1.log
    restart: on-failure

  pd2:
    container_name: surrealdb-pd2
    image: pingcap/pd:v6.1.0
    ports:
      - "2379"
    volumes:
      - ${SURREAL_DB_PATH}/data:/data
      - ${SURREAL_DB_PATH}/logs:/logs
    command:
      - --name=pd2
      - --client-urls=http://0.0.0.0:2379
      - --peer-urls=http://0.0.0.0:2380
      - --advertise-client-urls=http://pd2:2379
      - --advertise-peer-urls=http://pd2:2380
      - --initial-cluster=pd0=http://pd0:2380,pd1=http://pd1:2380,pd2=http://pd2:2380
      - --data-dir=/data/pd2
      - --log-file=/logs/pd2.log
    restart: on-failure

  tikv0:
    container_name: surrealdb-tikv0
    image: pingcap/tikv:v6.1.0
    volumes:
      - ${SURREAL_DB_PATH}/data:/data
      - ${SURREAL_DB_PATH}/logs:/logs
    command:
      - --addr=0.0.0.0:20160
      - --advertise-addr=tikv0:20160
      - --data-dir=/data/tikv0
      - --pd=pd0:2379,pd1:2379,pd2:2379
      - --log-file=/logs/tikv0.log
    depends_on:
      - "pd0"
      - "pd1"
      - "pd2"
    restart: on-failure

  tikv1:
    container_name: surrealdb-tikv1
    image: pingcap/tikv:v6.1.0
    volumes:
      - ${SURREAL_DB_PATH}/data:/data
      - ${SURREAL_DB_PATH}/logs:/logs
    command:
      - --addr=0.0.0.0:20160
      - --advertise-addr=tikv1:20160
      - --data-dir=/data/tikv1
      - --pd=pd0:2379,pd1:2379,pd2:2379
      - --log-file=/logs/tikv1.log
    depends_on:
      - "pd0"
      - "pd1"
      - "pd2"
    restart: on-failure

  tikv2:
    container_name: surrealdb-tikv2
    image: pingcap/tikv:v6.1.0
    volumes:
      - ${SURREAL_DB_PATH}/data:/data
      - ${SURREAL_DB_PATH}/logs:/logs
    command:
      - --addr=0.0.0.0:20160
      - --advertise-addr=tikv2:20160
      - --data-dir=/data/tikv2
      - --pd=pd0:2379,pd1:2379,pd2:2379
      - --log-file=/logs/tikv2.log
    depends_on:
      - "pd0"
      - "pd1"
      - "pd2"
    restart: on-failure

  prometheus:
    container_name: surrealdb-prometheus
    image: prom/prometheus:v2.2.1
    user: root
    command:
      - --log.level=error
      - --storage.tsdb.path=/data/prometheus
      - --config.file=/etc/prometheus/prometheus.yml
    ports:
      - "9090:9090"
    volumes:
      - ${SURREAL_DB_PATH}/config/prometheus.yml:/etc/prometheus/prometheus.yml:ro
      - ${SURREAL_DB_PATH}/config/pd.rules.yml:/etc/prometheus/pd.rules.yml:ro
      - ${SURREAL_DB_PATH}/config/tikv.rules.yml:/etc/prometheus/tikv.rules.yml:ro
      - ${SURREAL_DB_PATH}/config/tidb.rules.yml:/etc/prometheus/tidb.rules.yml:ro
      - ${SURREAL_DB_PATH}/data:/data
    restart: on-failure
    profiles:
      - monitoring

  grafana:
    image: grafana/grafana:6.0.1
    container_name: surrealdb-grafana
    user: "0"
    environment:
      GF_LOG_LEVEL: error
      GF_PATHS_PROVISIONING: /etc/grafana/provisioning
      GF_PATHS_CONFIG: /etc/grafana/grafana.ini
    volumes:
      - ${SURREAL_DB_PATH}/config/grafana:/etc/grafana
      - ${SURREAL_DB_PATH}/config/dashboards:/tmp/dashboards
      - ${SURREAL_DB_PATH}/data/grafana:/var/lib/grafana
    ports:
      - "3000:3000"
    restart: on-failure
    profiles:
      - monitoring

  surrealdb:
    image: surrealdb/surrealdb:latest
    container_name: surrealdb
    ports:
      - "8000:8000"
    command: 
      - start
      - --log=trace
      - --user=${SURREAL_ROOT_USER}
      - --pass=${SURREAL_ROOT_PASSWORD}
      - --strict
      - tikv://pd0:2379
    depends_on:
      - tikv0
      - tikv1
      - tikv2
    restart: always

  # minio:
  #   image: minio/minio
  #   ports:
  #     - "9098:9098"
  #     - "9099:9099"
  #   volumes:
  #     # - minio_storage:/data
  #     - ${MINIO_DB_PATH}:/data
  #   environment:
  #     MINIO_ROOT_USER: ${MINIO_ROOT_USER} 
  #     MINIO_ROOT_PASSWORD: ${MINIO_ROOT_PASSWORD} 
  #   command: server --console-address ":9099" /data

# volumes:
#   minio_storage: {}

docker-compose up fails ERROR: for prometheus

Just started playing with this today. After creating the docker-compose.yml I ran: docker-compose --profile monitoring up -d && docker-compose logs -f
Everything pulled fine but I got an error at "Creating surrealdb-prometheus ... error"
After everything was done pulling and creating, this was the error it gave:
ERROR: for prometheus Cannot start service prometheus: failed to create shim task: OCI runtime create failed: runc create failed: unable to start container process: error during container init: error mounting "/my/path/to/surrealdb/config/prometheus.yml" to rootfs at "/etc/prometheus/prometheus.yml": mount /my/path/to/surrealdb/config/prometheus.yml:/etc/prometheus/prometheus.yml (via /proc/self/fd/6), flags: 0x5001: not a directory: unknown: Are you trying to mount a directory onto a file (or vice-versa)? Check if the specified host path exists and is the expected type

I went into config and noticed that all of the following were directories instead of files: pd.rules.yml, prometheus.yml, tidb.rules.yml, tikv.rules.yml. I'm assuming these are supposed to be regular yml configuration files but they got created as directories for some reason.
Any thoughts on how to fix this? Or point me to what those yml files are supposed to contain and I'll recreate them and try again.

Thanks!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.