How to run first blockchain hello world program!

I assume that you have read a lot about the block chain technology and where it can be applied. Now you must be wondering where should I develop the Smart Contract and run the program

Do I need to,

  • Spent Ether to run program on Ethereum main network to test it
  • Download the Ethereum wallet and connect to Ropsten or Rinkeby  test network? Even if you connect to it and download the data from the peers you will find difficulty to execute the program.

Answer is no

Here are the simple steps you need to follow in order to run your first Hello World! etherum smart contract.

Overall Architecture

Step 1 : Setting up testrpc virtual environment

Download the Ethereumjs test rpc Docker image & run it. If you haven’t already installed docker engine follow this instruction.

docker pull silentinfotech/ethereumjs-testrpc
docker run -d -p 8545:8545 silentinfotech/ethereumjs-testrpc:latest -a 10 --debug

When you run the docker it will start the docker container and will forward port 8545 to it.  testrpc is Node.js based ethereum client for development and testing.  Find more information on testrpc from here

Step 2 : Remix IDE

We will use the remix IDE for the ethereum smart contract( In developer language program) development. Navigate to https://remix.ethereum.org/ and allow unsafe script to load.

As a part of first program, We will run hello world “Your first citizen: the greeter” program from ethereum.org. Find more information about hello world program from here

Step 3 : Copy & Paste Hello world contract

Copy “Your first citizen: the greeter” program and paste it on remix IDE window. Contract will be compiled automatically if Auto compile is selected already. Ignore the warning(s) for now.

Hello world block chain program at Remix IDE

Step 4 : Run program

Navigate to Run tab from top right corner.  Choose Web3 Provider as environment. Enter appropriate URL – if you are running docker on local computer you won’t need to change the url. We are now connected to testrpc ethereum test environment. We can find the account dropdown auto populated with all test accounts with having 100EHR by default – which are more than sufficient to run the program. 😉

Let’s run the program,

