@@ -472,3 +472,90 @@ this crate's `Cargo.toml`, and `cargo build` should display output like this:
472
472
Compiling thiscrate v0.1.0 (file:///path/to/thiscrate)
473
473
Finished dev [ unoptimized + debuginfo] target(s) in 0.56 secs
474
474
```
475
+
476
+ ### Running crates.io with Docker
477
+
478
+ There are Dockerfiles to build both the backend and the frontend,
479
+ (`backend.Dockerfile` and `frontend.Dockerfile`) respectively, but it is most
480
+ useful to just use docker-compose to bring up everything that's needed all in
481
+ one go:
482
+
483
+ ```
484
+ docker-compose up -d
485
+ ```
486
+
487
+ The Compose file is filled out with a sane set of defaults that should Just
488
+ Work™ out of the box without any modification. Individual settings can be
489
+ overridden by creating a `docker-compose.override.yml` with the updated config.
490
+ For example, in order to specify a set of Github OAuth Client credentials, a
491
+ `docker-compose.override.yml` file might look like this:
492
+
493
+ ```yaml
494
+ version: "3"
495
+ services:
496
+ backend:
497
+ environment:
498
+ GH_CLIENT_ID: blahblah_ID
499
+ GH_CLIENT_SECRET: blahblah_secret
500
+ ```
501
+
502
+ #### Accessing services
503
+
504
+ By default, the services will be exposed on their normal ports:
505
+
506
+ * ` 5432 ` for Postgres
507
+ * ` 8888 ` for the crates.io backend
508
+ * ` 4200 ` for the crates.io frontend
509
+
510
+ These can be changed with the ` docker-compose.override.yml ` file.
511
+
512
+ #### Publishing crates
513
+
514
+ Unlike a local setup, the Git index is not stored in the ` ./tmp ` folder, so in
515
+ order to publish to the Dockerized crates.io, run
516
+
517
+ ```
518
+ cargo publish --index http://localhost:4200/git/index
519
+ ```
520
+
521
+ #### Changing code
522
+
523
+ The ` app/ ` directory is mounted directly into the frontend Docker container,
524
+ which means that the Ember live-reload server will still just work. If
525
+ anything outside of ` app/ ` is changed, the base Docker image will have to be
526
+ rebuilt:
527
+
528
+ ``` sh
529
+ # Rebuild frontend Docker image
530
+ docker-compose build frontend
531
+
532
+ # Restart running frontend container (if it's already running)
533
+ docker-compose stop frontend
534
+ docker-compose rm frontend
535
+ docker-compose up -d
536
+ ```
537
+
538
+ Similarly, the ` src/ ` directory is mounted into the backend Docker container,
539
+ so in order to recompile the backend, run:
540
+
541
+ ```
542
+ docker-compose restart backend
543
+ ```
544
+
545
+ If anything outside of ` src/ ` is changed, the base Docker image will have to be
546
+ rebuilt:
547
+
548
+ ``` sh
549
+ # Rebuild backend Docker image
550
+ docker-compose build backend
551
+
552
+ # Restart running backend container (if it's already running)
553
+ docker-compose stop backend
554
+ docker-compose rm backend
555
+ docker-compose up -d
556
+ ```
557
+
558
+ #### Volumes
559
+
560
+ A number of names volumes are created, as can be seen in the ` volumes ` section
561
+ of the ` docker-compose.yml ` file.
0 commit comments