Skip to content

Commit 7ba3b8e

Browse files
Nemo157syphar
authored andcommitted
Better document initializing the docker-compose environment
1 parent 574ceb3 commit 7ba3b8e

File tree

2 files changed

+47
-4
lines changed

2 files changed

+47
-4
lines changed

Justfile

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,30 @@ lint-fix:
1919

2020
lint-js *args:
2121
deno run -A npm:eslint@9 static templates gui-tests eslint.config.js {{ args }}
22+
23+
# Initialize the docker compose database
24+
[group('compose')]
25+
compose-migrate:
26+
docker compose run --build --rm cli database migrate
27+
28+
# Update last seen reference to the current index head, to only build newly published crates
29+
[group('compose')]
30+
compose-queue-head:
31+
docker compose run --build --rm cli queue set-last-seen-reference --head
32+
33+
# Launch base docker services, ensuring the database is migrated
34+
[group('compose')]
35+
compose-up:
36+
just compose-migrate
37+
docker compose up --build -d
38+
39+
# Launch base docker services and registry watcher, ensuring the database is migrated
40+
[group('compose')]
41+
compose-up-watch:
42+
just compose-migrate
43+
docker compose --profile watch up --build -d
44+
45+
# Shutdown docker services and cleanup all temporary volumes
46+
[group('compose')]
47+
compose-down:
48+
docker compose --profile all down --volumes --remove-orphans

README.md

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,13 @@ This will not cache dependencies - in particular, you'll have to rebuild all 400
134134
but makes sure that you're in a known environment so you should have fewer problems getting started.
135135

136136
You'll need to `touch .docker.env` first, this file can have any environment
137-
variable overrides you want to use in docker containers.
137+
variable overrides you want to use in docker containers. Then run the migrations
138+
before launching the main services:
139+
140+
```sh
141+
docker compose run --build --rm cli database migrate
142+
docker compose up --build -d
143+
```
138144

139145
You can also use the `builder-a` container to run builds on systems which don't support running builds directly (mostly on Mac OS or Windows):
140146

@@ -154,15 +160,25 @@ docker compose run --rm cli database migrate
154160
docker compose run --rm cli queue add regex 1.3.1
155161
```
156162

157-
If the command needs the crates.io-index clone then it must be run from within
158-
a `registry-watcher` container:
163+
If you want to run the registry watcher, you'll need to first set the "last seen
164+
reference" from the registry index, e.g. to set it to the current head so only
165+
newly published crates are built:
166+
167+
```sh
168+
docker compose run --rm cli queue set-last-seen-reference --head
169+
```
170+
171+
Then enable the docker-compose profile that includes the watcher:
159172

160173
```sh
161-
docker compose run --rm registry-watcher queue set-last-seen-reference --head
174+
docker compose --profile watch up --build -d
162175
```
163176

164177
Note that running tests is not supported when using pure docker-compose.
165178

179+
Some of the above commands are included in the `Justfile` for ease of use,
180+
check the `[compose]` group in `just --list`.
181+
166182
Please file bugs for any trouble you have running docs.rs!
167183

168184
### Docker-Compose

0 commit comments

Comments
 (0)