Skip to content

Commit 49b7ed5

Browse files
committed
Better document initializing the docker-compose environment
1 parent deaf54a commit 49b7ed5

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
@@ -16,3 +16,30 @@ lint:
1616

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

README.md

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

124124
You'll need to `touch .docker.env` first, this file can have any environment
125-
variable overrides you want to use in docker containers.
125+
variable overrides you want to use in docker containers. Then run the migrations
126+
before launching the main services:
127+
128+
```sh
129+
docker compose run --build --rm cli database migrate
130+
docker compose up --build -d
131+
```
126132

127133
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):
128134

@@ -142,15 +148,25 @@ docker compose run --rm cli database migrate
142148
docker compose run --rm cli queue add regex 1.3.1
143149
```
144150

145-
If the command needs the crates.io-index clone then it must be run from within
146-
a `registry-watcher` container:
151+
If you want to run the registry watcher, you'll need to first set the "last seen
152+
reference" from the registry index, e.g. to set it to the current head so only
153+
newly published crates are built:
154+
155+
```sh
156+
docker compose run --rm cli queue set-last-seen-reference --head
157+
```
158+
159+
Then enable the docker-compose profile that includes the watcher:
147160

148161
```sh
149-
docker compose run --rm registry-watcher queue set-last-seen-reference --head
162+
docker compose --profile watch up --build -d
150163
```
151164

152165
Note that running tests is not supported when using pure docker-compose.
153166

167+
Some of the above commands are included in the `Justfile` for ease of use,
168+
check the `[compose]` group in `just --list`.
169+
154170
Please file bugs for any trouble you have running docs.rs!
155171

156172
### Docker-Compose

0 commit comments

Comments
 (0)