Skip to content
Branch: master
Find file History
Pull request Compare This branch is 14 commits behind develop.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
..
Failed to load latest commit information.
Dockerfile
Dockerfile.dev
Makefile
README.md
entry.sh

README.md

Dockerfile for T-Bears Service

This document contains brief guidance on building T-Bears Docker image and running T-Bears Docker Container.

Requirements

Base Docker Image

  • ubuntu:18.04

Build T-Bears Docker image

$ make build

or

$ docker build -t tbears .
...
Successfully built 5db49a760f69
Successfully tagged tbears:latest

Note that you don't need to build Docker image. You can use the T-Bears Docker image on Docker Hub.

Usage

Run T-Bears Docker container

$ make run

or

$ docker run -it --name tbears-container -p 9000:9000 iconloop/tbears
 * Starting RabbitMQ Messaging Server rabbitmq-server                         [ OK ]
Made tbears_cli_config.json, tbears_server_config.json, keystore_test1 successfully
Started tbears service successfully
root@c5a44cefb2dc:/tbears#

This will start the T-Bears container, named tbears-container, that is listening on port 9000 for incoming requests.

If you want T-Bears container to listen on other port, run the following command.

$ docker run -it -p ${LISTEN_PORT}:9000 iconloop/tbears

Test with T-Bears Docker container

In T-Bears Docker container

In same terminal, run the following T-Bears CLI command to see if the T-Bears service work correctly.

root@c5a44cefb2dc:/tbears# tbears totalsupply
Total supply of ICX in hex: 0x2961fff8ca4a62327800000
Total supply of ICX in decimal: 800460000000000000000000000

You can exit the T-Bears container with 'exit' command.

If you want to test with T-Bears again, start T-Bears container and attach it.

$ docker container start tbears-container
tbears-container
$ docker container attach tbears-container
root@c5a44cefb2dc:/tbears#

In host

From another terminal, run the following T-Bears CLI command to see if it could be correctly connected to the T-Bears service.

If you modified the listening port of T-Bears container, run T-Bears CLI command with -u option.

$ tbears totalsupply
Total supply of ICX in hex: 0x2961fff8ca4a62327800000
Total supply of ICX in decimal: 800460000000000000000000000

Note that you don't need to install RabbitMQ package on the host system in this configuration. Just need to install T-bears package for issuing some CLI commands.

Block, SCORE and log data

All data generated by and used by T-Bears container is persisted in a Docker volume.

You can identify Docker volume used by T-Bears container with following command.

$ docker inspect --format '{{ range .Mounts }}{{ .Name }} {{ end }}' tbears-container
6e6de414ee41ae2229ab0ef38f81f08e7dac8abbbdc8ca9ad6777b6b66da8296

If you want to use host file system, mount host directory into the container when run T-Bears container.

$ docker run -it --name tbears-container -v $MOUNT_PATH:/tbears -p 9000:9000 iconloop/tbears

Install T-Bears in Docker container

You can install T-Bears which you want in Docker container via pip3. Select T-Bears package from PYPI or GitHub.

root@c5a44cefb2dc:/tbears# pip3 show tbears
ame: tbears
Version: 1.0.5
Summary: Test suite for ICON SCORE development
Home-page: https://github.com/icon-project/t-bears
Author: ICON Foundation
Author-email: foo@icon.foundation
License: Apache License 2.0
Location: /usr/local/lib/python3.6/dist-packages
Requires: secp256k1, iconcommons, eth-keyfile, iconrpcserver, plyvel, earlgrey, sanic, requests, ipython, iconservice
root@c5a44cefb2dc:/tbears# pip3 install --force-reinstall tbears==1.0.4
Collecting tbears==1.0.4
  Downloading https://files.pythonhosted.org/packages/88/b0/4f6a775e6a9ddee3f0e66fb34b8a0caf842cd5e078dccc87daeb5b13652a/tbears-1.0.4-py3-none-any.whl (69kB)
    100% |████████████████████████████████| 71kB 366kB/s
...
Installing collected packages: tbears
  Found existing installation: tbears 1.0.5
    Uninstalling tbears-1.0.5:
      Successfully uninstalled tbears-1.0.5
Successfully installed tbears-1.0.4
root@c5a44cefb2dc:/tbears# pip3 show tbears
Name: tbears
Version: 1.0.4
...

root@c5a44cefb2dc:/tbears# pip3 install --force-reinstall git+https://github.com/icon-project/t-bears.git@develop
Collecting git+https://github.com/icon-project/t-bears.git@develop
  Cloning https://github.com/icon-project/t-bears.git (to develop) to /tmp/pip-d3gbwk52-build
...
Installing collected packages: tbears
  Found existing installation: tbears 1.0.4
    Uninstalling tbears-1.0.4:
      Successfully uninstalled tbears-1.0.4
  Running setup.py install for tbears ... done
Successfully installed tbears-1.0.5
root@c5a44cefb2dc:/tbears# pip3 show tbears
Name: tbears
Version: 1.0.5
...

root@c5a44cefb2dc:/tbears#
You can’t perform that action at this time.