Add daemon csv export to Makefile

main
mathan 2024-02-20 20:43:50 -08:00
parent fba373f835
commit 3b77099bec
2 changed files with 30 additions and 1 deletions

4
.gitignore vendored
View File

@ -1,3 +1,5 @@
go.work* go.work*
.env .env
*.csv *.csv
*.out
csv_export.gz

View File

@ -1,5 +1,7 @@
.PHONY: all build up update down start-db status logs psql init-db .PHONY: all build up update down start-db status logs psql init-db
# ---------------------------- Docker ----------------------------
all: all:
go test -v ./... go test -v ./...
@ -28,6 +30,12 @@ status:
logs: logs:
@docker compose logs -f -n 50 lister consumer record-indexer @docker compose logs -f -n 50 lister consumer record-indexer
# ---------------------------- Docker ----------------------------
# ---------------------------- Database ----------------------------
psql: psql:
@docker compose exec -it postgres psql -U postgres -d bluesky @docker compose exec -it postgres psql -U postgres -d bluesky
@ -36,3 +44,22 @@ init-db: init.sql
@sleep 10 @sleep 10
@docker compose stop lister @docker compose stop lister
@cat db-migration/init.sql | docker exec -i "$$(docker compose ps --format '{{.Names}}' postgres)" psql -U postgres -d bluesky @cat db-migration/init.sql | docker exec -i "$$(docker compose ps --format '{{.Names}}' postgres)" psql -U postgres -d bluesky
# ---------------------------- Database ----------------------------
# ---------------------------- CSV Export ----------------------------
csv-export:
@nohup ./csv_export.sh > csv_export.out &
@tail -f csv_export.out
kill-csv-export:
@kill -9 `pgrep csv_export.sh`
csv-compress:
@tar -cvzf csv_export.gz handles.csv post_counts.csv follows.csv like_counts.csv
# ---------------------------- CSV Export ----------------------------