Skip to content

Commit 92b9aff

Browse files
committed
examples
1 parent d3948c4 commit 92b9aff

File tree

4 files changed

+42
-33
lines changed

4 files changed

+42
-33
lines changed

.docker.env.sample

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# environment overrides for the app instances running inside docker compose
2+
DOCSRS_LOG=docs_rs=debug,rustwide=info
3+
DOCSRS_INCLUDE_DEFAULT_TARGETS=false
4+
DOCSRS_DOCKER_IMAGE=ghcr.io/rust-lang/crates-build-env/linux-micro
5+
# To build with a PR that hasn't landed in a rust dist toolchain yet,
6+
# you can set this to the git sha of a try build:
7+
# https://forge.rust-lang.org/infra/docs/rustc-ci.html#try-builds
8+
DOCSRS_TOOLCHAIN=nightly

.env.sample

Lines changed: 19 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,25 @@
1-
export DOCSRS_PREFIX=ignored/cratesfyi-prefix
2-
export DOCSRS_DATABASE_URL=postgresql://cratesfyi:password@localhost:15432
1+
# environment overrides for local development outside docker.
2+
DOCSRS_PREFIX=ignored/cratesfyi-prefix
3+
DOCSRS_DATABASE_URL=postgresql://cratesfyi:password@localhost:15432
34

45
# for local development with sqlx
5-
export DATABASE_URL=postgresql://cratesfyi:password@localhost:15432
6+
DATABASE_URL=postgresql://cratesfyi:password@localhost:15432
67

7-
export DOCSRS_LOG=docs_rs=debug,rustwide=info
8+
DOCSRS_LOG=docs_rs=debug,rustwide=info
9+
AWS_ACCESS_KEY_ID=cratesfyi
10+
AWS_SECRET_ACCESS_KEY=secret_key
11+
S3_ENDPOINT=http://localhost:9000
12+
DOCSRS_S3_STATIC_ROOT_PATH=http://localhost:9000/rust-docs-rs
13+
14+
15+
# build specific
16+
DOCSRS_INCLUDE_DEFAULT_TARGETS=false
17+
DOCSRS_DOCKER_IMAGE=ghcr.io/rust-lang/crates-build-env/linux-micro
18+
SENTRY_ENVIRONMENT=dev
819
# To build with a PR that hasn't landed in a rust dist toolchain yet,
920
# you can set this to the git sha of a try build:
1021
# https://forge.rust-lang.org/infra/docs/rustc-ci.html#try-builds
11-
export DOCSRS_TOOLCHAIN=nightly
12-
export AWS_ACCESS_KEY_ID=cratesfyi
13-
export AWS_SECRET_ACCESS_KEY=secret_key
14-
export S3_ENDPOINT=http://localhost:9000
15-
export DOCSRS_S3_STATIC_ROOT_PATH=http://localhost:9000/rust-docs-rs
16-
export DOCSRS_INCLUDE_DEFAULT_TARGETS=false
17-
export DOCSRS_DOCKER_IMAGE=ghcr.io/rust-lang/crates-build-env/linux-micro
18-
export SENTRY_ENVIRONMENT=dev
22+
DOCSRS_TOOLCHAIN=nightly
23+
24+
# NOTE: when running services in docker-compose, you can override the settings in
25+
# `.docker.env`, you'll fine an example in `.docker.env.sample`.

Justfile

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,10 @@ set ignore-comments
33
set dotenv-load := true
44
set dotenv-override := true
55

6-
# some environment variables that are needed for _local_ commands
7-
# these are defaults that can be overwritten in your local .env file
8-
export DOCSRS_INCLUDE_DEFAULT_TARGETS := env("DOCSRS_INCLUDE_DEFAULT_TARGETS", "false")
9-
export DOCSRS_LOG := env("DOCSRS_LOG", "docs_rs=debug,rustwide=info")
10-
export RUST_BACKTRACE := env("RUST_BACKTRACE", "1")
6+
# minimal settings to run justfile recipes that don't just run docker, like `run-tests`.
7+
# Typically you will want to create your own `.env` file based on `.env.sample` for
8+
# easier local development.
119
export DOCSRS_PREFIX := env("DOCSRS_PREFIX", "ignored/cratesfyi-prefix")
12-
13-
# database & s3 settings for local testing, to connect to the DB & S3/minio instance
14-
# configured in docker-compose.yml
1510
export DOCSRS_DATABASE_URL := env("DOCSRS_DATABASE_URL", "postgresql://cratesfyi:password@localhost:15432")
1611
export AWS_ACCESS_KEY_ID := env("AWS_ACCESS_KEY_ID", "cratesfyi")
1712
export AWS_SECRET_ACCESS_KEY := env("AWS_SECRET_ACCESS_KEY", "secret_key")
@@ -20,7 +15,7 @@ export S3_ENDPOINT := env("S3_ENDPOINT", "http://localhost:9000")
2015

