-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathjustfile
More file actions
223 lines (173 loc) · 4.57 KB
/
justfile
File metadata and controls
223 lines (173 loc) · 4.57 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
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
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
# Install Just: https://github.com/casey/just
##########
## Rust ##
##########
# Build Debug Binary
build:
cargo build
# Build Release Binary
build-release:
cargo build --release
# Build and Run a Develop Binay
run:
cargo run
# Build and Run a Release Binary
run-release:
cargo run --release
# Check Rust Code
check:
cargo check --locked
# Check Rust Code using the SQLx Cache
check_w_sqlx_cache:
SQLX_OFFLINE=true cargo check --locked
# Check Rust Linting
clippy:
cargo clippy --locked -- --deny warnings
# Check Rust Linting using SQLx Cache
clippy_w_sqlx_cache:
SQLX_OFFLINE=true cargo clippy --locked -- --deny warnings
# Apply Rust Formating
fmt:
cargo fmt --verbose
# Check Rust Formating
fmt-check:
cargo fmt --check --verbose
# Check Rust Unittest
test:
cargo test --locked
# Install SQLx-CLI
sqlx-install:
cargo install sqlx-cli --locked
# SQLx DB Migration
sqlx-migrate:
sqlx migrate run
# Refresh SQLx Cache
sqlx-prepare:
cargo sqlx prepare
# Check SQLx Cache
sqlx-check:
cargo sqlx prepare --check
# Install Cargo Deny
deny-install:
cargo install cargo-deny --locked
# Check Rust advisories, bans, licenses, sources
deny:
cargo deny check
################
## PostgreSQL ##
################
# Start a local PostgreSQL instance for development.
pg-start:
docker run \
-dt \
--rm \
--name airflow_postgresql \
--env POSTGRES_USER=airflow_user \
--env POSTGRES_PASSWORD=password \
--env POSTGRES_DB=airflow_db \
--volume airflow_postgresql:/var/lib/postgresql/data \
--publish 5432:5432 \
docker.io/library/postgres:alpine
# Stop local PostgreSQL
pg-stop:
docker stop airflow_postgresql
# Start local PostgreSQL via Podman
pg-start-podman:
podman run \
-dt \
--rm \
--name airflow_postgresql \
--env POSTGRES_USER=airflow_user \
--env POSTGRES_PASSWORD=password \
--env POSTGRES_DB=airflow_db \
--volume airflow_postgresql:/var/lib/postgresql/data \
--publish 5432:5432 \
docker.io/library/postgres:alpine
# Stop local PostgreSQL via Podman
pg-stop-podman:
podman stop airflow_postgresql
# Connect to PostgreSQL via Rainfrog (https://github.com/achristmascarl/rainfrog)
pg-cli:
rainfrog \
--username=airflow_user \
--password=password \
--host=localhost \
--port=5432 \
--database=airflow_db \
--driver=postgres
############
## Docker ##
############
# Build the Docker image
docker-build:
docker build . --file Containerfile --tag localhost/kyubey:latest
# Run the Docker container in Detached mode
docker-run:
docker run \
--name=kyubey \
--detach \
--rm \
--publish=3000:3000 \
--network=host \
--env DATABASE_URL=postgres://airflow_user:password@localhost/airflow_db \
--env LOG_PATH=gitignore/logs \
localhost/kyubey:latest
# Dump logs from container
docker-logs:
docker logs kyubey
# Follow logs from container
docker-follow:
docker logs --follow kyubey
# Kill the Detached Docker container
docker-kill:
docker kill kyubey
# Test the Healthcheck and that the service came up (Docker only)
docker-healthcheck:
sh ./scripts/test_healthcheck.sh
# Build the Docker image via Podman
podman-build:
podman build . --file Containerfile --tag localhost/kyubey:latest
# Run the Docker container in Detached mode via Podman
podman-run:
podman run \
--name=kyubey \
--detach \
--rm \
--publish=3000:3000 \
--network=host \
--env DATABASE_URL=postgres://airflow_user:password@localhost/airflow_db \
--env LOG_PATH=gitignore/logs \
localhost/kyubey:latest
# Dump logs from container via Podman
podman-logs:
podman logs kyubey
# Follow logs from container via Podman
podman-follow:
podman logs --follow kyubey
# Kill the Detached Docker container via Podman
podman-kill:
podman kill kyubey
###########
## Trivy ##
###########
# Trivy Scan the code repo
trivy-repo:
trivy repo .
# Trivy Scan the Docker image
trivy-image:
trivy image localhost/kyubey:latest
############
## Github ##
############
# Run all Github Rust Checks
github-rust-checks: sqlx-migrate sqlx-check check_w_sqlx_cache clippy_w_sqlx_cache fmt-check test deny
# Run all Github Docker Checks
github-docker-checks: docker-build docker-run docker-healthcheck docker-kill
# Run all Github Docker Checks via Podman
github-podman-checks: podman-build
# Run all Github Trivy Checks
github-trivy-checks: trivy-repo trivy-image
# Run all Github Checks
github-checks: github-rust-checks github-docker-checks github-trivy-checks
# Run all Github Checks via Podman
github-checks-podman: github-rust-checks github-podman-checks github-trivy-checks