Skip to content

Commit

Permalink
Merge pull request #2 from Chia-Network/parkingideas
Browse files Browse the repository at this point in the history
Parkingideas
  • Loading branch information
justinengland authored Mar 17, 2021
2 parents 62de449 + e2a9faf commit 582acb2
Show file tree
Hide file tree
Showing 4 changed files with 68 additions and 85 deletions.
17 changes: 6 additions & 11 deletions .github/workflows/Chia-Docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ on:
description: 'chia branch name to use'
required: true
default: 'dev'
image_tag:
description: 'special tag for this image build'
required: true
default: 'unstable'

jobs:
docker_build_and_publish:
Expand All @@ -19,15 +23,6 @@ jobs:
username: ${{ github.actor }}
password: ${{ secrets.PACKAGE_ADMIN_PAT }}

- name: set image tag
id: set_tag
run: |
if [[ ${{ github.event.inputs.upstream_branch }} == "dev" ]]; then
echo "::set-output name=tag::latest"
else
echo "::set-output name=tag::${{ github.event.inputs.upstream_branch }}"
fi
- name: Check out the repo
uses: actions/checkout@v2

Expand All @@ -42,7 +37,7 @@ jobs:
echo "::set-output name=reg_token::$(curl -X POST -H "Authorization: token ${{ secrets.ORG_ADMIN }}" -H "Accept: application/vnd.github.v3+json" https://api.github.com/orgs/Chia-Network/actions/runners/registration-token | jq -r '.token')"
- name: Build docker image
run: docker build --no-cache --build-arg branch=${{ github.event.inputs.upstream_branch }} -t ghcr.io/chia-network/chia:${{ steps.set_tag.outputs.tag }} .
run: docker build --no-cache --build-arg BRANCH=${{ github.event.inputs.upstream_branch }} -t ghcr.io/chia-network/chia:${{ github.event.inputs.image_tag }} .

- name: Push to github packages
run: docker push ghcr.io/chia-network/chia:${{ steps.set_tag.outputs.tag }}
run: docker push ghcr.io/chia-network/chia:${{ github.event.inputs.image_tag }}
18 changes: 11 additions & 7 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,24 @@ FROM ubuntu:latest
EXPOSE 8555
EXPOSE 58444

ENV branch="dev"
ENV keys="generate"
ENV harvester="false"
ENV farmer="false"
ENV plots_dir="/plots"
ENV farmer_address="null"
ENV farmer_port="null"
ENV BRANCH="dev"

RUN DEBIAN_FRONTEND=noninteractive apt-get update && 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 vim

RUN git clone --branch ${branch} https://github.com/Chia-Network/chia-blockchain.git \
RUN echo "cloning ${BRANCH}"
RUN git clone --branch ${BRANCH} https://github.com/Chia-Network/chia-blockchain.git \
&& cd chia-blockchain \
&& chmod +x install.sh \
&& /usr/bin/sh ./install.sh

WORKDIR /chia-blockchain

RUN mkdir /plots
ADD ./entrypoint.sh entrypoint.sh

#ENTRYPOINT ["/bin/bash"]
ENTRYPOINT ["bash", "entrypoint.sh"]
#CMD ["/home/ubuntu/services.py"]
#ENTRYPOINT ["python3"]
ENTRYPOINT ["bash", "./entrypoint.sh"]
32 changes: 32 additions & 0 deletions entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,36 @@ cd /chia-blockchain

chia init

if [[ ${keys} == "generate" ]]; then
echo "to use your own keys pass them as a variable -e keys=\"24words\""
chia keys generate
else
echo "${keys}" | chia keys add -
fi

if [[ ! "$(ls -A /plots)" ]]; then
echo "Plots directory appears to be empty and you have not specified another, try mounting a plot directory with the docker -v command "
fi

chia plots add -d ${plots_dir}

sed -i 's/localhost/127.0.0.1/g' ~/.chia/testnet/config/config.yaml

cat ~/.chia/testnet/config/config.yaml

if [[ ${farmer} == 'true' ]]; then
chia start farmer-only
elif [[ ${harvester} == 'true' ]]; then
if [[ -z ${farmer_address} || -z ${farmer_port} ]]; then
echo "A farmer peer address and port are required."
exit
else
chia configure --set-farmer-peer ${farmer_address}:${farmer_port}
chia start harvester
fi
else
chia start farmer
fi
#statements

while true; do sleep 30; done;
86 changes: 19 additions & 67 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,93 +4,45 @@ Currently latest = head of dev branch
tagged releases to match rc and more to come shortly


## Initialize
## Basic Startup
```
docker run (optional --expose=58444 to run a testnet node)--name chia (chia-farmer, chia-harvester1 etc.) -d ghcr.io/chia-network/chia:latest (optional -v /path/to/plots:plots)
docker run --name <container-name> -d ghcr.io/chia-network/chia:latest
(optional -v /path/to/plots:plots)
(optional --expose=58444 to run a testnet node)
```

## Config management
```
docker exec -it chia /bin/bash
vim (or nano if you prefer) ~/.chia/testnet/config/config.yaml
```

modify the line
```
self_hostname: &self_hostname "localhost"
```
to match
```
self_hostname: &self_hostname "127.0.0.1"
```
## Configuration

#### optional: remote harvester
You can modify the behavior of your Chia container by setting specific environment variables.

To use your own keys pass
```
harvester:
# The harvester server (if run) will run on this port
port: 8448
farmer_peer:
host: *self_hostname
port: 8447
-e keys="twenty four words"
```
include the proper host and port for your remote farmer node or container.

## Starting Chia Blockchain

#### remain in the container with a bash shell

Activate venv
To start a farmer only node pass
```
. ./activate
-e farmer="true"
```

If you have your own keys
```
chia keys add (follow prompt)
To start a harvester only node pass
```
or
-e harvester="true" -e farmer_address="addres.of.farmer" -e farmer_port="portnumber"
```
echo "keys" | chia keys add -
```

To generate keys
```
chia keys generate
```

If added the optional plots earlier

#### or run the commands externally with venv
```
chia plots add -d /plots
```

you can start chia as usual
```
chia start farmer
optional single purpose node
(chia start farmer-only)
(chia start harvester)
```

verify things are working
```
chia show -s -c
```

drop from shell, leave running Container
```
exit
```
#### or run the same commands externally with venv
```
docker exec -it chia venv/bin/chia keys generate OR docker exec -it chia venv/bin/chia keys add
docker exec -it chia venv/bin/chia keys add
docker exec -it chia venv/bin/chia plots add -d /plots
docker exec -it chia venv/bin/chia start farmer
```

#### status from outside the container

```
docker exec -it chia venv/bin/chia show -s -c
```

#### Need a wallet?
```
docker exec -it chia-farmer1 venv/bin/chia wallet show (follow the prompts)
```

0 comments on commit 582acb2

Please sign in to comment.