Skip to content

Commit

Permalink
test dg
Browse files Browse the repository at this point in the history
  • Loading branch information
chendelin1982 authored Dec 15, 2023
1 parent 46fc46e commit 7b72262
Show file tree
Hide file tree
Showing 6 changed files with 76 additions and 42 deletions.
11 changes: 5 additions & 6 deletions apps/dgraph/.env
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
DB_DGRAPH_VERSION=latest
W9_REPO=dgraph/dgraph
W9_REPO=dgraph/standalone
W9_DIST=community
# version tags refer to: https://hub.docker.com/r/dgraph/dgraph/
W9_VERSION=latest
W9_POWER_PASSWORD=UGz0IARz117ssO%

#### -- Not allowed to edit below environments when recreate app based on existing data -- ####
W9_ID=dgraph
W9_ZERO_1_PORT_SET=5080
W9_ZERO_2_PORT_SET=6080
W9_ALPHA_1_PORT_SET=8080
W9_ALPHA_2_PORT_SET=9080
W9_DGRAPH_GraphQL_PORT_SET=5080
W9_DGRAPH_gRPC2_PORT_SET=6080

W9_HTTP_PORT=8000
W9_HTTP_PORT_SET=8000
W9_URL=appname.example.com
Expand Down
2 changes: 2 additions & 0 deletions apps/dgraph/.env-cluster
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
W9_DGRAPH_ZERO_gRPC_PORT_SET=5080
W9_DGRAPH_ZERO_HTTP_PORT_SET=6080
8 changes: 6 additions & 2 deletions apps/dgraph/Notes.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,13 @@ Dgraph 是一个分布式图数据库。

dgraph/standalone 是用于单机使用的,dgraph/dgraph 是用于分布式的。

本项目安装的是分布式镜像,包括:zero,alpha,metal 三个组件
分布式包括:zero(集群协调器),alpha(数据库节点),metal(图形化) 三个组件


## 配置

目前 http://ip:8000 访问UI,输入 http://8.142.3.195:8080 连接
目前 http://ip:8000 访问UI,输入 http://8.142.3.195:8080 连接

## To do

- account
49 changes: 49 additions & 0 deletions apps/dgraph/docker-compose-cluster.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# image: https://hub.docker.com/r/dgraph/dgraph/
# docs: https://dgraph.io/docs/get-started/#step-1-run-dgraph

version: '3.8'

services:
ratel:
image: dgraph/ratel:latest
container_name: ${W9_ID}
volumes:
- type: volume
source: dgraph
target: /dgraph
volume:
nocopy: true
ports:
- ${W9_HTTP_PORT_SET}:8000
command: dgraph-ratel
env_file: .env

zero:
image: $W9_REPO:${DB_DGRAPH_VERSION}
container_name: ${W9_ID}-zero
volumes:
- dgraph:/dgraph
ports:
- ${W9_DGRAPH_ZERO_gRPC_PORT_SET}:5080
- ${W9_DGRAPH_ZERO_HTTP_PORT_SET}:6080
restart: on-failure
command: dgraph zero --my=zero:5080

alpha:
image: image: $W9_REPO:${W9_VERSION}
container_name: ${W9_ID}-dgraph
volumes:
- dgraph:/dgraph
ports:
- ${W9_DGRAPH_GraphQL_PORT_SET}:8080
- ${W9_DGRAPH_gRPC2_PORT_SET}:9080
restart: on-failure
command: dgraph alpha --my=alpha:7080 --zero=zero:5080

networks:
default:
name: ${W9_NETWORK}
external: true

volumes:
dgraph:
44 changes: 12 additions & 32 deletions apps/dgraph/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,46 +1,26 @@
# image: https://hub.docker.com/r/dgraph/dgraph/
# docs: https://dgraph.io/docs/get-started/#step-1-run-dgraph
# This file only running single dgraph and web-base gui ratel
# image: https://hub.docker.com/r/dgraph/standalone
# docs: https://dgraph.io/docs/deploy/installation/single-host-setup

version: '3.8'

services:
zero:
image: $W9_REPO:${DB_DGRAPH_VERSION}
container_name: ${W9_ID}-zero
volumes:
- dgraph:/dgraph
ratel:
image: dgraph/ratel:latest
container_name: ${W9_ID}
ports:
- ${W9_ZERO_1_PORT_SET}:5080
- ${W9_ZERO_2_PORT_SET}:6080
restart: on-failure
command: dgraph zero --my=zero:5080
- ${W9_HTTP_PORT_SET}:8000
env_file: .env

alpha:
image: $W9_REPO:${DB_DGRAPH_VERSION}
container_name: ${W9_ID}-alpha
dgraph:
image: $W9_REPO:${W9_VERSION}
container_name: ${W9_ID}-dgraph
volumes:
- dgraph:/dgraph
ports:
- ${W9_ALPHA_1_PORT_SET}:8080
- ${W9_ALPHA_2_PORT_SET}:9080
- ${W9_DGRAPH_GraphQL_PORT_SET}:8080
- ${W9_DGRAPH_gRPC2_PORT_SET}:9080
restart: on-failure
command: dgraph alpha --my=alpha:7080 --zero=zero:5080
env_file: .env

ratel:
image: dgraph/ratel:${DB_DGRAPH_VERSION}
container_name: ${W9_ID}-ratel
volumes:
- type: volume
source: dgraph
target: /dgraph
volume:
nocopy: true
ports:
- ${W9_HTTP_PORT_SET}:8000
command: dgraph-ratel
env_file: .env

networks:
default:
Expand Down
4 changes: 2 additions & 2 deletions apps/dgraph/variables.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "dgraph",
"trademark": "Dgraph",
"release": true,
"fork_url": "https://hub.docker.com/r/dgraph/dgraph/",
"fork_url": "https://hub.docker.com/r/dgraph/standalone",
"edition": [
{
"dist": "community",
Expand All @@ -16,6 +16,6 @@
"cpu": "1",
"memory": "1",
"disk": "1",
"url": "https://hub.docker.com/r/dgraph/dgraph/"
"url": "https://hub.docker.com/r/dgraph/standalone"
}
}

0 comments on commit 7b72262

Please sign in to comment.