Skip to content

Commit

Permalink
Merge branch 'master' of github.com:qianque7/mogo
Browse files Browse the repository at this point in the history
  • Loading branch information
xiongzhi committed Jan 12, 2023
2 parents 4a7b584 + d069b76 commit 0591c8c
Show file tree
Hide file tree
Showing 13 changed files with 52 additions and 471 deletions.
4 changes: 3 additions & 1 deletion api/internal/api/apiv1/base/instance.go
Original file line number Diff line number Diff line change
Expand Up @@ -204,12 +204,14 @@ func InstanceTest(c *core.Context) {
c.JSONE(1, err.Error(), err)
return
}

switch req.Datasource {
case db.DatasourceClickHouse:
_, err = service.ClickHouseLink(req.Dsn)
case db.DatasourceDatabend:
_, err = service.DatabendLink(req.Dsn)
default:
c.JSONE(1, "data source type error", nil)
return
}
if err != nil {
c.JSONE(1, "connection failure: "+err.Error(), err)
Expand Down
2 changes: 1 addition & 1 deletion api/internal/service/inquiry/clickhouse.go
Original file line number Diff line number Diff line change
Expand Up @@ -1837,7 +1837,7 @@ func (c *ClickHouse) doQuery(sql string) (res []map[string]interface{}, err erro
}
for k := range fields {
if isEmpty(values[k]) {
line[fields[k]] = ""
line[fields[k]] = "[NULL]"
} else {
line[fields[k]] = values[k]
}
Expand Down
2 changes: 1 addition & 1 deletion api/pkg/model/view/sysop.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ type RespConfigmap struct {
}

type ReqTestInstance struct {
Datasource string `json:"datasource" default:"ch"`
Datasource string `json:"datasource" binding:"required"`
Dsn string `json:"dsn" binding:"required"`
}

Expand Down
7 changes: 0 additions & 7 deletions api/pkg/utils/clickhouse.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ func ClickhouseDsnConvert(req string) (res string) {
elog.Error("clickhouseDsnConvert", elog.Any("error", err))
return req
}

query := u.Query()
query.Del("write_timeout")
if strings.HasPrefix(req, "clickhouse://") ||
Expand All @@ -24,28 +23,22 @@ func ClickhouseDsnConvert(req string) (res string) {
u.RawQuery = query.Encode()
return u.String()
}

database := query.Get("database")
if database == "" {
database = "default"
}

password := query.Get("password")
if password != "" {
password = url.QueryEscape(query.Get("password")) // 处理特殊字符
}

res = fmt.Sprintf("clickhouse://%s:%s@%s/%s", query.Get("username"), password, u.Host, database)
query.Del("password")
query.Del("username")
query.Del("database")

queryValAssembly(query, "read_timeout", "ms")

if len(query) != 0 {
res = fmt.Sprintf("%s?%s", res, query.Encode())
}

return
}

Expand Down
2 changes: 1 addition & 1 deletion data/all-in-one/clickvisual/config/docker.toml
Original file line number Diff line number Diff line change
Expand Up @@ -81,4 +81,4 @@ teamIds = []
allowedOrganizations = []

[defaultCh]
dsn="tcp://clickhouse:9000?username=root&password=shimo&read_timeout=10&write_timeout=10&debug=true"
dsn="clickhouse://root:shimo@clickhouse:9000/default?max_execution_time=60"
181 changes: 0 additions & 181 deletions docker-compose.devops.m1.yml

This file was deleted.

39 changes: 19 additions & 20 deletions docker-compose.devops.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
version: '3'
networks:
cv-devops-net:
clickvisual-net:
driver: bridge
services:
nginx:
image: nginx
networks:
- cv-devops-net
- clickvisual-net
ports:
- "19003:80"
volumes:
Expand All @@ -18,7 +18,7 @@ services:
fluent-bit:
image: fluent/fluent-bit:1.8.12
networks:
- cv-devops-net
- clickvisual-net
environment:
KAFKA_BROKERS: kafka:9092
ports:
Expand All @@ -35,7 +35,7 @@ services:
zookeeper:
image: zookeeper
networks:
- cv-devops-net
- clickvisual-net
environment:
- ALLOW_ANONYMOUS_LOGIN=yes
expose:
Expand All @@ -47,7 +47,7 @@ services:
image: bitnami/kafka:2.8.1
user: root
networks:
- cv-devops-net
- clickvisual-net
environment:
- KAFKA_BROKER_ID=1
- KAFKA_ZOOKEEPER_CONNECT=zookeeper:2181
Expand All @@ -62,11 +62,11 @@ services:
kowl:
image: rsmnarts/kowl
networks:
- cv-devops-net
- clickvisual-net
environment:
KAFKA_BROKERS: kafka:9092
ports:
- "19002:8080"
- 19002:8080
depends_on:
- kafka
links:
Expand All @@ -75,10 +75,11 @@ services:
restart: always
mysql:
image: mysql:5.7.37
platform: linux/amd64
networks:
- cv-devops-net
- clickvisual-net
environment:
MYSQL_ROOT_PASSWORD: root
MYSQL_ROOT_PASSWORD: shimo
MYSQL_ROOT_HOST: '%'
command: [
'--character-set-server=utf8mb4',
Expand All @@ -87,31 +88,29 @@ services:
'--init-file=/data/all-in-one/migration/database.sql',
]
ports:
- "13306:13306"
- 13306:13306
volumes:
- ./scripts/migration:/data/all-in-one/migration
restart: always
redis:
image: redis:5.0.14-alpine
networks:
- cv-devops-net
- clickvisual-net
expose:
- 6380
restart: always
command: [ '--port 6380' ]
clickhouse:
image: clickhouse/clickhouse-server:latest
networks:
- cv-devops-net
- clickvisual-net
environment:
CLICKHOUSE_USER: root
CLICKHOUSE_PASSWORD: root
CLICKHOUSE_PASSWORD: shimo
expose:
- 9000
- 8123
ports:
- "8123:8123"
- "9000:9000"
volumes:
- ./data/all-in-one/clickhouse/database:/var/lib/clickhouse
- ./data/all-in-one/clickhouse/logs:/var/log
Expand All @@ -124,7 +123,7 @@ services:
- kafka
alertmanager:
networks:
- cv-devops-net
- clickvisual-net
image: prom/alertmanager:latest
volumes:
- ./data/all-in-one/alertmanager/alertmanager.yaml:/etc/alertmanager/config/alertmanager.yaml
Expand All @@ -139,13 +138,13 @@ services:
expose:
- 9093
ports:
- "19005:9093"
- 19005:9093
prom2click:
networks:
- cv-devops-net
- clickvisual-net
image: fhalim/prom2click:latest
command:
- '-ch.dsn=tcp://clickhouse:9000?username=root&password=root&read_timeout=10&write_timeout=10&debug=true'
- '-ch.dsn=tcp://clickhouse:9000?username=root&password=shimo&read_timeout=10&write_timeout=10&debug=true'
- '-ch.db=metrics'
- '-ch.table=samples'
expose:
Expand All @@ -158,7 +157,7 @@ services:
- clickhouse
prometheus:
networks:
- cv-devops-net
- clickvisual-net
image: prom/prometheus:latest
command:
- '--web.enable-lifecycle'
Expand Down
Loading

0 comments on commit 0591c8c

Please sign in to comment.