Skip to content

Commit 10c91e0

Browse files
committed
first
1 parent 95c0dc2 commit 10c91e0

File tree

1 file changed

+32
-43
lines changed

1 file changed

+32
-43
lines changed

README.md

Lines changed: 32 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -28,15 +28,6 @@ The recommended way to develop docs.rs is a combination of `cargo run` for
2828
the main binary and [docker-compose](https://docs.docker.com/compose/) for the external services.
2929
This gives you reasonable incremental build times without having to add new users and packages to your host machine.
3030

31-
### Git Hooks
32-
33-
For ease of use, `git_hooks` directory contains useful `git hooks` to make your development easier.
34-
35-
```bash
36-
# Unix
37-
cd .git/hooks && ln -s ../../.git_hooks/* . && cd ../..
38-
# Powershell
39-
cd .git/hooks && New-Item -Path ../../.git_hooks/* -ItemType SymbolicLink -Value . && cd ../..
4031
```
4132
4233
### Dependencies
@@ -108,7 +99,7 @@ cargo test
10899
To run GUI tests:
109100

110101
```
111-
./dockerfiles/run-gui-tests.sh
102+
just run-gui-tests
112103
```
113104

114105
They use the [browser-ui-test](https://github.com/GuillaumeGomez/browser-UI-test/) framework. You
@@ -128,82 +119,80 @@ npm install browser-ui-test
128119

129120
### Pure docker-compose
130121

131-
If you have trouble with the above commands, consider using `docker compose up --build`,
122+
If you have trouble with the above commands, consider using `just compose-up-web`,
132123
which uses docker-compose for the web server as well.
133124
This will not cache dependencies - in particular, you'll have to rebuild all 400 whenever the lockfile changes -
134125
but makes sure that you're in a known environment so you should have fewer problems getting started.
135126

136-
You'll need to `touch .docker.env` first, this file can have any environment
137-
variable overrides you want to use in docker containers. Then run the migrations
138-
before launching the main services:
127+
You can put environment overrides for the docker containers into `.docker.env`,
128+
first. The migrations will be run by our just recipes when needed.
139129

140130
```sh
141-
docker compose run --build --rm cli database migrate
142-
docker compose up --build -d
131+
just cli-db-migrate
132+
just compose-up-web
143133
```
144134

145-
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):
135+
You can also use the `builder` compose profile to run builds on systems which don't support running builds directly (mostly on Mac OS or Windows):
146136

147137
```sh
138+
just compose-up-builder
139+
140+
# and if needed
141+
148142
# update the toolchain
149-
docker compose run --rm builder-a build update-toolchain
143+
just cli-build-update-toolchain
144+
150145
# run a build for a single crate
151-
docker compose run --rm builder-a build crate regex 1.3.1
152-
# rebuild containers when you changed code.
153-
docker compose up --wait --build
146+
just cli-build-crate regex 1.3.1
154147
```
155148

156149
You can also run other non-build commands like the setup steps above, or queueing crates for the background builders from within the `cli` container:
157150

158151
```sh
159-
docker compose run --rm cli database migrate
160-
docker compose run --rm cli queue add regex 1.3.1
152+
just cli-db-migrate
153+
just cli-queue-add regex 1.3.1
161154
```
162155

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-
156+
If you want to run the registry watcher, you can use the `watcher` profile:
167157
```sh
168-
docker compose run --rm cli queue set-last-seen-reference --head
158+
just compose-up-watcher
169159
```
170160

171-
Then enable the docker-compose profile that includes the watcher:
161+
It it was never run, we will start watching for registry changes at the current HEAD of the index.
162+
163+
If you want to start from another point:
172164

173165
```sh
174-
docker compose --profile watch up --build -d
166+
just cli-queue-reset-last-seen-ref GIT_REF
175167
```
176168

177-
Note that running tests is not supported when using pure docker-compose.
169+
Note that running tests is currently not supported when using pure docker-compose.
178170

179171
Some of the above commands are included in the `Justfile` for ease of use,
180-
check the `[compose]` group in `just --list`.
172+
check `just --list` for an overview.
181173

182174
Please file bugs for any trouble you have running docs.rs!
183175

184176
### Docker-Compose
185177

186178
The services started by Docker-Compose are defined in [docker-compose.yml].
187-
Three services are defined:
188-
189-
| name | access | credentials | description |
190-
|------|-------------------------------------------------|----------------------------|----------------------------------------|
191-
| web | http://0.0.0.0:3000 | N/A | A container running the docs.rs binary |
192-
| db | postgresql://cratesfyi:password@127.0.0.1:15432 | - | Postgres database used by web |
193-
| s3 | http://127.0.0.1:9000 | `cratesfyi` - `secret_key` | MinIO (simulates AWS S3) used by web |
179+
For convenience, there are plenty of `just` recipes built around it.
194180

195181
[docker-compose.yml]: ./docker-compose.yml
196182

197183
#### Rebuilding Containers
198184

199-
To rebuild the site, run `docker compose --profile all build`.
200-
Note that docker-compose caches the build even if you change the source code,
201-
so this will be necessary anytime you make changes.
185+
The `just` recipes for compose handle rebuilds themselves, so nothing needs to
186+
be done here.
202187

203188
If you want to completely clean up the database, don't forget to remove the volumes too:
204189

205190
```sh
206-
$ docker compose down --volumes
191+
# just shut down containers normally
192+
$ just compose-down
193+
194+
# shut down and clear all volumes.
195+
$ just compose-down-and-wipe
207196
```
208197

209198
#### FAQ

0 commit comments

Comments
 (0)