mirror of https://github.com/nucypher/nucypher.git
Removes federated demos and supporting automation
parent
a760d9a5e5
commit
50059c3622
|
@ -1,29 +0,0 @@
|
|||
name: '👷 Run Demo'
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
branches:
|
||||
- main
|
||||
- development
|
||||
|
||||
jobs:
|
||||
run-demo:
|
||||
timeout-minutes: 10
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- uses: actions/setup-python@v4
|
||||
with:
|
||||
python-version: '3.7'
|
||||
|
||||
- name: Install docker compose
|
||||
run: pip3 install docker-compose
|
||||
|
||||
- name: Start containers
|
||||
run: docker-compose -f ./scripts/ci/docker-compose.yml build nucypher-ci-dev
|
||||
|
||||
- name: Run demo ursula fleet, finnegan's wake demo
|
||||
run: ./scripts/ci/run_finnegans_wake_demo_docker-ci.sh
|
|
@ -1,130 +0,0 @@
|
|||
version: '3'
|
||||
|
||||
# runs 8 ursulas, each on a different "host"
|
||||
# similar to real world conditions
|
||||
|
||||
# ex. docker-compose -f 8-federated-ursulas.yml up
|
||||
|
||||
services:
|
||||
nucypher-dev:
|
||||
volumes:
|
||||
- ../..:/code
|
||||
ports:
|
||||
- 11500
|
||||
build:
|
||||
context: ../..
|
||||
dockerfile: dev/docker/Dockerfile
|
||||
image: dev:nucypher
|
||||
networks:
|
||||
nucypher_net:
|
||||
ipv4_address: 172.28.1.0
|
||||
container_name: nucypher-dev
|
||||
ursula1:
|
||||
volumes:
|
||||
- ../..:/code
|
||||
ports:
|
||||
- 11500
|
||||
image: dev:nucypher
|
||||
command: nucypher ursula run --dev --federated-only --rest-host 172.28.1.1 --rest-port 11500
|
||||
networks:
|
||||
nucypher_net:
|
||||
ipv4_address: 172.28.1.1
|
||||
container_name: ursula1
|
||||
ursula2:
|
||||
volumes:
|
||||
- ../..:/code
|
||||
ports:
|
||||
- 11500
|
||||
image: dev:nucypher
|
||||
depends_on:
|
||||
- ursula1
|
||||
command: nucypher ursula run --dev --federated-only --rest-host 172.28.1.2 --rest-port 11500 --teacher 172.28.1.1:11500
|
||||
networks:
|
||||
nucypher_net:
|
||||
ipv4_address: 172.28.1.2
|
||||
container_name: ursula2
|
||||
ursula3:
|
||||
volumes:
|
||||
- ../..:/code
|
||||
ports:
|
||||
- 11500
|
||||
image: dev:nucypher
|
||||
depends_on:
|
||||
- ursula1
|
||||
command: nucypher ursula run --dev --federated-only --rest-host 172.28.1.3 --rest-port 11500 --teacher 172.28.1.1:11500
|
||||
networks:
|
||||
nucypher_net:
|
||||
ipv4_address: 172.28.1.3
|
||||
container_name: ursula3
|
||||
ursula4:
|
||||
volumes:
|
||||
- ../..:/code
|
||||
ports:
|
||||
- 11500
|
||||
image: dev:nucypher
|
||||
depends_on:
|
||||
- ursula1
|
||||
command: nucypher ursula run --dev --federated-only --rest-host 172.28.1.4 --rest-port 11500 --teacher 172.28.1.1:11500
|
||||
networks:
|
||||
nucypher_net:
|
||||
ipv4_address: 172.28.1.4
|
||||
container_name: ursula4
|
||||
ursula5:
|
||||
volumes:
|
||||
- ../..:/code
|
||||
ports:
|
||||
- 11500
|
||||
image: dev:nucypher
|
||||
depends_on:
|
||||
- ursula1
|
||||
command: nucypher ursula run --dev --federated-only --rest-host 172.28.1.5 --rest-port 11500 --teacher 172.28.1.1:11500
|
||||
networks:
|
||||
nucypher_net:
|
||||
ipv4_address: 172.28.1.5
|
||||
container_name: ursula5
|
||||
ursula6:
|
||||
volumes:
|
||||
- ../..:/code
|
||||
ports:
|
||||
- 11500
|
||||
image: dev:nucypher
|
||||
depends_on:
|
||||
- ursula1
|
||||
command: nucypher ursula run --dev --federated-only --rest-host 172.28.1.6 --rest-port 11500 --teacher 172.28.1.1:11500
|
||||
networks:
|
||||
nucypher_net:
|
||||
ipv4_address: 172.28.1.6
|
||||
container_name: ursula6
|
||||
ursula7:
|
||||
volumes:
|
||||
- ../..:/code
|
||||
ports:
|
||||
- 11500
|
||||
image: dev:nucypher
|
||||
depends_on:
|
||||
- ursula1
|
||||
command: nucypher ursula run --dev --federated-only --rest-host 172.28.1.7 --rest-port 11500 --teacher 172.28.1.1:11500
|
||||
networks:
|
||||
nucypher_net:
|
||||
ipv4_address: 172.28.1.7
|
||||
container_name: ursula7
|
||||
ursula8:
|
||||
volumes:
|
||||
- ../..:/code
|
||||
ports:
|
||||
- 11500
|
||||
image: dev:nucypher
|
||||
depends_on:
|
||||
- ursula1
|
||||
command: nucypher ursula run --dev --federated-only --rest-host 172.28.1.8 --rest-port 11500 --teacher 172.28.1.1:11500
|
||||
networks:
|
||||
nucypher_net:
|
||||
ipv4_address: 172.28.1.8
|
||||
container_name: ursula8
|
||||
|
||||
networks:
|
||||
nucypher_net:
|
||||
ipam:
|
||||
driver: default
|
||||
config:
|
||||
- subnet: 172.28.0.0/16
|
|
@ -1,35 +0,0 @@
|
|||
FROM nucypher/rust-python:3.9.9
|
||||
ENV PYTHONUNBUFFERED 1
|
||||
ENV PYTHONPATH /code
|
||||
|
||||
# Update
|
||||
RUN apt-get update -y && apt-get upgrade -y && apt-get install patch gcc libffi-dev wget git -y
|
||||
|
||||
# make an install directory
|
||||
RUN mkdir /install
|
||||
WORKDIR /install
|
||||
|
||||
# copy only the exact files needed for install into the container
|
||||
COPY ./nucypher/__about__.py /install/nucypher/
|
||||
COPY README.md /install
|
||||
COPY setup.py /install
|
||||
COPY ./nucypher/blockchain/eth/sol/__conf__.py /install/nucypher/blockchain/eth/sol/__conf__.py
|
||||
COPY scripts/installation/install_solc.py /install/scripts/installation/
|
||||
COPY dev-requirements.txt /install
|
||||
COPY requirements.txt /install
|
||||
COPY docs-requirements.txt /install
|
||||
COPY dev/docker/scripts/install/entrypoint.sh /install
|
||||
|
||||
# install reqs and solc
|
||||
RUN pip install --upgrade pip
|
||||
RUN pip3 install .[dev] --src /usr/local/src
|
||||
RUN pip3 install ipdb
|
||||
|
||||
# puts the nucypher executable in bin path
|
||||
RUN python3 /install/setup.py develop
|
||||
|
||||
# now install solc
|
||||
RUN python3 /install/scripts/installation/install_solc.py
|
||||
|
||||
# this gets called after volumes are mounted and so can modify the local disk
|
||||
CMD ["/install/entrypoint.sh"]
|
|
@ -1,38 +0,0 @@
|
|||
### Developing with Docker
|
||||
|
||||
The intention of the Docker configurations in this directory is to enable anyone to develop and test NuCypher on all major operating systems with minimal prerequisites and installation hassle.
|
||||
|
||||
#### quickstart
|
||||
|
||||
* install [Docker](https://docs.docker.com/install/)
|
||||
* install [Docker Compose](https://docs.docker.com/compose/install/)
|
||||
* cd to dev/docker (where this README is located)
|
||||
* `docker-compose up --build` **this must be done once to complete install**
|
||||
|
||||
|
||||
Then you can do things like:
|
||||
* run the tests:
|
||||
`docker-compose run nucypher-dev pytest`
|
||||
* start up an ursula:
|
||||
`docker-compose run nucypher-dev nucypher ursula run --dev --federated-only`
|
||||
* open a shell:
|
||||
`docker-compose run nucypher-dev bash`
|
||||
|
||||
* try some of the scripts in `dev/docker/scripts/`
|
||||
|
||||
**tested on (Ubuntu 16, MacOS 10.14, Windows 10)*
|
||||
|
||||
From there you can develop, modify code, test as normal.
|
||||
|
||||
### other cases
|
||||
|
||||
* run a network of 8 independent Ursulas
|
||||
`docker-compose -f 8-federated-ursulas.yml up`
|
||||
* get the local ports these ursulas will be exposed on
|
||||
`docker ps`
|
||||
* to stop them...
|
||||
`docker-compose -f 8-federated-ursulas.yml stop`
|
||||
|
||||
## Pycharm (pro version only)
|
||||
* You can configure pycharm to use the python interpreter inside docker.
|
||||
* docs for this are [here](https://www.jetbrains.com/help/pycharm/using-docker-compose-as-a-remote-interpreter.html#docker-compose-remote)
|
|
@ -1,16 +0,0 @@
|
|||
version: '3'
|
||||
|
||||
services:
|
||||
nucypher-dev:
|
||||
volumes:
|
||||
- ../..:/code
|
||||
ports:
|
||||
- 10151:10151
|
||||
build:
|
||||
context: ../..
|
||||
dockerfile: dev/docker/Dockerfile
|
||||
image: dev:nucypher
|
||||
container_name: nucypher-dev
|
||||
working_dir: /code
|
||||
environment:
|
||||
- PYTHONBREAKPOINT=ipdb.set_trace
|
|
@ -1,10 +0,0 @@
|
|||
#!/bin/bash
|
||||
|
||||
# runs inside docker container with access to local volume.
|
||||
# needed for local development, creates nucypher.egg-info on local disk
|
||||
# if it doesn't exist.
|
||||
|
||||
if [ ! -e /code/nucypher.egg-info ]; then
|
||||
echo "First time install..."
|
||||
python setup.py develop
|
||||
fi
|
|
@ -1 +0,0 @@
|
|||
docker-compose run nucypher-dev bash
|
|
@ -1,2 +0,0 @@
|
|||
#!/bin/bash
|
||||
docker-compose run nucypher-dev bash
|
|
@ -1 +0,0 @@
|
|||
docker-compose run nucypher-dev pytest $args
|
|
@ -1,3 +0,0 @@
|
|||
#!/bin/bash
|
||||
args="$@"
|
||||
docker-compose run nucypher-dev pytest $args
|
|
@ -1 +0,0 @@
|
|||
docker-compose run nucypher-dev nucypher ursula run --dev --federated-only
|
|
@ -1,2 +0,0 @@
|
|||
#!/bin/bash
|
||||
docker-compose run nucypher-dev nucypher ursula run --dev --federated-only
|
|
@ -3,11 +3,6 @@
|
|||
This illustrates Alice sharing data with Bob over the Threshold Network using proxy re-encryption (PRE),
|
||||
without revealing private keys to intermediary entities. For more detailed information see the [official documentation](https://docs.nucypher.com/en/latest/).
|
||||
|
||||
There are two version of the example, one using the decentralized network (ethereum/polygon),
|
||||
and a federated example using a local network.
|
||||
|
||||
### Decentralized Network Demo
|
||||
|
||||
First, configure the demo by making exporting environment variables
|
||||
with your provider and wallet details.
|
||||
|
||||
|
|
|
@ -1,21 +1,3 @@
|
|||
"""
|
||||
This file is part of nucypher.
|
||||
|
||||
nucypher is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
nucypher is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with nucypher. If not, see <https://www.gnu.org/licenses/>.
|
||||
"""
|
||||
|
||||
|
||||
import datetime
|
||||
import os
|
||||
from getpass import getpass
|
||||
|
@ -26,7 +8,7 @@ import maya
|
|||
from nucypher.blockchain.eth.signers.base import Signer
|
||||
from nucypher.characters.lawful import Alice, Bob
|
||||
from nucypher.characters.lawful import Enrico as Enrico
|
||||
from nucypher.crypto.powers import SigningPower, DecryptingPower
|
||||
from nucypher.crypto.powers import DecryptingPower, SigningPower
|
||||
from nucypher.policy.payment import SubscriptionManagerPayment
|
||||
from nucypher.utilities.ethereum import connect_web3_provider
|
||||
from nucypher.utilities.logging import GlobalLoggerSettings
|
||||
|
|
|
@ -25,7 +25,7 @@ from pathlib import Path
|
|||
import maya
|
||||
|
||||
from nucypher.blockchain.eth.signers import Signer
|
||||
from nucypher.characters.lawful import Bob, Alice
|
||||
from nucypher.characters.lawful import Alice, Bob
|
||||
from nucypher.policy.payment import SubscriptionManagerPayment
|
||||
from nucypher.utilities.ethereum import connect_web3_provider
|
||||
from nucypher.utilities.logging import GlobalLoggerSettings
|
||||
|
@ -116,6 +116,7 @@ print("The policy public key for "
|
|||
# In this example, we create a local file with encrypted data, containing
|
||||
# heart rate measurements from a heart monitor
|
||||
import heart_monitor
|
||||
|
||||
heart_monitor.generate_heart_rate_samples(policy_pubkey,
|
||||
samples=50,
|
||||
save_as_file=True)
|
||||
|
@ -125,12 +126,13 @@ heart_monitor.generate_heart_rate_samples(policy_pubkey,
|
|||
# To do so, she needs the public key of the recipient.
|
||||
# In this example, we generate it on the fly (for demonstration purposes)
|
||||
from doctor_keys import get_doctor_pubkeys
|
||||
|
||||
doctor_pubkeys = get_doctor_pubkeys()
|
||||
|
||||
# We create a view of the Bob who's going to be granted access.
|
||||
doctor_strange = Bob.from_public_keys(verifying_key=doctor_pubkeys['sig'],
|
||||
encrypting_key=doctor_pubkeys['enc'],
|
||||
federated_only=True)
|
||||
doctor_strange = Bob.from_public_keys(
|
||||
verifying_key=doctor_pubkeys["sig"], encrypting_key=doctor_pubkeys["enc"]
|
||||
)
|
||||
|
||||
# Here are our remaining Policy details, such as:
|
||||
# - Policy expiration date
|
||||
|
|
|
@ -1,21 +1,3 @@
|
|||
"""
|
||||
This file is part of nucypher.
|
||||
|
||||
nucypher is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
nucypher is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with nucypher. If not, see <https://www.gnu.org/licenses/>.
|
||||
"""
|
||||
|
||||
|
||||
import base64
|
||||
import json
|
||||
import shutil
|
||||
|
@ -23,7 +5,7 @@ from timeit import default_timer as timer
|
|||
|
||||
import maya
|
||||
import msgpack
|
||||
from nucypher_core import MessageKit, EncryptedTreasureMap
|
||||
from nucypher_core import EncryptedTreasureMap, MessageKit
|
||||
from nucypher_core.umbral import PublicKey
|
||||
|
||||
from nucypher.characters.lawful import Bob
|
||||
|
|
|
@ -1,24 +1,7 @@
|
|||
"""
|
||||
This file is part of nucypher.
|
||||
|
||||
nucypher is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
nucypher is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with nucypher. If not, see <https://www.gnu.org/licenses/>.
|
||||
"""
|
||||
|
||||
import json
|
||||
from pathlib import Path
|
||||
|
||||
from nucypher_core.umbral import SecretKey, PublicKey
|
||||
from nucypher_core.umbral import PublicKey, SecretKey
|
||||
|
||||
DOCTOR_PUBLIC_JSON = Path('doctor.public.json')
|
||||
DOCTOR_PRIVATE_JSON = Path('doctor.private.json')
|
||||
|
|
|
@ -1,27 +1,10 @@
|
|||
"""
|
||||
This file is part of nucypher.
|
||||
|
||||
nucypher is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
nucypher is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with nucypher. If not, see <https://www.gnu.org/licenses/>.
|
||||
"""
|
||||
|
||||
import random
|
||||
import time
|
||||
|
||||
import msgpack
|
||||
|
||||
from nucypher.characters.lawful import Enrico
|
||||
|
||||
|
||||
HEART_DATA_FILENAME = 'heart_data.msgpack'
|
||||
|
||||
|
||||
|
|
|
@ -1,67 +0,0 @@
|
|||
"""
|
||||
This file is part of nucypher.
|
||||
|
||||
nucypher is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
nucypher is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with nucypher. If not, see <https://www.gnu.org/licenses/>.
|
||||
"""
|
||||
|
||||
import os
|
||||
import shutil
|
||||
from functools import partial
|
||||
from pathlib import Path
|
||||
|
||||
from twisted.internet import reactor
|
||||
from contextlib import suppress
|
||||
|
||||
from nucypher.characters.lawful import Ursula
|
||||
from nucypher.config.constants import APP_DIR, TEMPORARY_DOMAIN
|
||||
from nucypher.utilities.networking import LOOPBACK_ADDRESS
|
||||
|
||||
FLEET_POPULATION = 12
|
||||
DEMO_NODE_STARTING_PORT = 11500
|
||||
USER_CACHE = Path(APP_DIR.user_cache_dir)
|
||||
|
||||
ursula_maker = partial(Ursula, rest_host=LOOPBACK_ADDRESS,
|
||||
federated_only=True,
|
||||
domain=TEMPORARY_DOMAIN)
|
||||
|
||||
|
||||
def spin_up_federated_ursulas(quantity: int = FLEET_POPULATION):
|
||||
# Ports
|
||||
starting_port = DEMO_NODE_STARTING_PORT
|
||||
ports = list(map(str, range(starting_port, starting_port + quantity)))
|
||||
ursulas = []
|
||||
|
||||
sage = ursula_maker(rest_port=ports[0])
|
||||
|
||||
ursulas.append(sage)
|
||||
for index, port in enumerate(ports[1:]):
|
||||
u = ursula_maker(
|
||||
rest_port=port,
|
||||
seed_nodes=[sage.seed_node_metadata()],
|
||||
start_learning_now=True,
|
||||
)
|
||||
ursulas.append(u)
|
||||
|
||||
for u in ursulas:
|
||||
deployer = u.get_deployer()
|
||||
deployer.addServices()
|
||||
deployer.catalogServers(deployer.hendrix)
|
||||
deployer.start()
|
||||
print(f"{u}: {deployer._listening_message()}")
|
||||
|
||||
reactor.run()
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
spin_up_federated_ursulas()
|
Loading…
Reference in New Issue