[EDITED JUNE-18-2020, UPDATE TO INSTALL DOCKER, WITH SPECIAL THANKS TO MATHIJS KEMP]
In my previous post I described how to write a chaincode for Oracle Blockchain Cloud Service. Sometimes you don't have access to the blockchain cloud service, or you want to test your blockchain locally without deploying it to your production instance.
For that use case, there is good news: you can deploy it on Oracle Cloud Infrastructure.
To make this work you need to do the following:
For that use case, there is good news: you can deploy it on Oracle Cloud Infrastructure.
To make this work you need to do the following:
- Create a compartment for your blockchain (for example SDKBLOCKCHAIN)
- Create a public/private key pair
- Create a VCN
- Create a compute instance
- Install docker
- Build the SDK
- Create blockchain instance (founder)
Create the VCN
see https://docs.cloud.oracle.com/iaas/Content/Network/Tasks/managingVCNs.htm for a detailed explanation of this service in Oracle Cloud Infrastructure.
For this purpose, we create a VCN and related resources.
create VCN dialog in Oracle Cloud Infrastructure |
Next we open up the ports for this VCN so the blockchain console ports are accessible from the internet
- Click on security lists
- Click on the default security list
- Make sure the provisioning page is accessible from the internet by opening port 3000
- Make sure that 500 ports are accessible from the internet (the blockchain SDK will take up to 500 ports)
Ingress rule for ports of Blockchain Console |
Create the Compute instance
Create a compute instance that complies with the following values:
Set the timezone TZ variable
Make sure that you set the TZ variable in your profile, otherwise you will get an error when provisioning the blockchain instance.- vi .bash_profile file
- Add TZ='Europe/Amsterdam'; export TZ to the file
- Save and quit (wq)
- Log out
- Log in
Disable the firewall
Check if the firewall is running: sudo firewall-cmd --state
running
If it is running, stop it:
run the command again: sudo firewall-cmd --state
not running
You can of course update the firewall instead of disabling it, I was too lazy to type that up today 😁
If it is running, stop it:
sudo systemctl disable firewalld
run the command again: sudo firewall-cmd --state
not running
You can of course update the firewall instead of disabling it, I was too lazy to type that up today 😁
Install Docker
Execute the following commands to install some required packages:
sudo yum install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm sudo yum install -y yum-utils device-mapper-persistent-data lvm2
Add the repository
sudo yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
Install the docker community edition
sudo yum install docker-ce docker-ce-cli containerd.io
Start docker and enable the start of docker on boot
sudo systemctl enable --now docker.service
Check the version of docker
sudo docker version
Run hello world to see if docker is installed correctly
docker run hello-world
Build the Instance
Now we are ready to install the SDK
- Download it from the Oracle website
- Unzip to /usr/local/bcssdk
- Run sudo ./build.sh This will run it with all the default:
Create Instance
- Open the console: http://[IP ADDRESS]:3000
- Chose a username and password for your provisioning application and click ok
- This opens the console and you can create a founder with the following attributes:
The username password will be set to admin/Welcome1 when you check the "Authorization" box. The result can be seen below
Finally
Click on the name. This will open a browser, but it will say "not found". Replace the FQDN with the IP address, and leave the port.
When you do that, it warns about the certificate. Accept that and it prompts for username password.
Login using admin/Welcome1 and you will see your blockchain console!
http://[IP ADDRESS]:21003
When you do that, it warns about the certificate. Accept that and it prompts for username password.
Login using admin/Welcome1 and you will see your blockchain console!
http://[IP ADDRESS]:21003
Blockchain console after creating the instance |
Happy coding 😀
No comments:
Post a Comment