Merge branch 'master' of git.neur0tx.site:Neur0toxine/docker-logs-grafana-clickhouse

This commit is contained in:
Pavel 2024-09-26 12:50:48 +03:00
commit f3382f71f3
7 changed files with 1085 additions and 4 deletions

4
.env Normal file
View File

@ -0,0 +1,4 @@
CLICKHOUSE_USER=default
CLICKHOUSE_PASSWORD=default
CLICKHOUSE_DB=default
CLICKHOUSE_PORT=8123

View File

@ -1,12 +1,24 @@
include .env
SHELL = /bin/bash -o pipefail SHELL = /bin/bash -o pipefail
ROOT_DIR=$(shell dirname $(realpath $(lastword $(MAKEFILE_LIST)))) ROOT_DIR=$(shell dirname $(realpath $(lastword $(MAKEFILE_LIST))))
MIGRATIONS_DIR=$(SRC_DIR)/files/migrations MIGRATIONS_DIR=$(ROOT_DIR)/files/migrations
all: migrator migrate up
migrator:
@docker buildx build --tag neur0toxine/clickhouse-migrations:latest -f $(ROOT_DIR)/files/Dockerfile.migrator $(ROOT_DIR)/files
migrate: migrate:
@docker-compose up -d @docker-compose up -d
@docker run -v $(MIGRATIONS_DIR):/migrations --network host migrate/migrate -path=/migrations/ -database "clickhouse://localhost:8123?username=default&password=default&database=default" up all @docker run -v $(MIGRATIONS_DIR):/migrations --network host neur0toxine/clickhouse-migrations:latest migrate --host=http://localhost:$(CLICKHOUSE_PORT) --user=$(CLICKHOUSE_USER) --password=$(CLICKHOUSE_PASSWORD) --db=default --migrations-home=/migrations
@docker-compose stop @docker-compose stop
up: up:
@docker-compose up @docker-compose up
stop:
@docker-compose stop
down:
@docker-compose down -v

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,3 @@
FROM node:lts-alpine
RUN npm install --global clickhouse-migrations && npm cache clean --force
ENTRYPOINT ["/usr/local/bin/clickhouse-migrations"]

View File

@ -1 +0,0 @@
DROP TABLE log_docker_raw;

View File

@ -40,4 +40,4 @@ sinks:
user: default user: default
password: default password: default
database: default database: default
table: log_docker_raw table: log_docker_raw