-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathjustfile
More file actions
65 lines (53 loc) · 1.89 KB
/
Copy pathjustfile
File metadata and controls
65 lines (53 loc) · 1.89 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
default:
@just --list
# build koochooloo binary
build:
@echo '{{ BOLD + CYAN }}Building Redpanda 101!{{ NORMAL }}'
go build -o redpanda101 ./cmd/redpanda101/main.go
# update go packages
update:
@cd ./cmd/redpanda101 && go get -u
# run golang-migrate
migrate *flags:
go tool github.com/golang-migrate/migrate/v4/cmd/migrate {{ flags }}
# create new migration
migrate-new name:
@just migrate create -dir migrations -ext sql {{ name }}
# set up the dev environment with docker-compose
dev cmd *flags:
#!/usr/bin/env bash
echo '{{ BOLD + YELLOW }}Development environment based on docker-compose{{ NORMAL }}'
set -euxo pipefail
if [ {{ cmd }} = 'down' ]; then
docker compose -f ./deployments/docker-compose.yml down
docker compose -f ./deployments/docker-compose.yml rm
elif [ {{ cmd }} = 'up' ]; then
docker compose -f ./deployments/docker-compose.yml up --wait -d {{ flags }}
else
docker compose -f ./deployments/docker-compose.yml {{ cmd }} {{ flags }}
fi
# run golangci-lint
lint:
golangci-lint run -c .golangci.yml --fix
# run producer (HTTP API + Kafka producer)
produce:
go run ./cmd/redpanda101 -c configs/producer.toml produce
# run consumer (Kafka consumer + PostgreSQL)
consume:
go run ./cmd/redpanda101 -c configs/consumer.toml consume
# run database migrations
db-migrate:
go run ./cmd/redpanda101 migrate
# create redpanda topics
redpanda-migrate:
docker exec -it deployments-redpanda-1 rpk topic create orders trades --brokers localhost:9092
# run k6 load test
loadtest:
k6 run api/k6/script.js
# setup and run everything (infrastructure + migrations)
setup:
@echo '{{ BOLD + GREEN }}Setting up Redpanda101 environment{{ NORMAL }}'
just dev up
just redpanda-migrate
just db-migrate
@echo '{{ BOLD + GREEN }}Setup complete! Run "just produce" and "just consume" in separate terminals{{ NORMAL }}'