diff --git a/Dockerfile.lotus b/Dockerfile.lotus index acb54e6ea..72c609305 100644 --- a/Dockerfile.lotus +++ b/Dockerfile.lotus @@ -36,7 +36,7 @@ WORKDIR /opt/filecoin ARG RUSTFLAGS="" ARG GOFLAGS="" -RUN make lotus lotus-miner lotus-worker lotus-shed lotus-chainwatch lotus-stats lotus-wallet lotus-gateway +RUN make lotus lotus-miner lotus-worker lotus-shed lotus-wallet lotus-gateway FROM ubuntu:20.04 AS base @@ -61,6 +61,7 @@ FROM base AS lotus MAINTAINER Lotus Development Team COPY --from=builder /opt/filecoin/lotus /usr/local/bin/ +COPY --from=builder /opt/filecoin/lotus-shed /usr/local/bin/ COPY scripts/docker-lotus-entrypoint.sh / ENV FILECOIN_PARAMETER_CACHE /var/tmp/filecoin-proof-parameters @@ -68,7 +69,7 @@ ENV LOTUS_PATH /var/lib/lotus ENV LOTUS_JAEGER_AGENT_HOST 127.0.0.1 ENV LOTUS_JAEGER_AGENT_PORT 6831 ENV DOCKER_LOTUS_IMPORT_SNAPSHOT https://fil-chain-snapshots-fallback.s3.amazonaws.com/mainnet/minimal_finality_stateroots_latest.car -ENV DOCKER_LOTUS_WALLET_IMPORT "" +ENV DOCKER_LOTUS_IMPORT_WALLET "" RUN mkdir /var/lib/lotus /var/tmp/filecoin-proof-parameters RUN chown fc: /var/lib/lotus /var/tmp/filecoin-proof-parameters @@ -84,19 +85,6 @@ ENTRYPOINT ["/docker-lotus-entrypoint.sh"] CMD ["-help"] -### -FROM base as lotus-shed -MAINTAINER Lotus Development Team - -COPY --from=builder /opt/filecoin/lotus-shed /usr/local/bin/ - -USER fc - -ENTRYPOINT ["/usr/local/bin/lotus-shed"] - -CMD ["-help"] - - ### FROM base AS lotus-wallet MAINTAINER Lotus Development Team @@ -120,45 +108,6 @@ ENTRYPOINT ["/usr/local/bin/lotus-wallet"] CMD ["-help"] - -### -FROM base AS lotus-chainwatch -MAINTAINER Lotus Development Team - -COPY --from=builder /opt/filecoin/lotus-chainwatch /usr/local/bin/ - -ENV LOTUS_JAEGER_AGENT_HOST 127.0.0.1 -ENV LOTUS_JAEGER_AGENT_PORT 6831 -ENV FULLNODE_API_INFO /ip4/127.0.0.1/tcp/1234/http - -USER fc - -ENTRYPOINT ["/usr/local/bin/lotus-chainwatch"] - -CMD ["-help"] - - -### -FROM base AS lotus-stats -MAINTAINER Lotus Development Team - -COPY --from=builder /opt/filecoin/lotus-stats /usr/local/bin/ - -ENV LOTUS_JAEGER_AGENT_HOST 127.0.0.1 -ENV LOTUS_JAEGER_AGENT_PORT 6831 -ENV LOTUS_STATS_INFLUX_HOSTNAME 127.0.0.1 -ENV LOTUS_STATS_INFLUX_DATABASE lotus-stats -ENV LOTUS_STATS_INFLUX_USERNAME lotus-stats -ENV LOTUS_STATS_INFLUX_PASSWORD lotuspw -ENV FULLNODE_API_INFO /ip4/127.0.0.1/tcp/1234/http - -USER fc - -ENTRYPOINT ["/usr/local/bin/lotus-stats"] - -CMD ["-help"] - - ### FROM base AS lotus-gateway MAINTAINER Lotus Development Team @@ -242,10 +191,6 @@ ENV LOTUS_JAEGER_AGENT_HOST 127.0.0.1 ENV LOTUS_JAEGER_AGENT_PORT 6831 ENV LOTUS_MINER_PATH /var/lib/lotus-miner ENV LOTUS_PATH /var/lib/lotus -ENV LOTUS_STATS_INFLUX_DATABASE lotus-stats -ENV LOTUS_STATS_INFLUX_HOSTNAME 127.0.0.1 -ENV LOTUS_STATS_INFLUX_PASSWORD lotuspw -ENV LOTUS_STATS_INFLUX_USERNAME lotus-stats ENV LOTUS_WORKER_PATH /var/lib/lotus-worker ENV MINER_API_INFO /ip4/127.0.0.1/tcp/2345/http ENV WALLET_PATH /var/lib/lotus-wallet @@ -255,8 +200,6 @@ ENV DOCKER_LOTUS_MINER_INIT true COPY --from=builder /opt/filecoin/lotus /usr/local/bin/ COPY --from=builder /opt/filecoin/lotus-shed /usr/local/bin/ COPY --from=builder /opt/filecoin/lotus-wallet /usr/local/bin/ -COPY --from=builder /opt/filecoin/lotus-chainwatch /usr/local/bin/ -COPY --from=builder /opt/filecoin/lotus-stats /usr/local/bin/ COPY --from=builder /opt/filecoin/lotus-gateway /usr/local/bin/ COPY --from=builder /opt/filecoin/lotus-miner /usr/local/bin/ COPY --from=builder /opt/filecoin/lotus-worker /usr/local/bin/ diff --git a/docker-compose.yaml b/docker-compose.yaml index a2aa4e225..b962d5cc2 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -1,5 +1,4 @@ # By default, this docker-compose file will start a lotus fullnode -# and some associated monitoring. # # Some directives have been left commented out so they serve as an # example for more advanced use. @@ -51,7 +50,7 @@ services: environment: - LOTUS_JAEGER_AGENT_HOST=jaeger - LOTUS_JAEGER_AGENT_PORT=6831 - # - DOCKER_LOTUS_WALLET_IMPORT=/tmp/wallet + # - DOCKER_LOTUS_IMPORT_WALLET=/tmp/wallet deploy: restart_policy: condition: on-failure @@ -64,43 +63,6 @@ services: # target: /tmp/wallet command: - daemon - lotus-chainwatch: - build: - context: . - target: lotus-chainwatch - dockerfile: Dockerfile.lotus - image: filecoin/lotus-chainwatch - depends_on: - - lotus - environment: - - FULLNODE_API_INFO=/dns/lotus/tcp/1234/http - - LOTUS_JAEGER_AGENT_HOST=jaeger - - LOTUS_JAEGER_AGENT_PORT=6831 - deploy: - restart_policy: - condition: on-failure - delay: 30s - command: - - run - lotus-stats: - build: - context: . - target: lotus-stats - dockerfile: Dockerfile.lotus - image: filecoin/lotus-stats - depends_on: - - lotus - - influxdb - environment: - - FULLNODE_API_INFO=/dns/lotus/tcp/1234/http - - LOTUS_JAEGER_AGENT_HOST=jaeger - - LOTUS_JAEGER_AGENT_PORT=6831 - - LOTUS_STATS_INFLUX_HOSTNAME=influxdb - - LOTUS_STATS_INFLUX_USERNAME=lotus-stats - - LOTUS_STATS_INFLUX_PASSWORD=lotus-stats-pw - - LOTUS_STATS_INFLUX_DATABASE=lotus-stats - command: - - run lotus-gateway: build: context: . @@ -181,16 +143,3 @@ services: restart_policy: condition: on-failure delay: 30s - influxdb: - image: influxdb:latest - ports: - - 8086:8086 - environment: - - DOCKER_INFLUXDB_INIT_USERNAME=lotus-stats - - DOCKER_INFLUXDB_INIT_PASSWORD=lotus-stats-pw - - DOCKER_INFLUXDB_INIT_ORG=lotus-stats - - DOCKER_INFLUXDB_INIT_BUCKET=lotus-stats - deploy: - restart_policy: - condition: on-failure - delay: 30s diff --git a/scripts/docker-lotus-entrypoint.sh b/scripts/docker-lotus-entrypoint.sh index c8deb214e..308a4b6eb 100755 --- a/scripts/docker-lotus-entrypoint.sh +++ b/scripts/docker-lotus-entrypoint.sh @@ -2,23 +2,18 @@ if [ ! -z DOCKER_LOTUS_IMPORT_SNAPSHOT ]; then GATE="$LOTUS_PATH"/date_initialized - # Don't init if already initialized. - if [ -f "GATE" ]; then - echo lotus already initialized. - exit 0 + if [ ! -f "$GATE" ]; then + echo importing minimal snapshot + /usr/local/bin/lotus daemon --import-snapshot "$DOCKER_LOTUS_IMPORT_SNAPSHOT" --halt-after-import + # Block future inits + date > "$GATE" fi - - echo importing minimal snapshot - /usr/local/bin/lotus daemon --import-snapshot "$DOCKER_LOTUS_IMPORT_SNAPSHOT" --halt-after-import - - # Block future inits - date > "$GATE" fi -if [ ! -z DOCKER_LOTUS_WALLET_IMPORT ]; then - mkdir $LOTUS_PATH/keystore - cp "${DOCKER_LOTUS_WALLET_IMPORT}" "${LOTUS_PATH}/keystore" +# import wallet, if provided +if [ ! -z DOCKER_LOTUS_IMPORT_WALLET ]; then + /usr/local/bin/lotus-shed keyinfo import "$DOCKER_LOTUS_IMPORT_WALLET" fi exec /usr/local/bin/lotus $@