hyperledger-iroha / iroha-python

Python library for Hyperledger Iroha, a simple distributed ledger.
https://wiki.hyperledger.org/display/iroha
Apache License 2.0
103 stars 81 forks source link

Added Dockerfile to test iroha-python (Iroha 1) in various distros #123

Closed baziorek closed 2 years ago

baziorek commented 2 years ago

Some time ago I added some features then created release: 1.4.0. Unfortunately despite working in my OS (Manjaro) it was not working in Ubuntu servers. So I repaired its: https://github.com/hyperledger/iroha-python/pull/104 But this time I wanted to make sure it will work in Manjaro and also in supported Ubuntu LTS, to make the task easier I've created Dockerfile.

The Dockerfile can be useful:

  1. When adding changes to protobufs in Iroha 1 (it will rather not happen, but maybe Iroha-Core maintainers would agree for internship project in next year)
  2. The Dockerfile with some modifications can help in iroha-python development for Iroha 2.

    Tests (checked if output as expected):

    
    docker build . --file Dockerfile_to_test_various_versions_of_library --build-arg 'SYSTEM=ubuntu' --build-arg 'SYSTEM_VERSION=20.04' --tag iroha-python-test:ubuntu_20.04
    docker run --rm --network=host iroha-python-test:ubuntu_20.04

docker build . --file Dockerfile_to_test_various_versions_of_library --build-arg 'SYSTEM=ubuntu' --build-arg 'SYSTEM_VERSION=22.04' --tag iroha-python-test:ubuntu_22.04 docker run --rm --network=host iroha-python-test:ubuntu_22.04

docker build . --file Dockerfile_to_test_various_versions_of_library --build-arg 'SYSTEM=manjarolinux/base' --build-arg 'SYSTEM_VERSION=20220807' --tag iroha-python-test:manjaro_20220807 docker run --rm --network=host iroha-python-test:manjaro_20220807

baziorek commented 2 years ago

"Review" from chat: https://t.me/hyperledgeriroha/24326


My answer to @6r1d:

You are right that Linux distribution and its version as argument would cause much more memory consumption than just testing in the same system with different library. Few months ago I'd not try to have OS as argument. But unfortunately when I faced problem with protobuf -the best option to do is to have distribution configurable, because there are lots of dependencies, not only in Python but also libproto in system. To be more specific I'm going to describe how I was fighting with releases:

  1. In release https://github.com/hyperledger/iroha-python/releases/tag/1.4.0 I've generated python files from protobuf in my system (Manjaro) - everything was working in my computer, I was happy. Unfortunately when I tried to use the library in Ubuntu Server 21.04 - it was not working.
  2. So I've regenerated in Ubuntu 21.04 - and everything was working in Ubuntu 21.04, but it was not in Manjaro.
  3. What was working everywhere was to generate in Ubuntu 20.04 and also to add extra settings in setup.py

    In future I'm thinking about one more internship project (if Alexander agrees): add optional description to AddAssetQuantity and RemoveAssetQuantity and optionally new command: RemoveAccountDetail. Those changes would require changing protobuf. It would be good to have possibility to test its in multiple operating systems (especially because versions of packages like libproto would be different than now)