2116
# List available commands
2217
_default:
23-
just --list
18+
@just --list
2419

2520
import 'justfiles/cli.just'
2621
import 'justfiles/utils.just'

docker-compose.yml

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -69,33 +69,32 @@ x-healthcheck: &healthcheck-interval
6969
start_period: 10s
7070

7171
x-environment: &environment
72-
# FIXME: change to FOO: ${FOO:-default123 where these vars are just a
73-
# default that should be possible to override
74-
RUST_BACKTRACE: true
75-
DOCSRS_LOG: docs_rs=trace,tower_http=debug,rustwide=info,aws_smithy_http=trace,axum=debug
72+
# default environment that can be overwritten in `.docker.env
73+
RUST_BACKTRACE: ${RUST_BACKTRACE:-true}
74+
DOCSRS_LOG: ${DOCSRS_LOG:-docs_rs=trace,tower_http=debug,rustwide=info,aws_smithy_http=trace,axum=debug}
7675

76+
# fixed environment to connect the different services in this file properly
7777
DOCSRS_PREFIX: /opt/docsrs/prefix
78-
7978
DOCSRS_DATABASE_URL: postgresql://cratesfyi:password@db
8079
DOCSRS_MIN_POOL_IDLE: 1
8180
DOCSRS_MIN_POOL_SIZE: 2
8281
DOCSRS_MAX_POOL_SIZE: 10
83-
DOCSRS_MAX_LEGACY_POOL_SIZE: 10
84-
8582
DOCSRS_STORAGE_BACKEND: s3
86-
8783
S3_ENDPOINT: http://s3:9000
8884
AWS_ACCESS_KEY_ID: cratesfyi
8985
AWS_SECRET_ACCESS_KEY: secret_key
9086

9187
x-builder-environment: &builder-environment
9288
<<: *environment
89+
# default builder environment that can be overwritten in `.docker.env
90+
DOCSRS_INCLUDE_DEFAULT_TARGETS: ${DOCSRS_INCLUDE_DEFAULT_TARGETS:-false}
91+
DOCSRS_DOCKER_IMAGE: ${DOCSRS_DOCKER_IMAGE:-ghcr.io/rust-lang/crates-build-env/linux-micro}
92+
93+
# fixed environment to connect the different services in this file properly
9394
DOCSRS_RUSTWIDE_WORKSPACE: /opt/docsrs/rustwide
9495
DOCSRS_COMPILER_METRICS_PATH: /opt/docsrs/prefix/metrics
9596
DOCSRS_DOCKER: true
96-
DOCSRS_DOCKER_IMAGE: ghcr.io/rust-lang/crates-build-env/linux-micro
9797
DOCSRS_BUILD_CPU_LIMIT: 2
98-
DOCSRS_INCLUDE_DEFAULT_TARGETS: false
9998

10099
x-build: &build
101100
context: .
@@ -143,8 +142,7 @@ x-registry-watcher: &registry-watcher
143142
# Also on a native docker volume for performance
144143
REGISTRY_INDEX_PATH: /opt/docsrs/crates.io-index
145144
# configure the rebuild-queuer
146-
DOCSRS_MAX_QUEUED_REBUILDS: 10
147-
145+
DOCSRS_MAX_QUEUED_REBUILDS: ${DOCSRS_MAX_QUEUED_REBUILDS:-10}
148146
env_file:
149147
- .docker.env
150148
healthcheck:
@@ -164,6 +162,7 @@ services:
164162
environment:
165163
<<: *environment
166164
DOCSRS_RENDER_THREADS: 2
165+
DOCSRS_S3_STATIC_ROOT_PATH: http://localhost:9000/rust-docs-rs
167166
env_file:
168167
- .docker.env
169168
healthcheck:

0 commit comments

Comments
 (0)