Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -343,6 +343,7 @@ storage:
user: "admin"
password: "admin"
database: "base"
disableTLS: false
staging:
driver: "memory"
memory:
Expand Down
11 changes: 6 additions & 5 deletions configs/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,12 @@ type StorageConnectionConfig struct {
}

type ClickhouseConfig struct {
Host string `mapstructure:"host"`
Port int `mapstructure:"port"`
Username string `mapstructure:"username"`
Password string `mapstructure:"password"`
Database string `mapstructure:"database"`
Host string `mapstructure:"host"`
Port int `mapstructure:"port"`
Username string `mapstructure:"username"`
Password string `mapstructure:"password"`
Database string `mapstructure:"database"`
DisableTLS bool `mapstructure:"disableTLS"`
}

type MemoryConfig struct {
Expand Down
65 changes: 65 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
services:
redis:
image: redis:latest
ports:
- "6379:6379"
volumes:
- redis_data:/data
command: redis-server --appendonly yes
profiles:
- redis

# http://localhost:8123/play <- web ui
clickhouse:
image: clickhouse/clickhouse-server:latest
ports:
- "8123:8123"
- "9000:9000"
volumes:
- clickhouse_data:/var/lib/clickhouse
ulimits:
nofile:
soft: 262144
hard: 262144

prometheus:
image: prom/prometheus:latest
ports:
- "9090:9090"
command:
- '--config.file=/etc/prometheus/prometheus.yml'
configs:
- source: prometheus_config
target: /etc/prometheus/prometheus.yml
extra_hosts:
- "host.docker.internal:host-gateway"
profiles:
- monitoring

grafana:
image: grafana/grafana:latest
environment:
- GF_SECURITY_ADMIN_USER=admin
- GF_SECURITY_ADMIN_PASSWORD=admin
ports:
- "4000:3000"
volumes:
- grafana_data:/var/lib/grafana
profiles:
- monitoring

volumes:
redis_data:
clickhouse_data:
grafana_data:

configs:
prometheus_config:
content: |
global:
scrape_interval: 15s

scrape_configs:
- job_name: 'local_service'
static_configs:
- targets: ['host.docker.internal:2112']
7 changes: 6 additions & 1 deletion internal/storage/clickhouse.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,12 @@ func connectDB(cfg *config.ClickhouseConfig) (clickhouse.Conn, error) {
conn, err := clickhouse.Open(&clickhouse.Options{
Addr: []string{fmt.Sprintf("%s:%d", cfg.Host, port)},
Protocol: clickhouse.Native,
TLS: &tls.Config{}, // enable secure TLS
TLS: func() *tls.Config {
if cfg.DisableTLS {
return nil
}
return &tls.Config{}
}(),
Auth: clickhouse.Auth{
Username: cfg.Username,
Password: cfg.Password,
Expand Down
Loading