-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathjustfile
109 lines (83 loc) · 2.02 KB
/
justfile
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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
set export
## clean the project
clean:
cargo clean
## Install the SQLx CLI to run the migrations
install_sqlx:
cargo install sqlx-cli --version="~0.7" --no-default-features --features postgres,rustls
## Start the given service
start service="":
docker compose up {{service}} -d
## Stop the given service
stop service="":
docker compose down {{service}} -v
## Restart the service
reboot service="":
just stop {{service}}
just start {{service}}
## Restart the database
reboot-db:
just reboot db
## Restart redis
reboot-redis:
just reboot redis
## Start dependencies
start-deps: migrate
just start redis
_migrate:
sqlx database create
sqlx migrate run
## Run the database migrations
migrate:
just start db
just _migrate
## Build and run the service with docker-compose
docker-run:
docker compose up --build -d
## Stop the service
docker-stop:
docker compose down -v
## Restart the service
docker-reboot: docker-stop docker-run
## Start the server
run:
cargo run
## Run the tests quietly
test testset="":
cargo test {{testset}}
## Run the tests showing stacktraces
testv testset="":
RUST_BACKTRACE=1 cargo test {{testset}}
## Run the tests with verbose and colored output
testvv testset="":
RUST_LOG="sqlx=error,info" \
TEST_LOG=true \
RUST_BACKTRACE=full \
cargo test {{testset}} -- --nocapture | bunyan
## Format the code
format:
cargo fmt
## Run the linter
lint:
cargo check
cargo clippy
## Authenticate against DigitalOcean
deploy-auth:
doctl auth init
## Deploy the service to DigitalOcean
deploy-create:
doctl apps create --spec spec.yaml
## Update the service on DigitalOcean
deploy-update appid:
doctl apps update {{appid}} --spec spec.yaml
## List the apps on DigitalOcean
do-list-apps:
doctl apps list --format ID
## Auth and Deploy the service to DigitalOcean
deploy: deploy-auth deploy-create
## Run the migrations on DigitalOcean
migrate-do dbconnection:
DATABASE_URL={{dbconnection}} sqlx migrate run
## Update sqlx offline mode
sqlx-prepare:
cargo sqlx prepare --workspace