From 71295a5ec0a6761a5ad45a9f1e5d9b75ca25bf0e Mon Sep 17 00:00:00 2001 From: 0xZensh Date: Thu, 18 Jul 2024 23:01:32 +0800 Subject: [PATCH] fix: try to fix marlin enclave image building --- Cargo.lock | 6 +++--- Cargo.toml | 2 +- README.md | 4 ++-- enclave/.env | 8 ++++++++ enclave/amd64.Dockerfile | 3 ++- enclave/arm64.Dockerfile | 5 +++-- enclave/setup.sh | 2 +- enclave/supervisord.conf | 10 +++++++++- 8 files changed, 29 insertions(+), 11 deletions(-) create mode 100644 enclave/.env diff --git a/Cargo.lock b/Cargo.lock index d78d56c..0bea307 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1014,7 +1014,7 @@ dependencies = [ [[package]] name = "idempotent-proxy-canister" -version = "1.1.2" +version = "1.1.3" dependencies = [ "base64", "bytes", @@ -1033,7 +1033,7 @@ dependencies = [ [[package]] name = "idempotent-proxy-server" -version = "1.1.2" +version = "1.1.3" dependencies = [ "anyhow", "async-trait", @@ -1062,7 +1062,7 @@ dependencies = [ [[package]] name = "idempotent-proxy-types" -version = "1.1.2" +version = "1.1.3" dependencies = [ "base64", "ciborium", diff --git a/Cargo.toml b/Cargo.toml index 5111fae..0ac928f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -15,7 +15,7 @@ strip = true opt-level = 's' [workspace.package] -version = "1.1.2" +version = "1.1.3" edition = "2021" repository = "https://github.com/ldclabs/idempotent-proxy" keywords = ["idempotent", "reverse", "proxy", "icp"] diff --git a/README.md b/README.md index e884438..c43f456 100644 --- a/README.md +++ b/README.md @@ -80,8 +80,8 @@ In a new terminal, run cd /mnt/my-server sudo docker exec -it nitro-cli sh # or docker pull enclave image -docker build -f enclave/arm64.Dockerfile -t enclave_arm64:latest . -nitro-cli build-enclave --docker-uri enclave_arm64:latest --output-file enclave_arm64.eif +docker build -f enclave/amd64.Dockerfile -t enclave_amd64:latest . +nitro-cli build-enclave --docker-uri enclave_amd64:latest --output-file enclave_amd64.eif ``` ### Running as Cloudflare Worker diff --git a/enclave/.env b/enclave/.env new file mode 100644 index 0000000..a5d854b --- /dev/null +++ b/enclave/.env @@ -0,0 +1,8 @@ +SERVER_ADDR=127.0.0.1:8088 +POLL_INTERVAL=100 # in milliseconds +REQUEST_TIMEOUT=20000 # in milliseconds +LOG_LEVEL=warn # debug, info, warn, error +# cert file path to enable https, for example: /etc/https/mydomain.crt +TLS_CERT_FILE = "" +# key file path to enable https, for example: /etc/https/mydomain.key +TLS_KEY_FILE = "" diff --git a/enclave/amd64.Dockerfile b/enclave/amd64.Dockerfile index 9a26c8b..a32ae15 100644 --- a/enclave/amd64.Dockerfile +++ b/enclave/amd64.Dockerfile @@ -53,7 +53,8 @@ COPY enclave/setup.sh ./ RUN chmod +x setup.sh # your custom setup goes here -COPY --from=builder /src/.env ./.env +# COPY enclave/.env ./.env +COPY enclave/.env ../.env COPY --from=builder /src/target/release/idempotent-proxy-server ./idempotent-proxy-server # entry point diff --git a/enclave/arm64.Dockerfile b/enclave/arm64.Dockerfile index 75fd019..04784ff 100644 --- a/enclave/arm64.Dockerfile +++ b/enclave/arm64.Dockerfile @@ -53,8 +53,9 @@ COPY enclave/setup.sh ./ RUN chmod +x setup.sh # your custom setup goes here -COPY --from=builder /src/.env ./.env +# COPY enclave/.env ./.env +COPY enclave/.env ../.env COPY --from=builder /src/target/release/idempotent-proxy-server ./idempotent-proxy-server # entry point -ENTRYPOINT [ "/app/setup.sh" ] \ No newline at end of file +ENTRYPOINT [ "./idempotent-proxy-server" ] \ No newline at end of file diff --git a/enclave/setup.sh b/enclave/setup.sh index 108047c..f9ce70e 100644 --- a/enclave/setup.sh +++ b/enclave/setup.sh @@ -20,4 +20,4 @@ iptables -L -t nat # starting supervisord cat /etc/supervisord.conf -/app/supervisord \ No newline at end of file +/app/supervisord diff --git a/enclave/supervisord.conf b/enclave/supervisord.conf index 7e87990..d4af939 100644 --- a/enclave/supervisord.conf +++ b/enclave/supervisord.conf @@ -39,6 +39,14 @@ stdout_logfile_maxbytes=0 stderr_logfile=/dev/stdout stderr_logfile_maxbytes=0 +[program:idempotent-proxy-server-proxy] +command=/app/vsock-to-ip --vsock-addr 88:1200 --ip-addr 127.0.0.1:8088 +autorestart=true +stdout_logfile=/dev/stdout +stdout_logfile_maxbytes=0 +stderr_logfile=/dev/stdout +stderr_logfile_maxbytes=0 + # your custom programs go here [program:idempotent-proxy-server] command=/app/idempotent-proxy-server @@ -46,4 +54,4 @@ autorestart=true stdout_logfile=/dev/stdout stdout_logfile_maxbytes=0 stderr_logfile=/dev/stdout -stderr_logfile_maxbytes=0 \ No newline at end of file +stderr_logfile_maxbytes=0