From ee90baab5821ba4e926b08d47decadc02191ece4 Mon Sep 17 00:00:00 2001 From: Linus Gasser Date: Wed, 30 Aug 2023 09:48:41 +0200 Subject: [PATCH] Moving configs to their own directory --- Makefile | 26 +++++++++++++------------- backend/Dockerfile | 17 ++++++++--------- 2 files changed, 21 insertions(+), 22 deletions(-) diff --git a/Makefile b/Makefile index d7905d4..236bd4c 100644 --- a/Makefile +++ b/Makefile @@ -32,24 +32,24 @@ $Sbackend-docker-build: | $Sexternal-deps $Dbackend/build/bevmadmin: | $Dbackend/build cd $Dbackend/cothority/bevm/bevmadmin && GO111MODULE=on go build -o ../../../build/$(@F) -$Dbackend/build/ident_bevm: $Dbackend/build/bcadmin $Dbackend/build/conodes.toml $Dbackend/build/bevmadmin $Dbackend/build/ident - rm -rf $Dbackend/build/bevm_admin $Dbackend/build/bevm_user +$Dbackend/configs/ident_bevm: $Dbackend/build/bcadmin $Dbackend/configs/conodes.toml $Dbackend/build/bevmadmin $Dbackend/configs/ident + rm -rf $Dbackend/configs/bevm_admin $Dbackend/configs/bevm_user $(call $Swith-conodes, \ - bevm_admin_key=$$( $< --config $Dbackend/build/bevm_admin key ) ; \ - bevm_user_key=$$( $< --config $Dbackend/build/bevm_user key ) ; \ - bevm_user_private_key=$$( $< --config $Dbackend/build/bevm_user key --print $Dbackend/build/bevm_user/key-* | grep Private | cut -d \ -f 2 ) ; \ - bevm_darc=$$( $< --config $Dbackend/build darc add --bc $Dbackend/build/bc-* --unrestricted --identity $$bevm_admin_key --desc "BEvm Darc" | awk -F: '/BaseID:/ {print $$3}' ) ; \ - $< --config $Dbackend/build/bevm_admin link $(word 2,$^) $$( grep ByzCoinID $Dbackend/build/ident | cut -d \ -f 2 ) --darc $$bevm_darc --identity $$bevm_admin_key ; \ - $< --config $Dbackend/build/bevm_admin darc rule --bc $Dbackend/build/bevm_admin/bc-* --rule "spawn:bevm" --identity $$bevm_admin_key ; \ - $< --config $Dbackend/build/bevm_admin darc rule --bc $Dbackend/build/bevm_admin/bc-* --rule "invoke:bevm.credit" --identity $$bevm_user_key ; \ - $< --config $Dbackend/build/bevm_admin darc rule --bc $Dbackend/build/bevm_admin/bc-* --rule "invoke:bevm.transaction" --identity $$bevm_user_key ; \ - bevm_instance_id=$$($(word 3,$^) --config $Dbackend/build/bevm_admin spawn --bc $Dbackend/build/bevm_admin/bc-* | awk '{print $$NF}' ) ; \ + bevm_admin_key=$$( $< --config $Dbackend/configs/bevm_admin key ) ; \ + bevm_user_key=$$( $< --config $Dbackend/configs/bevm_user key ) ; \ + bevm_user_private_key=$$( $< --config $Dbackend/configs/bevm_user key --print $Dbackend/configs/bevm_user/key-* | grep Private | cut -d \ -f 2 ) ; \ + bevm_darc=$$( $< --config $Dbackend/configs darc add --bc $Dbackend/configs/bc-* --unrestricted --identity $$bevm_admin_key --desc "BEvm Darc" | awk -F: '/BaseID:/ {print $$3}' ) ; \ + $< --config $Dbackend/configs/bevm_admin link $(word 2,$^) $$( grep ByzCoinID $Dbackend/configs/ident | cut -d \ -f 2 ) --darc $$bevm_darc --identity $$bevm_admin_key ; \ + $< --config $Dbackend/configs/bevm_admin darc rule --bc $Dbackend/configs/bevm_admin/bc-* --rule "spawn:bevm" --identity $$bevm_admin_key ; \ + $< --config $Dbackend/configs/bevm_admin darc rule --bc $Dbackend/configs/bevm_admin/bc-* --rule "invoke:bevm.credit" --identity $$bevm_user_key ; \ + $< --config $Dbackend/configs/bevm_admin darc rule --bc $Dbackend/configs/bevm_admin/bc-* --rule "invoke:bevm.transaction" --identity $$bevm_user_key ; \ + bevm_instance_id=$$($(word 3,$^) --config $Dbackend/configs/bevm_admin spawn --bc $Dbackend/configs/bevm_admin/bc-* | awk '{print $$NF}' ) ; \ ( echo "bevm_admin_key: $${bevm_admin_key#ed25519:}" ; \ echo "bevm_user_private_key: $$bevm_user_private_key" ; \ echo "bevm_darc: $$bevm_darc" ; \ echo "bevm_instance_id: $$bevm_instance_id" ) > $@) -$Dbackend/build/config_bevm.toml: $Dbackend/build/ident_bevm +$Dbackend/configs/config_bevm.toml: $Dbackend/configs/ident_bevm awk ' \ /^bevm_user_private_key:/ {printf("bevmUserID = \"%s\"\n", $$2)} \ /^bevm_instance_id:/ {printf("bevmInstanceID = \"%s\"\n", $$2)} \ @@ -57,7 +57,7 @@ $Dbackend/build/config_bevm.toml: $Dbackend/build/ident_bevm $Swebapp-build $Swebapp-test $Swebapp-serve: $Dwebapp/src/assets/configs/bevm.toml $Dwebapp/src/assets/configs/stainless.toml -$Dwebapp/src/assets/configs/bevm.toml: $Dbackend/build/config_bevm.toml | $Dwebapp/src/assets/configs/ +$Dwebapp/src/assets/configs/bevm.toml: $Dbackend/configs/config_bevm.toml | $Dwebapp/src/assets/configs/ cp $^ $@ $Dwebapp/src/assets/configs/stainless.toml: $Dwebapp/src/assets/configs/$(toml_filename) | $Dwebapp/src/assets/configs/ diff --git a/backend/Dockerfile b/backend/Dockerfile index 6552a93..f49b2f2 100644 --- a/backend/Dockerfile +++ b/backend/Dockerfile @@ -1,10 +1,10 @@ FROM golang:1 as builder COPY build/*.go build/go.* /src/main/ -COPY *.go go.* /backend/ -COPY cothority/ /backend/cothority/ -COPY proto/ /backend/proto/ -COPY stainless/ /backend/stainless/ +COPY *.go go.* /src/ +COPY cothority/ /src/cothority/ +COPY proto/ /src/proto/ +COPY stainless/ /src/stainless/ RUN cd /src/main && go build -v -o /conode @@ -17,7 +17,6 @@ RUN apt update \ openjdk-17-jre-headless \ libgomp1 \ npm \ - iputils-ping host \ unzip \ && apt clean RUN npm install --global solc@0.5 @@ -28,9 +27,9 @@ COPY build/stainless.zip /tmp/ RUN unzip -d /usr/local/bin /tmp/stainless.zip && rm -f /tmp/stainless.zip COPY --from=builder /conode /usr/local/bin/conode -COPY build/conode-1 /configs/conode-1 -COPY build/conode-2 /configs/conode-2 -COPY build/conode-3 /configs/conode-3 -COPY build/conode-4 /configs/conode-4 +COPY configs/conode-1 /configs/conode-1 +COPY configs/conode-2 /configs/conode-2 +COPY configs/conode-3 /configs/conode-3 +COPY configs/conode-4 /configs/conode-4 ENTRYPOINT ["/usr/local/bin/conode"]