mirror of
https://github.com/Semptic/go-crowley.git
synced 2026-10-18 12:21:01 +00:00
POC to use go as a webcrawler with postgres as queue
- Go 82.5%
- templ 17.3%
- Shell 0.2%
| Filename | Latest commit message | Latest commit date |
|---|---|---|
| cmd | ||
| db/migrations | ||
| .env | ||
| .gitignore | ||
| .monitor.air.toml | ||
| docker-compose.yaml | ||
| go.mod | ||
| go.sum | ||
| LICENSE | ||
| README.md | ||
| watch_monitor.sh | ||
Crowley
Run
- Start postgres
docker compose up -d
- Add couple of domains to crawl
go run cmd/manager/*.go -p wiki -u https://en.wikipedia.org/wiki/Music_genre
go run cmd/manager/*.go -p hackernews -u https://news.ycombinator.com/
- Start the monitor
./watch_monitor.sh
or
go run cmd/monitor/*.go
- Start some worker (run the following in multiple terminals)
go run cmd/worker/*.go
Setup
Prerequisites
Install go, templ, air (Until this is merged install git clone -b feat-live-proxy https://github.com/ndajr/air && cd air && go install .).
DB
Use migrate for handling database migrations and pgx for postgres.
go install -tags 'postgres' github.com/golang-migrate/migrate/v4/cmd/migrate@latest
Create new migration file
migrate create -dir db/migrations -ext sql [NAME]
Drop database
USER=<user>; PASS=<pass> migrate -database "postgres://$USER:$PASS@localhost:5432/galaxy?sslmode=disable" drop