Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

resource-recorder: update the docker compose file #1092

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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion Containerfile
Expand Up @@ -13,7 +13,7 @@ FROM shuttle-build as cache
ARG CARGO_PROFILE
WORKDIR /src
COPY . .
RUN find ${SRC_CRATES} \( -name "*.proto" -or -name "*.rs" -or -name "*.toml" -or -name "Cargo.lock" -or -name "README.md" -or -name "*.sql" \) -type f -exec install -D \{\} /build/\{\} \;
RUN find ${SRC_CRATES} \( -name "*.proto" -or -name "*.rs" -or -name "*.toml" -or -name "Cargo.lock" -or -name "README.md" -or -name "*.sql" -or -name "ulid0.so" \) -type f -exec install -D \{\} /build/\{\} \;
# This is used to carry over in the docker images any *.pem files from shuttle root directory,
# to be used for TLS testing, as described here in the admin README.md.
RUN if [ "$CARGO_PROFILE" != "release" ]; then \
Expand Down
4 changes: 3 additions & 1 deletion Makefile
Expand Up @@ -28,6 +28,7 @@ TAG?=$(shell git describe --tags --abbrev=0)
BACKEND_TAG?=$(TAG)
DEPLOYER_TAG?=$(TAG)
PROVISIONER_TAG?=$(TAG)
RESOURCE_RECORDER_TAG?=$(TAG)

DOCKER_BUILD?=docker buildx build

Expand Down Expand Up @@ -85,6 +86,7 @@ DOCKER_COMPOSE_ENV=\
BACKEND_TAG=$(BACKEND_TAG)\
DEPLOYER_TAG=$(DEPLOYER_TAG)\
PROVISIONER_TAG=$(PROVISIONER_TAG)\
RESOURCE_RECORDER_TAG=$(RESOURCE_RECORDER_TAG)\
POSTGRES_TAG=${POSTGRES_TAG}\
PANAMAX_TAG=${PANAMAX_TAG}\
OTEL_TAG=${OTEL_TAG}\
Expand All @@ -106,7 +108,7 @@ clean:
rm .shuttle-*
rm docker-compose.rendered.yml

images: shuttle-provisioner shuttle-deployer shuttle-gateway shuttle-auth postgres panamax otel
images: shuttle-provisioner shuttle-deployer shuttle-gateway shuttle-auth shuttle-resource-recorder postgres panamax otel

postgres:
$(DOCKER_BUILD) \
Expand Down
4 changes: 2 additions & 2 deletions cargo-shuttle/src/args.rs
Expand Up @@ -325,7 +325,7 @@ impl InitTemplateArg {
Tide => "tide/hello-world",
Tower => "tower/hello-world",
Warp => "warp/hello-world",
None => "custom/none",
None => "custom-service/none",
iulianbarbu marked this conversation as resolved.
Show resolved Hide resolved
};

TemplateLocation {
Expand Down Expand Up @@ -408,7 +408,7 @@ mod tests {
init_args.git_template().unwrap(),
Some(TemplateLocation {
auto_path: EXAMPLES_REPO.into(),
subfolder: Some("custom/none".into())
subfolder: Some("custom-service/none".into())
})
);

Expand Down
30 changes: 30 additions & 0 deletions docker-compose.yml
Expand Up @@ -5,6 +5,7 @@ volumes:
postgres-vol:
panamax-crates-vol:
panamax-io-index-vol:
resource-recorder-vol:
networks:
user-net:
attachable: true
Expand Down Expand Up @@ -129,6 +130,35 @@ services:
- "--internal-pg-address=postgres"
- "--fqdn=${DB_FQDN}"
- "--auth-uri=http://auth:8000"
resource-recorder:
image: "${CONTAINER_REGISTRY}/resource-recorder:${RESOURCE_RECORDER_TAG}"
depends_on:
- auth
environment:
- RUST_LOG=${RUST_LOG}
networks:
user-net:
volumes:
- resource-recorder-vol:/var/lib/shuttle
deploy:
restart_policy:
condition: on-failure
delay: 5s
max_attempts: 3
update_config:
order: start-first
failure_action: rollback
delay: 10s
rollback_config:
parallelism: 0
order: stop-first
placement:
constraints:
- node.hostname==controller
command:
- "--address=0.0.0.0:8000"
- "--state=/var/lib/shuttle"
- "--auth-uri=http://auth:8000"
postgres:
image: "${CONTAINER_REGISTRY}/postgres:${POSTGRES_TAG}"
restart: always
Expand Down
13 changes: 13 additions & 0 deletions resource-recorder/prepare.sh
@@ -0,0 +1,13 @@
#!/bin/bash

###############################################################################
# This file is used by our common Containerfile incase the container for this #
# service might need some extra preparation steps for its final image #
###############################################################################

# Stuff that depends on local source files
if [ "$1" = "--after-src" ]; then
exit 0
fi

# Nothing to prepare in container image here
3 changes: 2 additions & 1 deletion resource-recorder/src/main.rs
Expand Up @@ -25,7 +25,8 @@ async fn main() {
)))
.layer(ExtractPropagationLayer);

let svc = Service::new(Sqlite::new(&args.state.display().to_string()).await);
let db_path = args.state.join("resource-recorder.sqlite");
let svc = Service::new(Sqlite::new(db_path.display().to_string().as_str()).await);
let svc = ResourceRecorderServer::new(svc);
let router = server_builder.add_service(svc);

Expand Down