Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ x-environment: &environment
DOCSRS_MIN_POOL_SIZE: 2
DOCSRS_MAX_POOL_SIZE: 10
DOCSRS_STORAGE_BACKEND: s3
DOCSRS_S3_BUCKET: ${DOCSRS_S3_BUCKET:-rust-docs-rs}
S3_ENDPOINT: http://s3:9000
AWS_ACCESS_KEY_ID: cratesfyi
AWS_SECRET_ACCESS_KEY: secret_key
Expand Down Expand Up @@ -279,13 +280,13 @@ services:
AWS_SECRET_ACCESS_KEY: secret_key
AWS_DEFAULT_REGION: us-east-1
AWS_EC2_METADATA_DISABLED: true
S3_BUCKET: ${DOCSRS_S3_BUCKET:-rust-docs-rs}
DOCSRS_S3_BUCKET: ${DOCSRS_S3_BUCKET:-rust-docs-rs}
entrypoint: /bin/sh
command:
- -c
- >-
aws --endpoint-url http://s3:9000 s3api head-bucket --bucket "$$S3_BUCKET"
|| aws --endpoint-url http://s3:9000 s3api create-bucket --bucket "$$S3_BUCKET"
aws --endpoint-url http://s3:9000 s3api head-bucket --bucket "$$DOCSRS_S3_BUCKET"
|| aws --endpoint-url http://s3:9000 s3api create-bucket --bucket "$$DOCSRS_S3_BUCKET"
profiles:
- manual

Expand Down
14 changes: 7 additions & 7 deletions justfiles/services.just
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@ compose-up-resources: _touch-docker-env
# Keep the persistent resources as the default Compose services. The
# bucket provisioner is a one-shot command, which `--wait` would otherwise
# treat as a failed (exited) service.
docker compose up --detach --wait --remove-orphans db s3
docker compose run --rm --no-deps s3-init
docker compose --env-file .docker.env up --detach --wait --remove-orphans db s3
docker compose --env-file .docker.env run --rm --no-deps s3-init

# Apply migrations, then start the requested Compose profiles.
[group('compose')]
compose-up *profiles: _touch-docker-env _ensure_db_migrated
docker compose {{ prepend("--profile ", profiles) }} up --build -d --wait --remove-orphans
docker compose --env-file .docker.env {{ prepend("--profile ", profiles) }} up --build -d --wait --remove-orphans

# Start the web-server Compose profile.
[group('compose')]
Expand All @@ -36,15 +36,15 @@ compose-up-full: (compose-up "full")
# Stop Compose services while retaining local images and volumes.
[group('compose')]
compose-down:
docker compose --profile full --profile manual down --remove-orphans
docker compose --env-file .docker.env --profile full --profile manual down --remove-orphans

# Remove Compose services, images, volumes, and generated local artifacts.
[group('compose')]
compose-down-and-wipe:
#!/usr/bin/env bash
set -euo pipefail

docker compose --profile full --profile manual down --volumes --remove-orphans --rmi local
docker compose --env-file .docker.env --profile full --profile manual down --volumes --remove-orphans --rmi local

# When testing this in CI, I had permission issues when trying to remove this folder.
# Likely it's related to the docker container runnning as a different (root?) user, so
Expand All @@ -64,12 +64,12 @@ compose-down-and-wipe:
# Follow logs from all Compose services or the specified services.
[group('compose')]
compose-logs *services:
docker compose --profile full logs -f {{ services }}
docker compose --env-file .docker.env --profile full logs -f {{ services }}

# Run a command in a one-off Compose service container.
[group('cli')]
[group('compose')]
docker-run service_name *args: compose-up-resources
# `docker compose run` ignores service dependencies, so the recipe starts
# the database and object storage explicitly before reaching this point.
docker compose run --build --rm {{ service_name }} {{ args }}
docker compose --env-file .docker.env run --build --rm {{ service_name }} {{ args }}
Loading