This is HDAC Bride Node Service, which provides nodes to provide contract services for issuing and managing tokens based on HDAC Mainnet. The initial version consists of four basic modules, Web Server, Anchoring, Contract and Database, and you could check the contents to be updated here on Docker Hub and GitHub.
Our services consist of four modules, and the description of each module is as follows:
All instructions are based on Centos.
$ sudo yum update
$ sudo yum install yum-util device-mapper-persistent-data lvm2
$ sudo yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
$ sudo yum install docker-ce
$ sudo systemctl enable docker
$ sudo systemctl start docker
$ sudo curl -L https://github.com/docker/compose/releases/download/1.23.1/docker-compose-`uname -s`-`uname -m` -o /usr/local/bin/docker-compose
$ sudo chmod +x /usr/local/bin/docker-compose
version: '2'
services:
webserver:
image: 'hdac/bridgenode:webserver_v08'
privileged: true
tty: true
network_mode: "host"
container_name: webserver
command: init
working_dir: /opt
depends_on:
- databases
databases:
image: 'hdac/bridgenode:database_v08'
privileged: true
tty: true
network_mode: "host"
container_name: databases
command: init
working_dir: /home
anchor:
image: 'hdac/bridgenode:anchoring_v08'
stdin_open: true
privileged: true
network_mode: "host"
tty: true
container_name: anchoring
command: init
working_dir: /opt
depends_on:
- webserver
contract:
image: 'hdac/bridgenode:contract_v08'
privileged: true
network_mode: "host"
tty: true
container_name: contract
command: init
working_dir: /opt
depends_on:
- webserver
$ sudo docker-compose up -d
After running, make sure that some port numbers do not overlap.
The port numbers used are as follows.
The network modes for all containers are based on the hosts, therefore, each container is connected to its local IP.
80(Apache), 3306(DB), 8822(Main chain rpc), 16001(Side chain rpc), 8309/8209(Java AJP/1.3)
If you would like to change the port used in the container, you have to modify the internal configuration file as explained below.
As all containers access the DB, you have to change the port in all of the containers in the case of changing the Database port.
$ sudo docker exec -it [container name] bash
Apache port setting : webserver container | path : /etc/httpd/conf/httpd.conf | apply : httpd service restart
Chain port setting : webserver container | path : /root/.hdac/hdac or sideChain/param.dat | apply : runmain and runside service start
Java port setting : webserver container | path : /usr/local/tomcat1 or tomcat2/conf/server.xml | apply : tomcat-1 or tomcat-2 service restart
DB port setting : database container | path : /etc/my.cnf | apply : mysqld service restart
After the setting, you may access the user wizard page through a browser like chrome.
(Your server IP)123.456.78.999:(Apache port)80/main.do
The Web Server Container provides two default cores, the Mainnet and a side chain. Therefore, you may use the default side chain or create a chain with a different name and use it.
$ Systemctl enable runmain.service
$ Systemctl start runmain.service
$ Systemctl enable runside.service
$ Systemctl start runside.service
/root/.hdac/sideChain/params.dat
/root/.hdac/hdac/hdac.conf (main chain)
/root/.hdac/sideChain/hdac.conf (side chain)
$ cd /opt/chain_side
$ ./hdac-util create (new chain name)
You can find out new folder maked under path /root/.hdac
$ cp /root/.hdac/sideChain/params.dat /root/.hdac/(new chain name)
$ vi params.dat (have to change chain name, not 'sideChain')
$ cp /root/.hdac/sideChain/hdac.conf /root/.hdac/(new chain name)
$ vi hdac.conf (change RPC configuration if you want)
In this case, change the chain name of the “Runside” service script to the newly created name, and then start the service.
$ vi /usr/lib/systemd/system/runside.service
The Anchoring Service is a standalone service connected to each chain, executed after running the Web Server and the Database. The process for executing the service is as follows.
$ sudo docker exec -it anchoring bash
$ cd anchor/config
Modify anchor.properties (Description of each property is on the code)
After modifying, crond service start. $ systemctl start crond
You can check the log file /opt/anchor/anchorLog.log
The Anchor.properties file must be changed before executing the said service. Changing the properties during the operation of service may lead to wrong verification results.
After running the Web Server Container, you may access some webpages that we provide.
123.456.78.9 (your IP):80 (your apache port)/main.do
In order to implement contract services such as issuing the tokens, you have to deposit some coins in the three addresses you see on the main page.
You can also use three menus, Contract Info, Issue Token and Verify Transaction. Among these three, the Issue Token menu may be accessed from specific IPs in the configuration file of the Web Server Container.
$ docker exec -it webserver bash
$ cd /opt/tomcat1/myapp/WEB-INF/classes/config (same in tomcat2)
$ vi access-ip.propertoes
If you would like to access the menu from all IPs, do not put in any IP on the properties file. However, if you put in a specific IP on the file, you may access the Issue Token menu from that IP only.
Each menu is briefly described as follows.
In the case of contract services, three modules are running in the Container, i.e. Grab, Handle and Refund.
Each module is operated through CRONTAB, and the change of script and period is done as follows.
$ docker exec -it contract bash
$ cd contract
$ crontab -e (change period of each script)
$ systemctl start crond (start CRONTAB service after change period)
At the time of operating the Contract Container, the RPC information and service configuration of the chain are operated based on the values on server config and service config table of the Database, therefore, in order to change any of them, access the Database and change the values on the table.
$ docker exec -it databases bash
$ mysql -u root -p (password : hdac1234)
$ use test;
$ show tables;
If necessary, modify server_config, service_config table contents to adapt your running environment.
We provide an additional node image that can be synchronized to another node. How to use the node image is as follows.
For subnode, use the same params as the node you want to connect to. So run on another server to avoid a port crash.
$ docker run --privileged -d --net=host --name subnode hdac/bridgenode:subnode_v08 init
$ docker exec -it subnode bash
$ ./core.sh (Enter seed node information)
$ cd chain_util
$ ./hdac-cli [chain name] getinfo (Check node synchronization)
We are providing KASSE to test the bridgenode. The win and osx versions are available and the download location is as follows.
- Update contactLib when generating tokens
- Share all libraries between containers via nfs (new docker image nfsserver_v09 added)
- Anchoring service module operates through a package jar file
- Database table added (access_ip, anchor_config)
All shared libraries are managed by nfsserver and must be run first.
The nfsserver image should have an nfs server installed on the host that want to run.
$ yum install nfs-utils nfs-utils-lib
$ vi /etc/exports
/opt/shareLib/ *(rw,sync,no_root_squash) -> save share directory
$ systemctl start nfs
$ systemctl stop firewalld
Prepare the docker-compose as shown below and run the container.
version: '2'
services:
nfs:
image: 'hdac/bridgenode:nfsserver_v09'
stdin_open: true
privileged: true
tty: true
network_mode: "host"
volumes:
- /opt/shareLib:/opt/shareLib
container_name: nfsserver
working_dir: /opt
command: init
After running the container, you can see that the /opt/shareLib directory on the host is created and the libraries are shared.
If the shared library has been created successfully, modify the compose file of other containers as shown below.
version: '2'
services:
webserver:
image: 'hdac/bridgenode:webserver_v09'
privileged: true
tty: true
network_mode: "host"
container_name: webserver
command: init
working_dir: /opt
volumes:
- lib-share:/opt/shareLib
depends_on:
- databases
databases:
image: 'hdac/bridgenode:database_v09'
privileged: true
tty: true
network_mode: "host"
container_name: databases
command: init
working_dir: /home
anchor:
image: 'hdac/bridgenode:anchoring_v09'
stdin_open: true
privileged: true
network_mode: "host"
tty: true
container_name: anchoring
command: init
working_dir: /opt
volumes:
- lib-share:/opt/anchor/shareLib:ro
depends_on:
- webserver
contract:
image: 'hdac/bridgenode:contract_v09'
privileged: true
tty: true
network_mode: "host"
container_name: contract
command: init
working_dir: /opt
volumes:
- lib-share:/opt/contract/shareLib:ro
depends_on:
- webserver
volumes:
lib-share:
driver: local
driver_opts:
type: nfs
o: "addr=127.0.0.1,rw"
device: ":/opt/shareLib"
Settings for the nfs volume have been added and the nfs 'addr' value is set to the IP of the host that ran the nfsserver image.
If all containers have been run successfully, check the library sharing success for each container.
webserver : /opt/shareLib
contract : /opt/contract/shareLib
anchoring : /opt/anchor/shareLib
Copyright(c) 2018-2019 hdactech.com.
The original code is distributed based on the MIT software license.
Content type
Image
Digest
Size
205.7 MB
Last updated
over 7 years ago
docker pull hdac/bridgenode:nfsserver_v09