replace migrator & add local domain
This commit is contained in:
parent
261e79af54
commit
9871ba73ef
4
.env
Normal file
4
.env
Normal file
@ -0,0 +1,4 @@
|
||||
CLICKHOUSE_USER=default
|
||||
CLICKHOUSE_PASSWORD=default
|
||||
CLICKHOUSE_DB=default
|
||||
CLICKHOUSE_PORT=8123
|
16
Makefile
16
Makefile
@ -1,12 +1,24 @@
|
||||
include .env
|
||||
SHELL = /bin/bash -o pipefail
|
||||
|
||||
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:
|
||||
@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
|
||||
|
||||
up:
|
||||
@docker-compose up
|
||||
|
||||
stop:
|
||||
@docker-compose stop
|
||||
|
||||
down:
|
||||
@docker-compose down -v
|
||||
|
@ -7,13 +7,18 @@ services:
|
||||
- grafana_data:/var/lib/grafana
|
||||
ports:
|
||||
- '3000:3000'
|
||||
labels:
|
||||
traefik.enable: "true"
|
||||
traefik.http.routers.grafana.entrypoints: web
|
||||
traefik.http.routers.grafana.rule: "Host(`grafana.test`)"
|
||||
traefik.http.services.grafana.loadbalancer.server.port: "3000"
|
||||
clickhouse:
|
||||
image: docker.io/bitnami/clickhouse:23
|
||||
environment:
|
||||
- CLICKHOUSE_ADMIN_USER=default
|
||||
- CLICKHOUSE_ADMIN_PASSWORD=default
|
||||
- CLICKHOUSE_ADMIN_USER=${CLICKHOUSE_USER}
|
||||
- CLICKHOUSE_ADMIN_PASSWORD=${CLICKHOUSE_PASSWORD}
|
||||
ports:
|
||||
- '8123:8123'
|
||||
- '${CLICKHOUSE_PORT}:8123'
|
||||
volumes:
|
||||
- clickhouse_data:/bitnami/clickhouse
|
||||
vector:
|
||||
|
3
files/Dockerfile.migrator
Normal file
3
files/Dockerfile.migrator
Normal 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"]
|
@ -1 +0,0 @@
|
||||
DROP TABLE log_docker_raw;
|
Loading…
Reference in New Issue
Block a user