forked from ericaltendorf/plotman
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
141 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
.git | ||
.github | ||
.coveragerc | ||
.gitignore | ||
docker |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,4 +2,5 @@ __pycache__ | |
venv | ||
.DS_Store | ||
.vscode | ||
*.code-workspace | ||
src/plotman.egg-info |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
#!/bin/bash | ||
|
||
DOCKER_REGISTRY="<docker-registry>" | ||
PROJECT="chia-plotman" | ||
TAG="plotter" | ||
BASE_CONTAINER="ubuntu:20.04" | ||
CHIA_GIT_REFERENCE="1.1.7" | ||
|
||
# The UID/GID should match the 'chia' owner of the directories on the host system | ||
UID=10001 | ||
GID=10001 | ||
|
||
docker rmi ${LOCAL_REGISTRY}/${PROJECT}:${TAG} | ||
|
||
docker build . \ | ||
--squash \ | ||
--build-arg BASE_CONTAINER=${BASE_CONTAINER} \ | ||
--build-arg CHIA_GIT_REFERENCE=${CHIA_GIT_REFERENCE} \ | ||
--build-arg UID=${UID} \ | ||
--build-arg GID=${GID} \ | ||
-f docker/Dockerfile \ | ||
-t ${DOCKER_REGISTRY}/${PROJECT}:${TAG} | ||
|
||
docker push ${DOCKER_REGISTRY}/${PROJECT}:${TAG} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
# Build deployable artifacts | ||
ARG BASE_CONTAINER=ubuntu:20.04 | ||
FROM ${BASE_CONTAINER} as plotman-builder | ||
|
||
ARG CHIA_GIT_REFERENCE | ||
|
||
RUN DEBIAN_FRONTEND=noninteractive apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y curl jq python3 ansible tar bash ca-certificates git openssl unzip wget python3-pip sudo acl build-essential python3-dev python3.8-venv python3.8-distutils apt nfs-common python-is-python3 | ||
|
||
RUN echo "cloning ${CHIA_GIT_REFERENCE}" | ||
RUN git clone --branch "${CHIA_GIT_REFERENCE}" https://github.com/Chia-Network/chia-blockchain.git \ | ||
&& cd chia-blockchain \ | ||
&& git submodule update --init mozilla-ca | ||
|
||
WORKDIR /chia-blockchain | ||
# Placeholder for patches | ||
RUN /bin/bash ./install.sh | ||
|
||
COPY . /plotman | ||
|
||
RUN ["/bin/bash", "-c", "source ./activate && pip install /plotman && deactivate"] | ||
|
||
# Build deployment container | ||
FROM ${BASE_CONTAINER} as plotman | ||
|
||
ARG UID=10001 | ||
ARG GID=10001 | ||
|
||
RUN DEBIAN_FRONTEND=noninteractive apt-get update \ | ||
&& DEBIAN_FRONTEND=noninteractive apt-get install -y curl jq python3 python3.8-venv ca-certificates tzdata ssh rsync \ | ||
&& apt-get clean all \ | ||
&& rm -rf /var/lib/apt/lists | ||
|
||
COPY --from=plotman-builder /chia-blockchain /chia-blockchain | ||
|
||
RUN groupadd -g ${GID} chia | ||
RUN useradd -m -u ${UID} -g ${GID} chia | ||
|
||
RUN mkdir -p /data/chia/tmp \ | ||
&& mkdir -p /data/chia/plots \ | ||
&& mkdir -p /data/chia/logs | ||
|
||
VOLUME ["/data/chia/tmp","/data/chia/plots","/data/chia/logs"] | ||
|
||
RUN chown -R chia:chia /chia-blockchain \ | ||
&& chown -R chia:chia /data/chia | ||
|
||
WORKDIR /chia-blockchain | ||
USER chia | ||
|
||
ENV VIRTUAL_ENV="/chia-blockchain/venv" | ||
ENV PATH="$VIRTUAL_ENV/bin:$PATH" | ||
|
||
# Kick off plots (assumes the environemnt is good to go) | ||
CMD ["/bin/bash", "-c", "plotman plot" ] | ||
# Alternative command to simply provide shell environment | ||
# CMD ["/bin/bash", "-c", "trap : TERM INT; sleep infinity & wait" ] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
version: "3" | ||
|
||
services: | ||
chia_plotman: | ||
restart: always | ||
container_name: chia-plotman | ||
image: ${DOCKER_IMAGE} | ||
volumes: | ||
- ${HOME}/.ssh:/home/chia/.ssh | ||
- ${HOME}/.chia:/home/chia/.chia | ||
- ${HOME}/.config:/home/chia/.config | ||
- ${LOGS_DIR}:/data/chia/logs | ||
- ${PLOTS_DIR}:/data/chia/plots | ||
- ${PLOTS_TMP_DIR}:/data/chia/tmp | ||
- /tmp:/tmp | ||
logging: | ||
options: | ||
max-size: ${DOCKER_LOG_MAX_SIZE} | ||
max-file: ${DOCKER_LOG_MAX_FILE} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
DOCKER_IMAGE=<docker-registry>/chia-plotman:plotter | ||
LOGS_DIR=/data/chia/logs | ||
PLOTS_DIR=/data/chia/plots | ||
PLOTS_TMP_DIR=/data/chia/tmp | ||
DOCKER_LOG_MAX_SIZE=4m | ||
DOCKER_LOG_MAX_FILE=10 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters