add docker-compose file
This commit is contained in:
parent
715176698f
commit
02f4182749
221
Dockerfile.lotus
221
Dockerfile.lotus
@ -36,7 +36,7 @@ WORKDIR /opt/filecoin
|
||||
ARG RUSTFLAGS=""
|
||||
ARG GOFLAGS=""
|
||||
|
||||
RUN make deps lotus lotus-miner lotus-worker lotus-shed lotus-chainwatch lotus-stats
|
||||
RUN make lotus lotus-miner lotus-worker lotus-shed lotus-chainwatch lotus-stats lotus-wallet lotus-gateway
|
||||
|
||||
|
||||
FROM ubuntu:20.04 AS base
|
||||
@ -56,19 +56,230 @@ COPY --from=builder /usr/lib/x86_64-linux-gnu/libOpenCL.so.1 /lib/
|
||||
RUN useradd -r -u 532 -U fc
|
||||
|
||||
|
||||
###
|
||||
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 --from=builder /opt/filecoin/lotus /usr/local/bin/
|
||||
COPY scripts/docker-lotus-entrypoint.sh /
|
||||
|
||||
ENV FILECOIN_PARAMETER_CACHE /var/tmp/filecoin-proof-parameters
|
||||
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 ""
|
||||
|
||||
RUN mkdir /var/lib/lotus /var/tmp/filecoin-proof-parameters && chown fc /var/lib/lotus /var/tmp/filecoin-proof-parameters
|
||||
RUN mkdir /var/lib/lotus /var/tmp/filecoin-proof-parameters
|
||||
RUN chown fc: /var/lib/lotus /var/tmp/filecoin-proof-parameters
|
||||
|
||||
VOLUME /var/lib/lotus
|
||||
VOLUME /var/tmp/filecoin-proof-parameters
|
||||
|
||||
USER fc
|
||||
|
||||
ENTRYPOINT ["/usr/local/bin/lotus"]
|
||||
EXPOSE 1234
|
||||
|
||||
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
|
||||
|
||||
COPY --from=builder /opt/filecoin/lotus-wallet /usr/local/bin/
|
||||
|
||||
ENV WALLET_PATH /var/lib/lotus-wallet
|
||||
ENV LOTUS_JAEGER_AGENT_HOST 127.0.0.1
|
||||
ENV LOTUS_JAEGER_AGENT_PORT 6831
|
||||
|
||||
RUN mkdir /var/lib/lotus-wallet
|
||||
RUN chown fc: /var/lib/lotus-wallet
|
||||
|
||||
VOLUME /var/lib/lotus-wallet
|
||||
|
||||
USER fc
|
||||
|
||||
EXPOSE 1777
|
||||
|
||||
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
|
||||
|
||||
COPY --from=builder /opt/filecoin/lotus-gateway /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
|
||||
|
||||
EXPOSE 1234
|
||||
|
||||
ENTRYPOINT ["/usr/local/bin/lotus-gateway"]
|
||||
|
||||
CMD ["-help"]
|
||||
|
||||
|
||||
###
|
||||
FROM base AS lotus-miner
|
||||
MAINTAINER Lotus Development Team
|
||||
|
||||
COPY --from=builder /opt/filecoin/lotus-miner /usr/local/bin/
|
||||
COPY scripts/docker-lotus-miner-entrypoint.sh /
|
||||
|
||||
ENV FILECOIN_PARAMETER_CACHE /var/tmp/filecoin-proof-parameters
|
||||
ENV FULLNODE_API_INFO /ip4/127.0.0.1/tcp/1234/http
|
||||
ENV LOTUS_MINER_PATH /var/lib/lotus-miner
|
||||
ENV LOTUS_JAEGER_AGENT_HOST 127.0.0.1
|
||||
ENV LOTUS_JAEGER_AGENT_PORT 6831
|
||||
ENV DOCKER_LOTUS_MINER_INIT true
|
||||
|
||||
RUN mkdir /var/lib/lotus-miner /var/tmp/filecoin-proof-parameters
|
||||
RUN chown fc: /var/lib/lotus-miner /var/tmp/filecoin-proof-parameters
|
||||
|
||||
VOLUME /var/lib/lotus-miner
|
||||
VOLUME /var/tmp/filecoin-proof-parameters
|
||||
|
||||
USER fc
|
||||
|
||||
EXPOSE 2345
|
||||
|
||||
ENTRYPOINT ["/docker-lotus-miner-entrypoint.sh"]
|
||||
|
||||
CMD ["-help"]
|
||||
|
||||
|
||||
###
|
||||
FROM base AS lotus-worker
|
||||
MAINTAINER Lotus Development Team
|
||||
|
||||
COPY --from=builder /opt/filecoin/lotus-worker /usr/local/bin/
|
||||
|
||||
ENV FILECOIN_PARAMETER_CACHE /var/tmp/filecoin-proof-parameters
|
||||
ENV MINER_API_INFO /ip4/127.0.0.1/tcp/2345/http
|
||||
ENV LOTUS_WORKER_PATH /var/lib/lotus-worker
|
||||
ENV LOTUS_JAEGER_AGENT_HOST 127.0.0.1
|
||||
ENV LOTUS_JAEGER_AGENT_PORT 6831
|
||||
|
||||
RUN mkdir /var/lib/lotus-worker
|
||||
RUN chown fc: /var/lib/lotus-worker
|
||||
|
||||
VOLUME /var/lib/lotus-worker
|
||||
|
||||
USER fc
|
||||
|
||||
EXPOSE 3456
|
||||
|
||||
ENTRYPOINT ["/usr/local/bin/lotus-worker"]
|
||||
|
||||
CMD ["-help"]
|
||||
|
||||
|
||||
###
|
||||
from base as lotus-all-in-one
|
||||
|
||||
ENV FILECOIN_PARAMETER_CACHE /var/tmp/filecoin-proof-parameters
|
||||
ENV FULLNODE_API_INFO /ip4/127.0.0.1/tcp/1234/http
|
||||
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
|
||||
ENV DOCKER_LOTUS_IMPORT_SNAPSHOT https://fil-chain-snapshots-fallback.s3.amazonaws.com/mainnet/minimal_finality_stateroots_latest.car
|
||||
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/
|
||||
|
||||
RUN mkdir /var/tmp/filecoin-proof-parameters
|
||||
RUN mkdir /var/lib/lotus
|
||||
RUN mkdir /var/lib/lotus-miner
|
||||
RUN mkdir /var/lib/lotus-worker
|
||||
RUN mkdir /var/lib/lotus-wallet
|
||||
RUN chown fc: /var/tmp/filecoin-proof-parameters
|
||||
RUN chown fc: /var/lib/lotus
|
||||
RUN chown fc: /var/lib/lotus-miner
|
||||
RUN chown fc: /var/lib/lotus-worker
|
||||
RUN chown fc: /var/lib/lotus-wallet
|
||||
|
||||
|
||||
VOLUME /var/tmp/filecoin-proof-parameters
|
||||
VOLUME /var/lib/lotus
|
||||
VOLUME /var/lib/lotus-miner
|
||||
VOLUME /var/lib/lotus-worker
|
||||
VOLUME /var/lib/lotus-wallet
|
||||
|
||||
EXPOSE 1234
|
||||
EXPOSE 2345
|
||||
EXPOSE 3456
|
||||
EXPOSE 1777
|
||||
|
196
docker-compose.yaml
Normal file
196
docker-compose.yaml
Normal file
@ -0,0 +1,196 @@
|
||||
# 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.
|
||||
#
|
||||
# To provide a custom configuration file, or automatically import
|
||||
# a wallet, uncomment the "configs" or "secrets" sections.
|
||||
#
|
||||
# start on a single node:
|
||||
#
|
||||
# docker-compose up
|
||||
#
|
||||
# start on docker swarm:
|
||||
#
|
||||
# docker swarm init (if you haven't already)
|
||||
# docker stack deploy -c docker-compose.yaml mylotuscluster
|
||||
#
|
||||
# for more information, please visit docs.filecoin.io
|
||||
|
||||
version: "3.8"
|
||||
|
||||
volumes:
|
||||
parameters:
|
||||
lotus-repo:
|
||||
lotus-miner-repo:
|
||||
lotus-worker-repo:
|
||||
|
||||
configs:
|
||||
lotus-config-toml:
|
||||
file: /path/to/lotus/config.toml
|
||||
lotus-miner-config-toml:
|
||||
file: /path/to/lotus-miner/config.toml
|
||||
|
||||
secrets:
|
||||
lotus-wallet:
|
||||
file: /path/to/exported/lotus/wallet
|
||||
|
||||
services:
|
||||
lotus:
|
||||
build:
|
||||
context: .
|
||||
target: lotus
|
||||
dockerfile: Dockerfile.lotus
|
||||
image: filecoin/lotus
|
||||
volumes:
|
||||
- parameters:/var/tmp/filecoin-proof-parameters
|
||||
- lotus-repo:/var/lib/lotus
|
||||
ports:
|
||||
- 1234:1234
|
||||
environment:
|
||||
- LOTUS_JAEGER_AGENT_HOST=jaeger
|
||||
- LOTUS_JAEGER_AGENT_PORT=6831
|
||||
# - DOCKER_LOTUS_WALLET_IMPORT=/tmp/wallet
|
||||
deploy:
|
||||
restart_policy:
|
||||
condition: on-failure
|
||||
delay: 30s
|
||||
# configs:
|
||||
# - source: lotus-config-toml
|
||||
# target: /var/lib/lotus/config.toml
|
||||
# secrets:
|
||||
# - source: lotus-wallet
|
||||
# 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: .
|
||||
target: lotus-gateway
|
||||
dockerfile: Dockerfile.lotus
|
||||
image: filecoin/lotus-gateway
|
||||
depends_on:
|
||||
- lotus
|
||||
ports:
|
||||
- 1235:1234
|
||||
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
|
||||
#
|
||||
# Uncomment to run miner software
|
||||
#
|
||||
# lotus-miner:
|
||||
# build:
|
||||
# context: .
|
||||
# target: lotus-miner
|
||||
# dockerfile: Dockerfile.lotus
|
||||
# image: filecoin/lotus-miner
|
||||
# volumes:
|
||||
# - parameters:/var/tmp/filecoin-proof-parameters
|
||||
# - lotus-miner-repo:/var/lib/lotus-miner
|
||||
# depends_on:
|
||||
# - lotus
|
||||
# ports:
|
||||
# - 2345:2345
|
||||
# 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
|
||||
# configs:
|
||||
# - source: lotus-miner-config-toml
|
||||
# - target: /var/lib/lotus-miner/config.toml
|
||||
# command:
|
||||
# - run
|
||||
# lotus-worker:
|
||||
# build:
|
||||
# context: .
|
||||
# target: lotus-worker
|
||||
# dockerfile: Dockerfile.lotus
|
||||
# image: filecoin/lotus-worker
|
||||
# volumes:
|
||||
# - parameters:/var/tmp/filecoin-proof-parameters
|
||||
# - lotus-worker-repo:/var/lib/lotus-worker
|
||||
# depends_on:
|
||||
# - lotus-worker
|
||||
# environment:
|
||||
# - MINER_API_INFO=/dns/lotus-miner/tcp/1234/http
|
||||
# - LOTUS_JAEGER_AGENT_HOST=jaeger
|
||||
# - LOTUS_JAEGER_AGENT_PORT=6831
|
||||
# deploy:
|
||||
# restart_policy:
|
||||
# condition: on-failure
|
||||
# delay: 30s
|
||||
# replicas: 2
|
||||
# command:
|
||||
# - run
|
||||
jaeger:
|
||||
image: jaegertracing/all-in-one
|
||||
ports:
|
||||
- "6831:6831/udp"
|
||||
- "16686:16686"
|
||||
deploy:
|
||||
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
|
24
scripts/docker-lotus-entrypoint.sh
Executable file
24
scripts/docker-lotus-entrypoint.sh
Executable file
@ -0,0 +1,24 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
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
|
||||
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"
|
||||
fi
|
||||
|
||||
exec /usr/local/bin/lotus $@
|
19
scripts/docker-lotus-miner-entrypoint.sh
Executable file
19
scripts/docker-lotus-miner-entrypoint.sh
Executable file
@ -0,0 +1,19 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
if [ ! -z DOCKER_LOTUS_MINER_INIT ]; then
|
||||
GATE="$LOTUS_PATH"/date_initialized
|
||||
|
||||
# Don't init if already initialized.
|
||||
if [ -f "GATE" ]; then
|
||||
echo lotus-miner already initialized.
|
||||
exit 0
|
||||
fi
|
||||
|
||||
echo starting init
|
||||
/usr/local/bin/lotus-miner init
|
||||
|
||||
# Block future inits
|
||||
date > "$GATE"
|
||||
fi
|
||||
|
||||
exec /usr/local/bin/lotus-miner $@
|
Loading…
Reference in New Issue
Block a user