openethereum/scripts/docker
Azamat M 9b55169251 Add readiness check for docker container (#9804)
* Update Dockerfile

Since parity is built for "mission critical use", I thought other operators may see the need for this.

Adding the `curl` and `jq` commands allows for an extremely simple health check to be usable in container orchestrators.

For example. Here is a health check for a parity docker container running in Kubernetes.

This can be setup as a readiness Probe that would prevent clustered nodes that aren't ready from serving traffic.

```bash
#!/bin/bash

ETH_SYNCING=$(curl -X POST --data '{"jsonrpc":"2.0","method":"eth_syncing","params":[],"id":1}' http://localhost:8545 -H 'Content-Type: application/json')
RESULT=$(echo "$ETH_SYNCING | jq -r .result)

if [ "$RESULT" == "false" ]; then
  echo "Parity is ready to start accepting traffic"
  exit 0
else
  echo "Parity is still syncing the blockchain"
  exit 1
fi
```

* add sync check script
2018-10-26 13:51:08 +02:00
..
alpine CI: Remove unnecessary pipes (#9681) 2018-10-02 00:03:58 +01:00
centos CI: Remove unnecessary pipes (#9681) 2018-10-02 00:03:58 +01:00
hub Add readiness check for docker container (#9804) 2018-10-26 13:51:08 +02:00
ubuntu-aarch64 CI: Remove unnecessary pipes (#9681) 2018-10-02 00:03:58 +01:00
ubuntu-arm CI: Remove unnecessary pipes (#9681) 2018-10-02 00:03:58 +01:00
README.md CI: Remove unnecessary pipes (#9681) 2018-10-02 00:03:58 +01:00

Usage

docker build -f docker/ubuntu/Dockerfile --tag ethcore/parity:branch_or_tag_name .

Usage - CentOS

Builds a lightweight non-root Parity docker image:

git clone https://github.com/paritytech/parity-ethereum.git
cd parity-ethereum
./docker/centos/build.sh

Fully customised build:

PARITY_IMAGE_REPO=my-personal/parity \
PARITY_BUILDER_IMAGE_TAG=build-latest \
PARITY_RUNNER_IMAGE_TAG=centos-parity-experimental \
./docker/centos/build.sh

Default values:

# The image name
PARITY_IMAGE_REPO - parity/parity

# The tag to be used for builder image, git commit sha will be appended
PARITY_BUILDER_IMAGE_TAG - build

# The tag to be used for runner image
PARITY_RUNNER_IMAGE_TAG - latest

All default ports you might use will be exposed:

#           secret
#      ipfs store     ui   rpc  ws   listener  discovery
#      ↓    ↓         ↓    ↓    ↓    ↓         ↓
EXPOSE 5001 8082 8083 8180 8545 8546 30303/tcp 30303/udp