Skip to content

Commit

Permalink
INDY-830: Removed Evernym and Sovrin brands (hyperledger#351)
Browse files Browse the repository at this point in the history
* INDY-830: Removed Evernym and Sovrin brands

- Removed Evernym and Sovrin brands from code and documentation.
TODO:
- Remove Evernym and Sovrin brands from code related to node upgrade (where necessary).
- Provide migration scripts for node and client.

* Merge branch 'master' of https://github.com/spivachuk/sovrin-node into rebranding

# Conflicts:
#	docs/Indy_Running_Locally.md

* Updated indy-plenum-dev and indy-anoncreds-dev dependencies.

* - Removed Evernym and Sovrin brands from code related to node upgrade.
- Wrapped the user into a variable in ubuntu.dockerfile.
- Corrected sovrin-environments URL in getting-started.md.
- Removed an outdated reference to the build status from README.md.

* Corrected the URL of the APT repository containing python3-charm-crypto and the key for this repository in ubuntu.dockerfile.

* Rolled back an accidental method renaming.

* INDY-830: Implemented node migration for rebranding sovrin to indy

* INDY-830: Corrected migration script for rebranding sovrin to indy

* INDY-830: Corrected versions in migration script name

* INDY-830: Fixed a bug with use of "~" for referencing indy user home directory in a script being executed on behalf of root user

* INDY-830: Fixed a bug with use of elements of os.listdir result as absolute paths

* INDY-830: Updated indy-anoncreds dependency

* - Added missed scripts to setup.py.
- Made corresponding corrections in postinst_node.

* - Added dependency from "at" deb package to "indy-node" deb package creation command.
- Corrected restart_sovrin_node script (being used for rebranding upgrade).
- Removed indy_node_control.service file from sources (now it is generated on the fly).

* Corrected restart_sovrin_node script (being used for rebranding upgrade).

* Corrected restart_sovrin_node script (being used for rebranding upgrade) once again.

* Added starting atd service to restart_sovrin_node script (being used for rebranding upgrade).

* INDY-830: Added logging to file for node control tool

- Added logging to file in start_node_control_tool.py.
- Made start_node_control_tool logic executable only if the script is run as an entry point.

* Corrected complete_rebranding_upgrade script.

* - Removed logging to file for node control tool (its log is accessible in systemd journal).
- Renamed the script "start_node_control_tool.py" to "start_node_control_tool".

* Removed hashbang from node_control_tool.py.

* Perform renaming to fix diff.

* Perform renaming to fix diff once again.

* INDY-830: Wallet migration for rebranding

- Implemented wallet migration for rebranding.
- Extracted wallet raw updaters from Wallet class.

* INDY-830: Removed redundant action from WalletRawUpdaterToVersion2

* Fixed a bug in WalletRawUpdaterToVersion1 made when extracting updaters from Wallet class.

* INDY-830: Made wallet migrations more resilient

* INDY-830: Test restoring wallet before rebranding

- Added a test verifying restoration of a wallet with GST stuff before rebranding.
- Renamed the module with the test verifying restoration of a wallet with GST stuff before renaming Link to Connection.
- Updated Wallet class version in the test wallet file "tmp_wallet_restore_issue".
- Removed the useless file "test.log".

* INDY-830: Made a minor correction in WalletRawUpdaterToVersion2

* Made corrections after merge with changes from master.

* Corrected the description of indy-node-control systemd service.

* Made corrections after merge with changes from master.

* Updated versions in the last migration script for the node.

* Updated indy-plenum-dev dependency.
  • Loading branch information
spivachuk authored and ashcherbakov committed Oct 2, 2017
1 parent 30087f4 commit f16bead
Show file tree
Hide file tree
Showing 363 changed files with 1,756 additions and 1,606 deletions.
6 changes: 3 additions & 3 deletions .flake8
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ exclude =
# have to skip because the file should be fixed
setup.py,
# lots unused import because of fixtures
sovrin_client/test,
sovrin_node/test,
indy_client/test,
indy_node/test,
# config file
docker-files/sovrin_config.py
docker-files/indy_config.py
max-complexity = 10
4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ before_install:

install:
- pip install -U -e .
- pip install -U sovrin-client
- pip install -U indy-client

script:
- python -m sovrin_node.test
- python -m indy_node.test

before_cache:
- rm -f /opt/orientdb/log/*
Expand Down
6 changes: 3 additions & 3 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ def nodeTestUbuntu = {
testHelpers.install()

echo 'Ubuntu Test: Test'
testHelpers.testRunner([resFile: "test-result-node.${NODE_NAME}.txt", testDir: 'sovrin_node'])
testHelpers.testRunner([resFile: "test-result-node.${NODE_NAME}.txt", testDir: 'indy_node'])
//testHelpers.testJUnit(resFile: "test-result-node.${NODE_NAME}.xml")
}
}
Expand All @@ -40,7 +40,7 @@ def clientTestUbuntu = {
testHelpers.install()

echo 'Ubuntu Test: Test'
testHelpers.testRunner([resFile: "test-result-client.${NODE_NAME}.txt", testDir: 'sovrin_client'])
testHelpers.testRunner([resFile: "test-result-client.${NODE_NAME}.txt", testDir: 'indy_client'])
//testHelpers.testJUnit(resFile: "test-result-client.${NODE_NAME}.xml")
}
}
Expand All @@ -63,7 +63,7 @@ def commonTestUbuntu = {
testHelpers.install()

echo 'Ubuntu Test: Test'
testHelpers.testJUnit([resFile: "test-result-common.${NODE_NAME}.xml", testDir: 'sovrin_common'])
testHelpers.testJUnit([resFile: "test-result-common.${NODE_NAME}.xml", testDir: 'indy_common'])
}
}
finally {
Expand Down
6 changes: 3 additions & 3 deletions Jenkinsfile.cd
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ def nodeTestUbuntu = {
testHelpers.install()

echo 'Ubuntu Test: Test'
testHelpers.testRunner([resFile: "test-result-node.${NODE_NAME}.txt", testDir: 'sovrin_node'])
testHelpers.testRunner([resFile: "test-result-node.${NODE_NAME}.txt", testDir: 'indy_node'])
//testHelpers.testJUnit(resFile: "test-result-node.${NODE_NAME}.xml")
}
}
Expand All @@ -40,7 +40,7 @@ def clientTestUbuntu = {
testHelpers.install()

echo 'Ubuntu Test: Test'
testHelpers.testRunner([resFile: "test-result-client.${NODE_NAME}.txt", testDir: 'sovrin_client'])
testHelpers.testRunner([resFile: "test-result-client.${NODE_NAME}.txt", testDir: 'indy_client'])
//testHelpers.testJUnit(resFile: "test-result-client.${NODE_NAME}.xml")
}
}
Expand All @@ -63,7 +63,7 @@ def commonTestUbuntu = {
testHelpers.install()

echo 'Ubuntu Test: Test'
testHelpers.testJUnit([resFile: "test-result-common.${NODE_NAME}.xml", testDir: 'sovrin_common'])
testHelpers.testJUnit([resFile: "test-result-common.${NODE_NAME}.xml", testDir: 'indy_common'])
}
}
finally {
Expand Down
6 changes: 3 additions & 3 deletions Jenkinsfile.ci
Original file line number Diff line number Diff line change
Expand Up @@ -126,22 +126,22 @@ def tests = [
common: { python ->
test(
resFile: "test-result-common.${NODE_NAME}.xml",
testDir: 'sovrin_common',
testDir: 'indy_common',
python: python
)
},
client: { python ->
test(
resFile: "test-result-client.${NODE_NAME}.txt",
testDir: 'sovrin_client',
testDir: 'indy_client',
python: python,
useRunner: true
)
},
node: { python ->
test(
resFile: "test-result-node.${NODE_NAME}.txt",
testDir: 'sovrin_node',
testDir: 'indy_node',
python: python,
useRunner: true
)
Expand Down
4 changes: 1 addition & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,14 @@

## Indy Node

[![Build Status](https://jenkins.evernym.com/buildStatus/icon?job=Sovrin%20Node/master)](https://jenkins.evernym.com/view/Core/job/Sovrin%20Node/job/master/)

This codebase embodies all the functionality to run nodes--validators and/or observers
that provide a [self-sovereign identity ecosystem](https://sovrin.org) on top of a
distributed ledger. It is the core project for Indy; over time, all other indy-\* projects may
collapse into this one, except for [indy-sdk](https://github.com/hyperledger/indy-sdk).

This code is independent from but commonly associated with [Sovrin](https://sovrin.org). Sovrin is a public utility
for identity, built on top of this codebase. People who install sovrin packages (e.g., with
`sudo apt install sovrin-node`) get prepackaged genesis transactions that integrate a
`sudo apt install sovrin`) get prepackaged genesis transactions that integrate
with an Indy validator pool using [Sovrin's governance and trust framework](https://sovrin.org/wp-content/uploads/2017/06/SovrinProvisionalTrustFramework2017-03-22.pdf). However, it is possible to use Indy Node
with a different network, using whatever conventions a community chooses.

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import pytest
from indy import pool, wallet

from sovrin_acceptance.test.client import Client
from indy_acceptance.test.client import Client


@pytest.fixture
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from indy.error import ErrorCode
from pytest import raises

from sovrin_acceptance.test.constants import TRUSTEE_CODE, STEWARD_CODE,\
from indy_acceptance.test.constants import TRUSTEE_CODE, STEWARD_CODE,\
TGB_CODE, TRUST_ANCHOR_CODE, NO_ROLE_CODE


Expand Down
1 change: 1 addition & 0 deletions build-scripts/ubuntu-1604/build-indy-node.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ fpm --input-type "python" \
--python-bin "/usr/bin/python3" \
--exclude "*.pyc" \
--exclude "*.pyo" \
--depends at \
--no-python-fix-dependencies \
--maintainer "Hyperledger <[email protected]>" \
--before-install "preinst_node" \
Expand Down
85 changes: 45 additions & 40 deletions build-scripts/ubuntu-1604/postinst_node
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,21 @@

# it should be fixed

# workaround when .sovrin become regular file
if [ -f /home/sovrin/.sovrin ]; then
rm /home/sovrin/.sovrin
# workaround when .indy become regular file
if [ -f /home/indy/.indy ]; then
rm /home/indy/.indy
fi
mkdir -p /home/sovrin/.sovrin
mkdir -p /home/indy/.indy

# create sovrin config if not exists
if [ ! -f /home/sovrin/.sovrin/sovrin_config.py ]; then
touch /home/sovrin/.sovrin/sovrin_config.py
# create indy config if not exists
if [ ! -f /home/indy/.indy/indy_config.py ]; then
touch /home/indy/.indy/indy_config.py
fi

chown -R sovrin:sovrin /home/sovrin/.sovrin
chown -R indy:indy /home/indy/.indy

# init_sovrin_node script
cat <<EOF > /usr/local/bin/init_sovrin_node
# init_indy_node script
cat <<EOF > /usr/local/bin/init_indy_node
#!/bin/bash
if [ \$# -lt 3 ]; then
Expand All @@ -30,30 +30,30 @@ if [ \$# -lt 3 ]; then
exit 1;
fi
echo "NODE_NAME=\$1" > /home/sovrin/.sovrin/sovrin.env
echo "NODE_PORT=\$2" >> /home/sovrin/.sovrin/sovrin.env
echo "NODE_CLIENT_PORT=\$3" >> /home/sovrin/.sovrin/sovrin.env
echo "NODE_NAME=\$1" > /home/indy/.indy/indy.env
echo "NODE_PORT=\$2" >> /home/indy/.indy/indy.env
echo "NODE_CLIENT_PORT=\$3" >> /home/indy/.indy/indy.env
if [ -z \$4 ]; then
init_sovrin_keys --name \$1
init_indy_keys --name \$1
else
init_sovrin_keys --name \$1 --seed \$4
init_indy_keys --name \$1 --seed \$4
fi
EOF

chmod +x /usr/local/bin/init_sovrin_node
chmod +x /usr/local/bin/init_indy_node

# add systemd script
cat <<EOF > /etc/systemd/system/sovrin-node.service
cat <<EOF > /etc/systemd/system/indy-node.service
[Unit]
Description=Sovrin Node
Requires=sovrin-node-control.service
Description=Indy Node
Requires=indy-node-control.service
[Service]
EnvironmentFile=/home/sovrin/.sovrin/sovrin.env
ExecStart=/usr/bin/env python3 -O /usr/local/bin/start_sovrin_node \${NODE_NAME} \${NODE_PORT} \${NODE_CLIENT_PORT}
User=sovrin
Group=sovrin
EnvironmentFile=/home/indy/.indy/indy.env
ExecStart=/usr/bin/env python3 -O /usr/local/bin/start_indy_node \${NODE_NAME} \${NODE_PORT} \${NODE_CLIENT_PORT}
User=indy
Group=indy
Restart=on-failure
RestartSec=10
StartLimitBurst=10
Expand All @@ -65,17 +65,17 @@ WantedBy=multi-user.target
EOF


cat <<EOF > /etc/systemd/system/sovrin-node-control.service
cat <<EOF > /etc/systemd/system/indy-node-control.service
[Unit]
Description=Service for upgrade existing Sovrin and another operations
#Requires=sovrin.service
#After=sovrin.service
Description=Service for upgrade of existing Indy Node and other operations
#Requires=indy.service
#After=indy.service
After=network.target
[Service]
Type=simple
EnvironmentFile=/etc/sovrin/node_control.conf
ExecStart=/usr/bin/env python3 -O /usr/local/bin/start_node_control_tool.py \$TEST_MODE --hold-ext \$HOLD_EXT
EnvironmentFile=/etc/indy/node_control.conf
ExecStart=/usr/bin/env python3 -O /usr/local/bin/start_node_control_tool \$TEST_MODE --hold-ext \$HOLD_EXT
Restart=on-failure
RestartSec=10
StartLimitBurst=10
Expand All @@ -86,11 +86,11 @@ TimeoutSec=300
WantedBy=multi-user.target
EOF

mkdir -p /etc/sovrin
mkdir -p /etc/indy

HOLD_EXT_ADDED=$(grep HOLD_EXT /etc/sovrin/node_control.conf)
if [ ! -f /etc/sovrin/node_control.conf ] || [ -z "${HOLD_EXT_ADDED}" ]; then
cat <<EOF > /etc/sovrin/node_control.conf
HOLD_EXT_ADDED=$(grep HOLD_EXT /etc/indy/node_control.conf)
if [ ! -f /etc/indy/node_control.conf ] || [ -z "${HOLD_EXT_ADDED}" ]; then
cat <<EOF > /etc/indy/node_control.conf
# Uncomment this to run agent in test mode:
#TEST_MODE=--test
Expand All @@ -99,19 +99,24 @@ HOLD_EXT=\"\"
EOF
fi

mv /usr/local/bin/upgrade_sovrin_node_ubuntu1604.sh /usr/local/bin/upgrade_sovrin_node
mv /usr/local/bin/upgrade_sovrin_node_ubuntu1604_test.sh /usr/local/bin/upgrade_sovrin_node_test
mv /usr/local/bin/upgrade_indy_node_ubuntu1604.sh /usr/local/bin/upgrade_indy_node
mv /usr/local/bin/upgrade_indy_node_ubuntu1604_test.sh /usr/local/bin/upgrade_indy_node_test
mv /usr/local/bin/restart_indy_node_ubuntu1604.sh /usr/local/bin/restart_indy_node
mv /usr/local/bin/restart_sovrin_node_ubuntu1604.sh /usr/local/bin/restart_sovrin_node
mv /usr/local/bin/complete_rebranding_upgrade_ubuntu1604.sh /usr/local/bin/complete_rebranding_upgrade

chmod +x /usr/local/bin/upgrade_sovrin_node
chmod +x /usr/local/bin/upgrade_sovrin_node_test
chmod +x /usr/local/bin/upgrade_indy_node
chmod +x /usr/local/bin/upgrade_indy_node_test
chmod +x /usr/local/bin/restart_indy_node
chmod +x /usr/local/bin/restart_sovrin_node
chmod +x /usr/local/bin/start_node_control_tool.py
chmod +x /usr/local/bin/complete_rebranding_upgrade

rm -f /usr/local/bin/delete_sovrin_node.bat /usr/local/bin/upgrade_sovrin_node_test.bat /usr/local/bin/restart_sovrin_node.bat /usr/local/bin/install_nssm.bat /usr/local/bin/upgrade_sovrin_node.bat /usr/local/bin/install_sovrin_node.bat
rm -f /usr/local/bin/delete_indy_node.bat /usr/local/bin/upgrade_indy_node_test.bat \
/usr/local/bin/restart_indy_node.bat /usr/local/bin/install_nssm.bat /usr/local/bin/upgrade_indy_node.bat \
/usr/local/bin/install_indy_node.bat /usr/local/bin/restart_upgrade_agent.bat

# disable stdout logging
echo "enableStdOutLogging=False" >> /home/sovrin/.sovrin/sovrin_config.py
echo "enableStdOutLogging=False" >> /home/indy/.indy/indy_config.py


# Automatically added from template:
Expand Down
4 changes: 2 additions & 2 deletions build-scripts/ubuntu-1604/preinst_node
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/bin/bash

if ! id -u sovrin > /dev/null 2>&1; then
useradd -r -m -s /bin/bash -U sovrin
if ! id -u indy > /dev/null 2>&1; then
useradd -r -m -s /bin/bash -U indy
fi
27 changes: 14 additions & 13 deletions ci/ubuntu.dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
FROM ubuntu:16.04

ARG uid=1000
ARG user=indy

# Install environment
RUN apt-get update -y
Expand All @@ -24,18 +25,18 @@ RUN apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 68DB5E88
RUN echo "deb https://repo.sovrin.org/deb xenial master" >> /etc/apt/sources.list
RUN apt-get update -y
RUN apt-get install -y \
python3-charm-crypto
RUN apt-get update -y && apt-get install -y libindy-crypto=0.1.6
RUN useradd -ms /bin/bash -u $uid sovrin
USER sovrin
RUN virtualenv -p python3.5 /home/sovrin/test
RUN cp -r /usr/local/lib/python3.5/dist-packages/Charm_Crypto-0.0.0.egg-info /home/sovrin/test/lib/python3.5/site-packages/Charm_Crypto-0.0.0.egg-info
RUN cp -r /usr/local/lib/python3.5/dist-packages/charm /home/sovrin/test/lib/python3.5/site-packages/charm
RUN mkdir /home/sovrin/.sovrin
python3-charm-crypto \
libindy-crypto=0.1.6
RUN useradd -ms /bin/bash -u $uid $user
USER $user
RUN virtualenv -p python3.5 /home/$user/test
RUN cp -r /usr/local/lib/python3.5/dist-packages/Charm_Crypto-0.0.0.egg-info /home/$user/test/lib/python3.5/site-packages/Charm_Crypto-0.0.0.egg-info
RUN cp -r /usr/local/lib/python3.5/dist-packages/charm /home/$user/test/lib/python3.5/site-packages/charm
RUN mkdir /home/$user/.$user
USER root
RUN ln -sf /home/sovrin/test/bin/python /usr/local/bin/python
RUN ln -sf /home/sovrin/test/bin/pip /usr/local/bin/pip
USER sovrin
RUN ln -sf /home/$user/test/bin/python /usr/local/bin/python
RUN ln -sf /home/$user/test/bin/pip /usr/local/bin/pip
USER $user
# TODO: Automate dependency collection
RUN pip install jsonpickle \
ujson \
Expand All @@ -59,5 +60,5 @@ RUN pip install jsonpickle \
psutil \
intervaltree \
pytest-xdist
ENV PYTHONPATH $PYTHONPATH:/home/sovrin/test/bin
WORKDIR /home/sovrin
ENV PYTHONPATH $PYTHONPATH:/home/$user/test/bin
WORKDIR /home/$user
Loading

0 comments on commit f16bead

Please sign in to comment.