nucypher/docs/source/guides/federated_testnet_guide.rst

309 lines
8.0 KiB
ReStructuredText
Raw Normal View History

2019-01-29 02:11:52 +00:00
=============================================
NuCypher Federated Testnet (NuFT) Setup Guide
=============================================
This guide is for individuals who intend to spin-up and maintain an Ursula node in the early stages of the NuFT
while working with the NuCypher team to improve user experience, comfort, and code-quality of the NuCypher network.
Following the steps will launch a functioning federated-only Ursula node operating from a machine you control.
Before getting started, please note:
* We encourage you to launch your node on a machine that is able to remain online with as few interruptions as possible, for as long as possible. Although it is possible to restart a node, excessive deactivation/reactivation can contribute to a lack of usable feedback from the test network. Additionally, node uptime will be important for proper functioning of Mainnet. Thus, its worthwhile to start working with a reliable machine now so that your nodes are compliant with the network's uptime requirements when the time comes.
* Setup requires knowledge of your machines public-facing IPv4 address and local network configuration. It is advised to use a static IP address since changing IP addresses will require node reconfiguration. Configure port-forwarding rules on port 9151 if you are operating a node behind a firewall. Once successfully up and running, your node will be discoverable by all other nodes in the test network.
* NuFT transmits application errors and crash reports to NuCyphers sentry server. This functionality is enabled by default for NuFT only and will be deactivated by default for mainnet.
2019-01-29 02:11:52 +00:00
.. warning::
The “NuCypher Federated Testnet” (NuFT) is an experimental pre-release of nucypher. Expect bugs, downtime, and unannounced domain-wide restarts. NuFT nodes do not connect to any blockchain. **DO NOT** perform transactions using NuFT node addresses.
2019-01-29 02:11:52 +00:00
.. important::
Exiting the setup process prior to completion may lead to issues/bugs. If you encounter issues, report feedback by opening an Issue on our GitHub (https://github.com/nucypher/nucypher/issues)
2019-01-29 02:11:52 +00:00
Contents
--------
2019-01-29 02:11:52 +00:00
* `Stage A | Install The Nucypher Environment`_
* `Stage B | Configure Ursula`_
* `Stage C | Run the Node (Interactive Method)`_
* `Stage C | Run the Node (System Service Method)`_
2019-01-29 02:11:52 +00:00
Configure a NuFT Node
---------------------
2019-01-29 02:11:52 +00:00
Stage A | Install The Nucypher Environment
------------------------------------------
1. Install Python and Git
2019-01-29 02:11:52 +00:00
If you dont already have them, install Python and git.
As of January 2019, we are working with Python 3.6, 3.7, and 3.8.
2019-01-29 02:11:52 +00:00
* Official Python Website: https://www.python.org/downloads/
* Git Install Guide: https://git-scm.com/book/en/v2/Getting-Started-Installing-Git
2. Create Virtual Environment
2019-01-29 02:11:52 +00:00
Create a system directory for the nucypher application code
2019-01-29 02:11:52 +00:00
.. code::
$ mkdir nucypher
2019-01-29 02:11:52 +00:00
Create a virtual environment for your node to run in using virtualenv
2019-01-29 02:11:52 +00:00
.. code::
$ virtualenv nucypher -p python3
...
2019-01-29 02:11:52 +00:00
Activate your virtual environment
2019-01-29 02:11:52 +00:00
.. code::
$ source nucypher/bin/activate
...
(nucypher)$
3. Install Nucypher
2019-01-29 02:11:52 +00:00
Install nucypher with git and pip3 into your virtual environment
.. note::
We recommend NuFT nodes install directly from master to help ensure your node is using pre-released features and hotfixes
2019-01-29 02:11:52 +00:00
.. code::
2019-01-30 05:10:52 +00:00
(nucypher)$ pip3 install nucypher
2019-01-29 02:11:52 +00:00
Re-activate your environment after installing
2019-01-29 02:11:52 +00:00
.. code::
$ source nucypher/bin/activate
...
(nucypher)$
2019-01-29 02:11:52 +00:00
Stage B | Configure Ursula
--------------------------
1. Verify that the installation was successful
Activate your virtual environment and run the ``nucypher --help`` command
2019-01-29 02:11:52 +00:00
.. code::
$ source nucypher/bin/activate
...
(nucypher)$ nucypher --help
2019-01-29 02:11:52 +00:00
You will see a list of possible usage options (``--version``, ``-v``, ``--dev``, etc.) and commands (``status``, ``ursula``). For example, you can use ``nucypher ursula destroy`` to delete all files associated with the node.
2. Configure a new Ursula node
2019-01-29 02:11:52 +00:00
.. code::
(nucypher)$ nucypher ursula init --federated-only
...
3. Enter your public-facing IPv4 address when prompted
2019-01-29 02:11:52 +00:00
.. code::
Enter Node's Public IPv4 Address: <YOUR NODE IP HERE>
4. Enter a password when prompted
2019-01-29 02:11:52 +00:00
.. code::
Enter a passphrase to encrypt your keyring: <YOUR PASSWORD HERE>
.. important::
Save your password as you will need it to relaunch the node, and please note:
2019-01-29 02:11:52 +00:00
- Minimum password length is 16 characters
- There is no password recovery process for NuFT nodes
- Do not use a password that you use anywhere else
- Security audits are ongoing on this codebase. For now, treat it as un-audited.
2019-01-29 02:11:52 +00:00
Running a NuFT Node
-------------------
2019-01-29 02:11:52 +00:00
Stage C | Run the Node (Interactive Method)
-------------------------------------------
1. Connect to Testnet
2019-01-29 02:11:52 +00:00
NuCypher is maintaining a purpose-built endpoint to initially connect to the test network. To connect to the swarm run:
.. code:: bash
$(nucypher) nucypher ursula run --network <NETWORK_DOMAIN> --teacher-uri <SEEDNODE_URI>
...
2. Verify Connection
This will drop your terminal session into the “Ursula Interactive Console” indicated by the ``>>>``. Verify that the node setup was successful by running the ``status`` command.
2019-01-29 02:11:52 +00:00
.. code::
Ursula >>> status
...
To view a list of known nodes, execute the ``known_nodes`` command
2019-01-29 02:11:52 +00:00
.. code::
Ursula >>> known_nodes
...
You can also view your nodes network status webpage by navigating your web browser to ``https://<your-node-ip-address>:9151/status``.
2019-01-29 02:11:52 +00:00
.. note::
Since nodes self-sign TLS certificates, you may receive a warning from your web browser.
To stop your node from the interactive console and return to the terminal session
.. code::
Ursula >>> stop
...
2019-01-29 02:11:52 +00:00
Subsequent node restarts do not need the teacher endpoint specified.
.. code:: bash
(nucypher)$ nucypher ursula run --network <NETWORK_DOMAIN>
...
Alternately you can run your node as a system service.
See the *“System Service Method”* section below.
2019-01-29 02:11:52 +00:00
Stage C | Run the Node (System Service Method)
----------------------------------------------
2019-01-29 04:52:59 +00:00
*NOTE - This is an alternative to the “Interactive Method” and assumes you're using systemd.*
1. Create Ursula System Service
Use this template to create a file named ``ursula.service`` and place it in ``/etc/systemd/system/``.
2019-01-29 02:11:52 +00:00
.. code::
[Unit]
Description="Run 'Ursula', a NuCypher Staking Node."
[Service]
User=<YOUR USER>
Type=simple
Environment="NUCYPHER_KEYRING_PASSWORD=<YOUR PASSWORD>"
ExecStart=<VIRTUALENV PATH>/bin/nucypher ursula run --network <NETWORK_DOMAIN> --teacher-uri <SEEDNODE_URI>
[Install]
WantedBy=multi-user.target
2. Enable Ursula System Service
2019-01-29 02:11:52 +00:00
.. code::
$ sudo systemctl enable ursula
3. Run Ursula System Service
To start Ursula services using systemd
2019-01-29 02:11:52 +00:00
.. code::
$ sudo systemctl start ursula
2019-01-29 02:11:52 +00:00
Check Ursula service status
2019-01-29 02:11:52 +00:00
.. code::
$ sudo systemctl status ursula
2019-01-29 02:11:52 +00:00
To restart your node service
2019-01-29 02:11:52 +00:00
.. code::
$ sudo systemctl restart ursula
2019-01-29 02:11:52 +00:00
Updating a NuFT Node
---------------------
Nucypher is under active development, you can expect frequent code changes to occur as bugs are
discovered and code fixes are submitted. As a result, Ursula nodes will need to be frequently updated
to use the most up-to-date version of the application code.
2019-01-29 02:11:52 +00:00
.. important::
The steps to update an Ursula running on NuFT are as follows and depends on the type of installation that was employed.
1. Stop the node
2019-01-29 02:11:52 +00:00
Interactive method
2019-01-29 02:11:52 +00:00
.. code::
Ursula >>> stop
2019-01-29 02:11:52 +00:00
OR
Systemd method
2019-01-29 02:11:52 +00:00
.. code::
$ sudo systemctl stop ursula
2019-01-29 02:11:52 +00:00
2. Update to the latest code version
2019-01-29 02:11:52 +00:00
Update your virtual environment
.. code::
2019-01-30 05:10:52 +00:00
(nucypher)$ pip3 install nucypher
2019-01-29 02:11:52 +00:00
3. Restart Ursula Node
2019-01-29 02:11:52 +00:00
Re-activate your environment after updating
Interactive method:
.. code::
$ source nucypher/bin/activate
...
(nucypher)$ nucypher ursula run --network <NETWORK_DOMAIN>
2019-01-29 02:11:52 +00:00
OR
Systemd Method:
.. code::
$ sudo systemctl start ursula
2019-01-29 02:11:52 +00:00