2024-02-19 20:05:50 +01:00
|
|
|
.PHONY: all build up update down start-db status logs psql init-db
|
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
|
|
|
|
|
|
|
|
start-db:
|
|
|
|
@docker compose up -d postgres
|
|
|
|
|
|
|
|
status:
|
|
|
|
@docker compose stats
|
|
|
|
|
|
|
|
logs:
|
|
|
|
@docker compose logs -f -n 50 lister consumer record-indexer
|
|
|
|
|
2024-02-21 05:43:50 +01:00
|
|
|
# ---------------------------- Docker ----------------------------
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# ---------------------------- Database ----------------------------
|
|
|
|
|
2024-02-18 21:29:14 +01:00
|
|
|
psql:
|
|
|
|
@docker compose exec -it postgres psql -U postgres -d bluesky
|
2024-02-19 20:05:50 +01:00
|
|
|
|
2024-02-23 03:54:29 +01:00
|
|
|
init-db:
|
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-21 05:43:50 +01:00
|
|
|
# ---------------------------- Database ----------------------------
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# ---------------------------- CSV Export ----------------------------
|
|
|
|
|
|
|
|
csv-export:
|
|
|
|
@nohup ./csv_export.sh > csv_export.out &
|
|
|
|
|
|
|
|
kill-csv-export:
|
|
|
|
@kill -9 `pgrep csv_export.sh`
|
|
|
|
|
|
|
|
csv-compress:
|
2024-02-21 22:40:18 +01:00
|
|
|
@tar cvzf csv_export.tgz dids.csv handles.csv post_counts.csv follows.csv like_counts.csv
|
2024-02-21 05:43:50 +01:00
|
|
|
|
2024-02-21 10:16:19 +01:00
|
|
|
# ---------------------------- CSV Export ----------------------------
|