From dacaae50081a79caf822d8bd45a2c0a00b3bed80 Mon Sep 17 00:00:00 2001 From: Thomas Manson Date: Fri, 7 Jun 2024 15:31:59 +1000 Subject: [PATCH] Adding logging --- scripts/aws/Dockerfile | 2 +- scripts/aws/entrypoint.sh | 2 +- scripts/aws/start.sh | 15 ++++++++++++++- 3 files changed, 16 insertions(+), 3 deletions(-) diff --git a/scripts/aws/Dockerfile b/scripts/aws/Dockerfile index 858885b4a..9d1133865 100644 --- a/scripts/aws/Dockerfile +++ b/scripts/aws/Dockerfile @@ -29,7 +29,7 @@ RUN apt update -y \ && apt-get install /app/dep/syslog-ng-core_4.6.0-1_amd64.deb \ && rm -rf /var/lib/apt/lists/* \ && apt-key del 6694369F -RUN pip3 install boto3==1.16.9 +RUN pip3 install boto3 COPY ./target/${JAR_NAME}-${JAR_VERSION}-jar-with-dependencies.jar /app/${JAR_NAME}-${JAR_VERSION}.jar COPY ./static /app/static diff --git a/scripts/aws/entrypoint.sh b/scripts/aws/entrypoint.sh index 73f5debae..7916dd8b8 100644 --- a/scripts/aws/entrypoint.sh +++ b/scripts/aws/entrypoint.sh @@ -9,7 +9,7 @@ ifconfig lo 127.0.0.1 # -- start vsock proxy echo "Starting vsock proxy..." -/app/vsockpx --config /app/proxies.nitro.yaml --daemon --workers $(( $(nproc) * 2 )) --log-level 3 +/app/vsockpx --config /app/proxies.nitro.yaml --daemon --workers $(( $(nproc) * 2 )) --log-level 0 # -- setup syslog-ng echo "Starting syslog-ng..." diff --git a/scripts/aws/start.sh b/scripts/aws/start.sh index 705acb80b..03ae8fee9 100644 --- a/scripts/aws/start.sh +++ b/scripts/aws/start.sh @@ -70,6 +70,10 @@ function update_allocation() { } function setup_vsockproxy() { + if [[ "$1" == "debug" ]]; then + VSOCK_LOG_LEVEL=0 + fi + VSOCK_PROXY=${VSOCK_PROXY:-/usr/bin/vsockpx} VSOCK_CONFIG=${VSOCK_CONFIG:-/etc/uid2operator/proxy.yaml} VSOCK_THREADS=${VSOCK_THREADS:-$(( $(nproc) * 2 )) } @@ -99,6 +103,11 @@ function run_enclave() { nitro-cli run-enclave --eif-path $EIF_PATH --memory $MEMORY_MB --cpu-count $CPU_COUNT --enclave-cid $CID --enclave-name uid2operator } +function run_enclave_debug() { + echo "starting enclave..." + nitro-cli run-enclave --eif-path $EIF_PATH --memory $MEMORY_MB --cpu-count $CPU_COUNT --enclave-cid $CID --enclave-name uid2operator --debug-mode --attach-console +} + terminate_old_enclave config_aws read_allocation @@ -106,6 +115,10 @@ read_allocation setup_vsockproxy setup_aws_proxy setup_dante -run_enclave +if [[ "$1" == "debug" ]]; then + run_enclave_debug +else + run_enclave +fi echo "Done!"