Pass the constructor parameters in create method(e.g “Hello world!”. Click on create, Wow!!! we have generated a first block. You can even call the greet method on newly created block.

You can also read the existing blocks methods/variables by providing block address in At Address text field.

Ethereum Network Charges

In a nutshell, you will be charged when ever you/program will change the state of the variable. e.g Increment value of variable, store the value in variable, destroy value of variable. there is no charge for reading the blocks.

References

https://remix.ethereum.org/

https://www.ethereum.org/greeter

 

Odoo won’t start after pysftp installed

Environment

  • UBUNTU 16.04
  • Odoo 9

Problem

Today I came across the situation where after installing pysftp suddenly I won’t be able to start odoo again. I have tried to do

service odoo restart
service odoo stop ; service odoo start

When I have tried to uninstall pysftp, I was having SSL_ST_INIT error

root@erp:~# pip uninstall pysftp
Traceback (most recent call last):
 File "/usr/bin/pip", line 9, in <module>
 from pip import main
 File "/usr/lib/python2.7/dist-packages/pip/__init__.py", line 13, in <module>
 from pip.exceptions import InstallationError, CommandError, PipError
 File "/usr/lib/python2.7/dist-packages/pip/exceptions.py", line 6, in <module>
 from pip._vendor.six import iteritems
 File "/usr/lib/python2.7/dist-packages/pip/_vendor/__init__.py", line 64, in <module>
 vendored("cachecontrol")
 File "/usr/lib/python2.7/dist-packages/pip/_vendor/__init__.py", line 36, in vendored
 __import__(modulename, globals(), locals(), level=0)
 File "/usr/share/python-wheels/CacheControl-0.11.5-py2.py3-none-any.whl/cachecontrol/__init__.py", line 9, in <module>
 File "/usr/share/python-wheels/CacheControl-0.11.5-py2.py3-none-any.whl/cachecontrol/wrapper.py", line 1, in <module>
 File "/usr/share/python-wheels/CacheControl-0.11.5-py2.py3-none-any.whl/cachecontrol/adapter.py", line 3, in <module>
 File "/usr/share/python-wheels/requests-2.9.1-py2.py3-none-any.whl/requests/__init__.py", line 53, in <module>
 File "/usr/share/python-wheels/urllib3-1.13.1-py2.py3-none-any.whl/urllib3/contrib/pyopenssl.py", line 54, in <module>
 File "/usr/lib/python2.7/dist-packages/OpenSSL/__init__.py", line 8, in <module>
 from OpenSSL import rand, crypto, SSL
 File "/usr/lib/python2.7/dist-packages/OpenSSL/SSL.py", line 118, in <module>
 SSL_ST_INIT = _lib.SSL_ST_INIT
AttributeError: 'module' object has no attribute 'SSL_ST_INIT'

Solution

Step 1: Backup existing directory on OpenSSL and pyOpenSSL from dist-packages folder.

cp -r /usr/lib/python2.7/dist-packages/OpenSSL /tmp/
cp -r /usr/lib/python2.7/dist-packages/pyOpenSSL-0.15.1.egg-info /tmp/

Step 2: Remove directory OpenSSL and pyOpenSSL from dist-packages folder and install pyopenssl module

# rm -rf /usr/lib/python2.7/dist-packages/OpenSSL 
# rm -rf /usr/lib/python2.7/dist-packages/pyOpenSSL-0.15.1.egg-info 
# sudo pip install pyopenssl

Step 3: Start odoo service.

How to connect to PPTP server from linux

How you could connect to PPTP server from linux to access your office network?

  • Goto Edit Connections -> Add New Connection

  • Choose Point-to-Point Tunneling Protocol (PPTP) as connection type

  • Provide the information you have received from your company administration team( e.g Gateway, User name, Password, NT Domain(Optional)) and save it

  • New connection with connection name will be available to dial under the connection manager -> VPN Connections -> Office VPN Connection(in our case)

DMA Radius : How to repair "Incorrect key file for table ‘./conntrack/xxxx@xxxxxx@xxxxxx.MYI’"

Some times if your production server goes down due to power failure you might face below error while accessing “Connection Tracking Reports” in Radius manager.

Incorrect key file for table ‘./conntrack/2017@002d06@002d04.MYI’. try to repair it

Follow below mentioned steps to resolve issue.

How to repair table[Ubuntu]?

Go to database folder

cd /var/lib/mysql/conntrack
service mysql stop
myisamchk -r -v -f 2017\@002d06\@002d04.MYI
service mysql start

# don’t forgot to change table name

How to repair table[Centos]?

Go to database folder

cd /var/lib/mysql/conntrack
service mysqld stop
myisamchk -r -v -f 2017\@002d06\@002d04.MYI
service mysqld start

# don’t forgot to change table name

Recommendations

  • Use SSD or RAID based storage for faster IO and make sure you have plenty of disk space.
  • Use separate host for Connection Tracking database for better performance
  • Follow mysql performance tuning guide line https://www.mysql.com/why-mysql/performance/

Odoo Cluster Setup on Rancher

At Silent Infotech we have successfully deployed odoo cluster using rancher platform in order to mange the huge number of users and good amount of concurrent user load.

What is Rancher?

Rancher is designed to solve all of the critical challenges necessary to run all of your applications in containers. Rancher provides a full set of infrastructure services for containers, including networking, storage services, host management, load balancing and more. All of these services work across any infrastructure, and make it simple to reliably deploy and manage applications.

What is docker?

Docker containers wrap up a piece of software in a complete File System that contains everything it needs to run: code, runtime, system tools, system libraries – anything you can install on a server. This guarantees that it will always run the same, regardless of the environment it is running in.

odoo-cluster-using-rancher
Odoo cluster setup

Odoo Cluster Architecture

Odoo cluster has been setup using below set of containers/docker instances

  • 3 X Odoo Instances
  • 1 X DB Instance(Postgres)
  • 1 X Load Balancer