From 08ebce3997970f6204bd6b7e986a72af2fa04ec9 Mon Sep 17 00:00:00 2001 From: renancloudwalk <53792026+renancloudwalk@users.noreply.github.com> Date: Wed, 22 May 2024 18:53:01 -0300 Subject: [PATCH] chore: add probes and config to chaos environment (#903) --- .dockerignore | 1 + chaos/local-deployment.yaml | 27 +++++++++++++++++++++++++-- chaos/local-service.yaml | 14 ++++++++------ config/run-with-importer.env.local | 7 +++++++ docker/Dockerfile.run_with_importer | 2 ++ 5 files changed, 43 insertions(+), 8 deletions(-) diff --git a/.dockerignore b/.dockerignore index 710f62536..009d53ecd 100644 --- a/.dockerignore +++ b/.dockerignore @@ -6,6 +6,7 @@ !docker/Dockerfile.run_with_importer !src/ !.cargo/ +!config/ !Cargo.toml !Cargo.lock !static/ diff --git a/chaos/local-deployment.yaml b/chaos/local-deployment.yaml index 6b5d78527..f0b4e0a23 100644 --- a/chaos/local-deployment.yaml +++ b/chaos/local-deployment.yaml @@ -18,6 +18,7 @@ spec: containers: - name: stratus-api image: local/run_with_importer:latest + imagePullPolicy: IfNotPresent ports: - containerPort: 3000 name: http @@ -57,9 +58,31 @@ spec: fieldRef: fieldPath: spec.serviceAccountName - name: ENVIRONMENT - value: staging + value: local - name: ENV - value: staging + value: local + livenessProbe: + httpGet: + path: /liveness + port: 3000 + initialDelaySeconds: 15 + periodSeconds: 10 + timeoutSeconds: 5 + readinessProbe: + httpGet: + path: /readiness + port: 3000 + initialDelaySeconds: 5 + periodSeconds: 5 + timeoutSeconds: 5 + startupProbe: + httpGet: + path: /startup + port: 3000 + initialDelaySeconds: 10 + periodSeconds: 5 + failureThreshold: 60 + timeoutSeconds: 5 volumeMounts: - mountPath: /app/data name: rocksdata diff --git a/chaos/local-service.yaml b/chaos/local-service.yaml index 6a96b6c6d..7e71a9d54 100644 --- a/chaos/local-service.yaml +++ b/chaos/local-service.yaml @@ -6,9 +6,11 @@ spec: selector: app: stratus-api ports: - - protocol: TCP - port: 3000 - targetPort: 3000 - - protocol: TCP - port: 9000 - targetPort: 9000 + - name: http + protocol: TCP + port: 80 + targetPort: 8080 + - name: https + protocol: TCP + port: 443 + targetPort: 8443 diff --git a/config/run-with-importer.env.local b/config/run-with-importer.env.local index 5d0d12aa1..1967c7655 100644 --- a/config/run-with-importer.env.local +++ b/config/run-with-importer.env.local @@ -9,3 +9,10 @@ PERM_STORAGE_CONNECTIONS=2 PERM_STORAGE_TIMEOUT=1000 TEMP_STORAGE=inmemory + +RUST_LOG=debug +RUST_BACKTRACE=1, +LEADER_NODE=stratus-api-0 +SYNC_INTERVAL=10ms +FORWARD_TO=http://spec.testnet.cloudwalk.network:9934 +JSON_LOGS=1 diff --git a/docker/Dockerfile.run_with_importer b/docker/Dockerfile.run_with_importer index fd148e067..b36e16a93 100644 --- a/docker/Dockerfile.run_with_importer +++ b/docker/Dockerfile.run_with_importer @@ -9,6 +9,7 @@ COPY build.rs /app/build.rs COPY Cargo.toml /app/Cargo.toml COPY Cargo.lock /app/Cargo.lock COPY .cargo .cargo +COPY config /app/config RUN apt update RUN apt-get install -y libclang-dev cmake @@ -22,5 +23,6 @@ RUN cargo build --release --bin run-with-importer --features metrics,rocks FROM rust:1.75 as runtime WORKDIR /app COPY --from=builder /app/target/release/run-with-importer /app/run-with-importer +COPY --from=builder /app/config/* /app/config/ CMD ["sh", "-c", "/app/run-with-importer"]