From 88f0d63f33484500411b8113c9183a2f79dcb7f2 Mon Sep 17 00:00:00 2001 From: Dennis Coyle Date: Wed, 3 Apr 2019 16:17:55 -0400 Subject: [PATCH] Adds the AMD64 and ARM Storagenode Dockerfiles and setup scripts (#1544) * add alpha dockerfile structure * adds Stefans satelitte to white list --- cmd/storagenode/alpha/amd64.Dockerfile | 42 ++++++++++++++++++++++++++ cmd/storagenode/alpha/arm.Dockerfile | 27 +++++++++++++++++ cmd/storagenode/alpha/dashboard.sh | 3 ++ cmd/storagenode/alpha/entrypoint.sh | 22 ++++++++++++++ cmd/storagenode/alpha/setup.sh | 7 +++++ 5 files changed, 101 insertions(+) create mode 100644 cmd/storagenode/alpha/amd64.Dockerfile create mode 100644 cmd/storagenode/alpha/arm.Dockerfile create mode 100755 cmd/storagenode/alpha/dashboard.sh create mode 100755 cmd/storagenode/alpha/entrypoint.sh create mode 100755 cmd/storagenode/alpha/setup.sh diff --git a/cmd/storagenode/alpha/amd64.Dockerfile b/cmd/storagenode/alpha/amd64.Dockerfile new file mode 100644 index 000000000..2d4822a9a --- /dev/null +++ b/cmd/storagenode/alpha/amd64.Dockerfile @@ -0,0 +1,42 @@ +# build +FROM golang:1.11-alpine as build-env + +ENV CGO_ENABLED=1 + +ADD . /go/src/storj.io/storj +WORKDIR /go/src/storj.io/storj/cmd/storagenode + +# dependencies + binary +RUN apk add git gcc musl-dev +#RUN unset GOPATH && go mod vendor +RUN go build -a -installsuffix cgo -o storagenode . +RUN mkdir config identity + +# final stage +FROM alpine + +EXPOSE 28967 + +ENV STORJ_KADEMLIA_BOOTSTRAP_ADDR="bootstrap.storj.io:8888" +ENV STORJ_METRICS_APP_SUFFIX="-alpha" +ENV STORJ_METRICS_INTERVAL="30m" +ENV STORJ_SERVER_USE_PEER_CA_WHITELIST="true" + +ENV ADDRESS="" +ENV EMAIL="" +ENV WALLET="" +ENV BANDWIDTH="2.0TB" +ENV STORAGE="2.0TB" + + +WORKDIR /app +COPY --from=build-env /go/src/storj.io/storj/cmd/storagenode/storagenode /app/ +COPY --from=build-env /go/src/storj.io/storj/cmd/storagenode/config /app/ +COPY --from=build-env /go/src/storj.io/storj/cmd/storagenode/identity /app/ +COPY --from=build-env /go/src/storj.io/storj/cmd/storagenode/alpha/entrypoint.sh /app/ +COPY --from=build-env /go/src/storj.io/storj/cmd/storagenode/alpha/dashboard.sh /app/ + +RUN ls -l /app + +ENTRYPOINT ["./entrypoint.sh"] +#ENTRYPOINT ./storagenode run --config-dir="/app/config" --identity-dir="/app/identity" --kademlia.external-address=${ADDRESS} --kademlia.operator.email=${EMAIL} --kademlia.operator.wallet=${WALLET} \ No newline at end of file diff --git a/cmd/storagenode/alpha/arm.Dockerfile b/cmd/storagenode/alpha/arm.Dockerfile new file mode 100644 index 000000000..019faa930 --- /dev/null +++ b/cmd/storagenode/alpha/arm.Dockerfile @@ -0,0 +1,27 @@ +# build +FROM golang:1.11-alpine as build-env + +ADD . /go/src/storj.io/storj + +WORKDIR /go/src/storj.io/storj/cmd/storagenode + +RUN mkdir config + +# final stage +FROM alpine + +EXPOSE 28967 + +ENV STORJ_KADEMLIA_BOOTSTRAP_ADDR="bootstrap.storj.io:8888" +ENV STORJ_METRICS_APP_SUFFIX="-alpha" +ENV STORJ_METRICS_INTERVAL="30m" +ENV STORJ_SERVER_USE_PEER_CA_WHITELIST="true" +ENV COMMAND="run" + +WORKDIR /app + + +COPY --from=build-env /go/src/storj.io/storj/storagenode_linux_arm /app +COPY --from=build-env /go/src/storj.io/storj/cmd/storagenode/config /app/ + +ENTRYPOINT ./storagenode $COMMAND --config-dir="config" \ No newline at end of file diff --git a/cmd/storagenode/alpha/dashboard.sh b/cmd/storagenode/alpha/dashboard.sh new file mode 100755 index 000000000..683eef12b --- /dev/null +++ b/cmd/storagenode/alpha/dashboard.sh @@ -0,0 +1,3 @@ +#!/bin/sh + +./storagenode dashboard --config-dir /app/config --identity-dir /app/identity $@ \ No newline at end of file diff --git a/cmd/storagenode/alpha/entrypoint.sh b/cmd/storagenode/alpha/entrypoint.sh new file mode 100755 index 000000000..dbd6384ee --- /dev/null +++ b/cmd/storagenode/alpha/entrypoint.sh @@ -0,0 +1,22 @@ +#!/bin/sh +set -euo pipefail + +if [[ ! -f "config/config.yaml" ]]; then + ./storagenode setup --config-dir config --identity-dir identity +fi + +RUN_PARAMS="${RUN_PARAMS:-} --config-dir config" +RUN_PARAMS="${RUN_PARAMS:-} --identity-dir identity" + +RUN_PARAMS="${RUN_PARAMS:-} --kademlia.bootstrap-addr=bootstrap.storj.io:8888" +RUN_PARAMS="${RUN_PARAMS:-} --metrics.app-suffix=-alpha" +RUN_PARAMS="${RUN_PARAMS:-} --metrics.interval=30m" +RUN_PARAMS="${RUN_PARAMS:-} --server.use-peer-ca-whitelist=true" +RUN_PARAMS="${RUN_PARAMS:-} --kademlia.external-address=${ADDRESS}" +RUN_PARAMS="${RUN_PARAMS:-} --kademlia.operator.email=${EMAIL}" +RUN_PARAMS="${RUN_PARAMS:-} --kademlia.operator.wallet=${WALLET}" +RUN_PARAMS="${RUN_PARAMS:-} --storage.allocated-bandwidth=${BANDWIDTH}" +RUN_PARAMS="${RUN_PARAMS:-} --storage.allocated-disk-space=${STORAGE}" +RUN_PARAMS="${RUN_PARAMS:-} --storage.whitelisted-satellite-i-ds=12EayRS2V1kEsWESU9QMRseFhdxYxKicsiFmxrsLZHeLUtdps3S,1Vrf9xmmHw6KaVFMcfR2YPt8YpVVoQZGTUJyjYc6CajeYrAqrB,118UWpMCHzs6CvSgWd9BfFVjw5K9pZbJjkfZJexMtSkmKxvvAW" + +exec ./storagenode run $RUN_PARAMS "$@" diff --git a/cmd/storagenode/alpha/setup.sh b/cmd/storagenode/alpha/setup.sh new file mode 100755 index 000000000..7ecfa65d7 --- /dev/null +++ b/cmd/storagenode/alpha/setup.sh @@ -0,0 +1,7 @@ +#!/bin/sh + +set -euo pipefail + +if [[ ! -f "config/config.yaml" ]]; then + ./storagenode setup --config-dir config --identity-dir /app/identity +fi \ No newline at end of file