2024-04-13 21:24:01 +02:00
|
|
|
.PHONY: all build up update down start-db status logs psql init-db start-plc wait-for-plc
|
2024-02-18 21:23:54 +01:00
|
|
|
|
2024-02-21 05:43:50 +01:00
|
|
|
# ---------------------------- Docker ----------------------------
|
|
|
|
|
2024-02-18 21:23:54 +01:00
|
|
|
all:
|
|
|
|
go test -v ./...
|
|
|
|
|
2024-02-19 20:05:50 +01:00
|
|
|
.env:
|
2024-02-18 21:23:54 +01:00
|
|
|
@cp example.env .env
|
|
|
|
@echo "Please edit .env to suit your environment before proceeding"
|
2024-02-18 21:27:17 +01:00
|
|
|
@exit 1
|
2024-02-18 21:23:54 +01:00
|
|
|
|
|
|
|
build: .env
|
|
|
|
@docker compose build
|
|
|
|
|
|
|
|
up: .env
|
|
|
|
@docker compose up -d --build
|
|
|
|
|
|
|
|
update: up
|
|
|
|
|
|
|
|
down:
|
|
|
|
@docker compose down
|
|
|
|
|
2024-04-13 19:50:06 +02:00
|
|
|
start-db: .env
|
2024-02-18 21:23:54 +01:00
|
|
|
@docker compose up -d postgres
|
|
|
|
|
|
|
|
status:
|
|
|
|
@docker compose stats
|
|
|
|
|
|
|
|
logs:
|
2024-04-13 20:42:36 +02:00
|
|
|
@docker compose logs -f -n 50
|
|
|
|
|
|
|
|
start-plc: .env
|
|
|
|
@docker compose up -d --build postgres plc
|
|
|
|
|
|
|
|
wait-for-plc:
|
2024-04-13 21:24:01 +02:00
|
|
|
@. ./.env && while ! curl -s --fail-with-body http://$${METRICS_ADDR:-localhost}:11004/ready; do sleep 10; done
|
2024-02-18 21:23:54 +01:00
|
|
|
|
2024-02-21 05:43:50 +01:00
|
|
|
# ---------------------------- Docker ----------------------------
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# ---------------------------- Database ----------------------------
|
|
|
|
|
2024-02-18 21:29:14 +01:00
|
|
|
psql:
|
2024-05-30 16:55:35 +02:00
|
|
|
@docker compose up -d postgres
|
2024-02-18 21:29:14 +01:00
|
|
|
@docker compose exec -it postgres psql -U postgres -d bluesky
|
2024-02-19 20:05:50 +01:00
|
|
|
|
2024-04-13 19:50:06 +02:00
|
|
|
init-db: .env
|
2024-02-19 20:05:50 +01:00
|
|
|
@docker compose up -d --build lister
|
|
|
|
@sleep 10
|
|
|
|
@docker compose stop lister
|
2024-02-23 03:54:29 +01:00
|
|
|
@cat ./db-migration/init.sql | docker exec -i "$$(docker compose ps --format '{{.Names}}' postgres)" psql -U postgres -d bluesky
|
2024-02-21 05:43:50 +01:00
|
|
|
|
2024-02-23 12:19:13 +01:00
|
|
|
sqltop:
|
|
|
|
watch -n 1 'cat top.sql|docker compose exec -i postgres psql -U postgres -d bluesky'
|
|
|
|
|
2024-02-23 12:26:06 +01:00
|
|
|
sqldu:
|
|
|
|
cat du.sql | docker compose exec -iT postgres psql -U postgres -d bluesky
|
|
|
|
|
2024-02-21 05:43:50 +01:00
|
|
|
# ---------------------------- Database ----------------------------
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# ---------------------------- CSV Export ----------------------------
|
|
|
|
|
2024-02-28 19:37:18 +01:00
|
|
|
# NOT RECOMMENDED TO RUN for the firts time on hot live db, will chomp all available IO. stop services first
|
2024-02-21 05:43:50 +01:00
|
|
|
csv-export:
|
2024-03-13 05:15:23 +01:00
|
|
|
@docker compose up -d postgres
|
|
|
|
@sleep 10
|
2024-02-21 05:43:50 +01:00
|
|
|
@nohup ./csv_export.sh > csv_export.out &
|
|
|
|
|
2024-03-13 05:15:23 +01:00
|
|
|
csv-iexport:
|
|
|
|
@docker compose up -d postgres
|
|
|
|
@sleep 10
|
2024-03-28 03:59:24 +01:00
|
|
|
@nohup ./csv_iexport.sh > csv_iexport.out &
|
2024-03-13 05:15:23 +01:00
|
|
|
|
2024-05-15 04:26:00 +02:00
|
|
|
csv-iexport-month:
|
|
|
|
@docker compose up -d postgres
|
|
|
|
@sleep 10
|
|
|
|
@nohup ./csv_iexport_month.sh > csv_iexport_month.out &
|
|
|
|
|
2024-02-21 05:43:50 +01:00
|
|
|
kill-csv-export:
|
|
|
|
@kill -9 `pgrep csv_export.sh`
|
|
|
|
|
2024-03-13 05:15:23 +01:00
|
|
|
kill-csv-iexport:
|
|
|
|
@kill -9 `pgrep csv_iexport.sh`
|
2024-02-21 05:43:50 +01:00
|
|
|
|
2024-05-15 04:26:00 +02:00
|
|
|
kill-csv-iexport-month:
|
|
|
|
@kill -9 `pgrep csv_iexport_month.sh`
|
|
|
|
|
2024-02-21 10:16:19 +01:00
|
|
|
# ---------------------------- CSV Export ----------------------------
|
2024-04-15 22:58:33 +02:00
|
|
|
|
|
|
|
|
|
|
|
dash-export:
|
|
|
|
@./dashboards/export.sh
|
|
|
|
|
|
|
|
dash-import:
|
|
|
|
@./dashboards/update.sh
|