-
Notifications
You must be signed in to change notification settings - Fork 1
Develop
We use docker images for sawtooth-uom development so the definitions below assume Docker and Docker Compose have been installed.
The following instructions will get you setup and leverage tools included as part of the sawtooth-uom repository.
The core repo is the source for compiling the SDK. It would seem this step may be optional as the sdk pacages are available from Python package repositories.
- Clone the latest
sawtooth-core
repository - Go to the root directory of the repo
cd ~\sawtooth-core
- At a minimum do
bin\build_all -l python
Get the repository, setup dependencies and generate protobuf files
- Install Docker and Docker Compose
- Clone the latest
sawtooth-uom
repository - Change into the repo directory and generate the protobuff files. You may need to install google python protobuff compiler
pip3 install grpcio
pip3 install grpcio-tools
cd ~/sawtooth-uom
bin/protogen
There are a number of docker composition files in the repo root. These are meant to support the lifecycle of code development to production ready deployments.
The following uses the docker-dev-compose.yaml
to do a development build of sawtooth-uom. The uom-tp
image mounts the source code on the host machine and includes the pudb
debugger. This allows code inspection and problem solving with any changes to the source are save to the host machine.
;
; To initiate the setup of the uom-tp image and bring up the network
;
cd ~/sawtooth-uom
docker-compose -f ./docker-dev-compose.yaml up
;
; docker image construction messages ommited
;
; After a few seconds of setting up the containers, the network will be brought up and
; the screen will start to display various sawtooth component log messages. Towards
; the end of the initial startup messages you will something similar to the following
; indicating a succesful setup:
sawtooth-validator-local | [2018-02-01 04:28:20.217 INFO processor_handlers]
registered transaction processor: connection_id=ee6cae15e2858c44a3f6de61e14b33ca
36dc1b437c39b64ff1f97c0b9909671741f67a5aae77081acd8bd080701bf4eb096f6cad0096b533
bed3442cc8a10147, family=sawtooth_uom, version=1.0, namespaces=['000000']
Subsequent executions will not take as long to initialize unless you change the sawtooth-uom docker configuration.
Any of the running components can be shelled into from additional bash shell windows:
; Shell into the running uom-processor and open
; to /devprj/sawtooth-uom
docker exec -it uom-processor bash
root@2fd6faa664fc:/devprj/sawtooth-uom#
; In another bash shell for the uom-shell image, open
; to /devprj/sawtooth-uom
docker exec -it uom-shell bash
root@0be7c748eae3:/devprj/sawtooth-uom#
To stop the processing, exit out of any shelled images, return to the composition window and type Ctrl+C in the shell you started it from. When the shutdown completes clean up the docker-compose artifacts
; To stop the processing type Ctrl+C in the shell you started it from.
; When the shutdown completes clean up the docker-compose artifacts
docker-compose -f ./docker-dev-compose.yaml down
UNDER CONSTRUCTION:
Add an test_tp_settings_override.yaml file with the following content to prevent the test container from exiting.
version: "2.1"
services:
test-tp-settings:
command: ["tail", "-f", "/dev/null"]
Run the following command in one shell.
export SAWTOOTH_CORE=$(pwd)
export ISOLATION_ID=latest
docker-compose -p latest -f ./families/settings/tests/test_tp_settings.yaml -f ./families/settings/tests/test_tp_settings_override.yaml up
In a second shell run the following command to open a shell to the test container.
docker-compose -p latest -f ./families/settings/tests/test_tp_settings.yaml exec test-tp-settings bash
Run python3 in the container and then execute a test.
>>> import unittest
>>> from test_tp_settings import *
>>> ts=unittest.TestSuite()
>>> ts.addTest(TestSettings('test_allow_set_authorized_keys_when_initially_empty'))
>>> tr=unittest.TestResult()
>>> ts.run(tr)
Export PYTHONPATH to the python module folders.
export PYTHONPATH=${PYTHONPATH}:/project/sawtooth-core/families/settings:/project/sawtooth-core/families/settings/sawtooth_settings:/project/sawtooth-core/sdkpythonbuildlib:/project/sawtooth-core/sdk/python/build/lib:/project/sawtooth-core/signing/build/lib