Sign inSign up

cryptobridge/cointainer-hora

By cryptobridge

Updated about 7 years ago

Image
0

162

cryptobridge/cointainer-hora repository overview

Cointainer

A cointainer is a coin-daemon in a docker-container.

Create

Place new Cointainers in a subfolder named by its ticker name. A cointainer requires a Dockerfile to build a docker container, a .dockerignore file and a docker-compose.yml file to configure Docker Compose for local testing and usage and last but not least a cointainer.yml file for the stage/production deployments.

Dockerfile
FROM cryptobridge/baseimage:bionic-build

# clone repo and run build
RUN git clone <coin-repo>/ . && \
  cd <coin-dir> && \
  ./autogen.sh && \
  ./configure && \
  make

FROM cryptobridge/baseimage:bionic

COPY --from=build /build/<coin-name>/src/coind /usr/local/bin/coind
COPY --from=build /build/<coin-name>/src/coin-cli /usr/local/bin/coin-cli

EXPOSE 12345
USER crypto
CMD ["coind"]

We use a multistage build for the cointainers to reduce the image size. The upper part is used to build or download the coin daemon, the second part is the execution part which gets deployed then.

We have 4 predefined docker images.

  • cryptobridge/baseimage:xenial-build (Including build tools)
  • cryptobridge/baseimage:xenial (Including all runtime libraries)
  • cryptobridge/baseimage:bionic-build (Including build tools)
  • cryptobridge/baseimage:bionic (Including all runtime libraries)

Please use this images. They all based on the phusion/baseimage which is based on ubuntu 16.04 or 18.04. The baseimages containing all required build tools and it shouldn't be nacessary to install any build tools for the most coins. Feel free to add new baseimages or extend the existing one. (See baseimage subfolder)

.dockerignode
data/
docker-compose.yml
version: '3.6'
services:
  btc:
    context: '.'
  volumes:
    - ./data/:/home/crypor/.bitcoin
  container_name: cryptobridge/cointainer-btc
cointainer.yml
version: '3.6'

services:
  btc:
    image: cryptobridge/cointainer-btc
    ports:
      - "8332:8332"
    volumes:
      - cointainer-btc:/root/.bitcoin
    command:
      - "bitcoind"
    deploy:
      mode: replicated
      replicas: 1
    user: root
    tty: true

volumes:
  cointainer-btc:
    driver: rexray/ebs
    driver_opts:
      name: 'btc'
      size: 400
      type: 'gp2'
      encrypted: 'true'

Build

Change into the folder of the required coin and run docker-compose build. The Command downloads all required Docker images and compiles the cointainer. This step my take some time. Repeat this step if you made any changes in the Dockerfile file.

docker-compose build [coinname]

Usage (Localy)

Use docker-compose for localy usage and testing. It is more comfortable then the plain docker cli. Docker compose requires a docker-compose.yml file at the current working dir.

The first time you start a daemon, it downloads the full blockchain to your local machine. Please check if your machine has enough space. Bitcoin requires about 240GB disk space. All necessary data are stored under <coinname>/data/ on your local machine. This folder will be mounted into the cointainer during startup.

Start coin daemon
cd btc/
docker-compose up [coinname]
Login into a running cointainer
docker-compose exec [coinname] bash
Stoping a cointainer
docker-compose stop [coinname]

Ports

Docker forwards the RPC ports of the running cointainer to the host machine. The list below shows all cointainer ports. (Please update it if you add a new one)

Coin namePortTestnet Port
Bitcoin833218332
Bridgecoin????
Raven876618766

Deployment (Draft)

  1. Commit your changes to github.
  2. ** Tag image docker tag [coin-dir]_[coinname] cryptobridge/cointainer-[coinname]
  3. ** Push image to Docker Hub docker push cryptobridge/cointainer-[coinname]
  4. ** ssh into the Manager Node and run docker stack deploy -c deploy/[coinname].yml cointainer

** = Could be done by Travis

Swarm commands

List running Cointainers
docker service ls
Show running services
docker service ps <service-name>
Deploy new service
docker stack deploy -c deploy/<filename>.yml cointainer
Show service logs
docker service logs --raw -f <service-name>
Restart a cointainer
docker service scale <service-name>=0
docker service scale <service-name>=1
Stop a cointainer
docker service scale <service-name>=0

or just remove it

docker service rm <service-name>

A removed cointainer can be restored by a redeploy

docker stack deploy -c deploy/<filename>.yml cointainer

Tag summary

Content type

Image

Digest

Size

136.4 MB

Last updated

about 7 years ago

docker pull cryptobridge/cointainer-hora:1.1