-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathjustfile
More file actions
155 lines (122 loc) · 3.7 KB
/
justfile
File metadata and controls
155 lines (122 loc) · 3.7 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
set dotenv-load := false
export JUST_UNSTABLE := "true"
# Display list of available recipes
@_default:
just --list
# Initialize project with first-time setup
bootstrap *ARGS:
#!/usr/bin/env bash
set -euo pipefail
if [ ! -f ".env" ]; then
cp .env-dist .env
echo ".env created"
fi
just build {{ ARGS }} --force-rm
# Build Docker containers with optional arguments
@build *ARGS:
docker compose build {{ ARGS }}
# Open a bash shell in the utility container
@console:
docker compose run --rm --no-deps utility /bin/bash
# Open interactive bash console in database container
@console-db:
docker compose run \
--no-deps \
--rm \
db /bin/bash
# Stop and remove Docker containers and networks
@down *ARGS:
docker compose down {{ ARGS }}
# Format justfile with proper indentation and spacing
@fmt:
just --fmt
# Run pre-commit hooks on all files
@lint *ARGS:
uv --quiet tool run prek {{ ARGS }} --all-files
# Update pre-commit hooks to latest versions
@lint-autoupdate:
uv --quiet tool run prek autoupdate
# Create or update dependency lock file
@lock *ARGS:
uv lock {{ ARGS }}
# Display logs from Docker containers
@logs *ARGS:
docker compose logs {{ ARGS }}
# Run Django management commands in the utility container
@manage *ARGS:
docker compose run --rm --no-deps utility uv run -m manage {{ ARGS }}
# Run Django migrations to apply database schema changes
@migrate *ARGS:
docker compose run --rm --no-deps utility uv run -m manage migrate {{ ARGS }}
# Generate Django migration files from model changes
@makemigrations *ARGS:
docker compose run --rm --no-deps utility uv run -m manage makemigrations {{ ARGS }}
# Dump database to file
@pg_dump file='db.dump':
docker compose run \
--no-deps \
--rm \
db pg_dump \
--dbname "${DATABASE_URL:=postgres://postgres@db/postgres}" \
--file /src/{{ file }} \
--format=c \
--verbose
# Restore database dump from file
@pg_restore file='db.dump':
docker compose run \
--no-deps \
--rm \
db pg_restore \
--dbname "${DATABASE_URL:=postgres://postgres@db/postgres}" \
--no-owner \
--verbose \
/src/{{ file }}
# Pull Docker images
@pull *ARGS:
docker compose pull {{ ARGS }}
# Restart Docker containers
@restart *ARGS:
docker compose restart {{ ARGS }}
# Run a one-off command in the utility container
@run *ARGS:
docker compose run \
--no-deps \
--rm \
utility {{ ARGS }}
# Open Django's interactive Python shell
@shell:
docker compose run --rm --no-deps utility uv run -m manage shell
# Start the application (alias for 'up')
@start *ARGS="--detach":
just up {{ ARGS }}
# Stop running containers
@stop *ARGS:
docker compose stop {{ ARGS }}
# Follow logs from Docker containers
@tail:
just logs --follow
# Run tests with pytest in the utility container
@test *ARGS:
docker compose run \
--no-deps \
--rm \
utility uv run pytest {{ ARGS }}
# Start Docker containers with optional arguments
@up *ARGS:
docker compose up {{ ARGS }}
# Update dependencies and pre-commit hooks
@update:
just upgrade
just lint-autoupdate
# Upgrade dependencies in lock file
@upgrade:
just lock --upgrade
# Watch for file changes and rebuild Docker services
@watch *ARGS:
docker compose watch {{ ARGS }}
# Update version number using bumpver (--dry for preview, omit for actual bump)
@bump *ARGS="--dry":
uvx bumpver update {{ ARGS }}
# Create a superuser account for Django admin access
@createsuperuser:
docker compose run --rm --no-deps utility uv run -m manage createsuperuser