hub20
Hub20
This role provides everything necessary for setting up an instance of Hub20 with all of its background jobs.
Requirements
This role is only responsible for the installation and setup of the following hub20 services:
- API: the REST API (a django-application, served by uvicorn)
- web3 listen events: a background job that will listen to relevant web3 events (i.e, ETH/ERC20 transfers to accounts hold by our services, raiden channels being opened/closed, whatever else the user defines)
- raiden sync: a background job to collect and process all events from your Raiden instance
- track pending payments: a background job that checks pending transactions targeting any of the accounts of the Hub20 internal wallets
The role DOES NOT provide the setup of the services that hub20 depends on, namely PostgreSQL and Redis. It also does not provide any web server that should be in front of o uvicorn to serve, e.g, static media. This service is meant to be running behind some web server or load balancing system (take a look at Uvicorn's deployment tips to understand your best options.
This role also assumes that you are targeting a Debian-based linux distribution that uses systemd. Also, due to hub20 dependency on python >= 3.7, a more recent distro needs to be used, or you may have to add some tasks to your playbook to install a recent python on the target platform
Role Variables
hub20_application_host
: (default 127.0.0.1)hub20_application_port
: (default 5000)hub20_blockchain_network_id
: (default 1)hub20_blockchain_starting_block
: (default 9500000)hub20_database_host
: (default localhost)hub20_database_name
: (default hub20)hub20_database_user
: (default hub20)hub20_database_port
: (default 5432)hub20_environment_file_path
: (default /etc/hub20)hub20_email_backend
: (default django.core.mail.backends.console.EmailBackend)hub20_email_sender_address
: (default noreply@hub20.example.com)hub20_pip_package_name
: (default hub20)hub20_pip_package_state
: (default latest)hub20_redis_host
: (default localhost)hub20_redis_port
: (default 6379)hub20_redis_celery_database
: (default 0)hub20_redis_cache_database
: (default 1)hub20_run_debug_mode
: (default false)hub20_run_python_version
: (default python3.7)hub20_service_web3_event_listener_enabled
: (default true)hub20_service_raiden_sync_enabled
: (default true)hub20_service_web_enabled
: (default true)hub20_user_name
: (default hub20)hub20_user_home_path
: (default /srv/hub20)hub20_web3_provider_uri
: (default http://localhost:8545)hub20_tracked_tokens
: list of token addresses (as hex strings) that will be used/accepted as currency by the stores. (default: addresses for ETH, WETH, DAI and RDN)hub20_application_static_folder_path
: (default /srv/hub20/static_)hub20_broker_url
: (default redis://localhost:6379/0)hub20_cache_url
: (default redis://localhost:6379/1)hub20_run_virtualenv_path
: (default /srv/hub20/.venv")
The following variables need to be defined and should be treated as sensitive values:
hub20_database_password
: the password to connect to the database.hub20_service_secret_key
: the hub20 web applications seret key is used for session managements, CSRF token generation, etc.
Example Playbook
- hosts: hub20_servers
roles:
- role: geerlingguy.nginx # Using nginx as your front proxy
- role: lullis.certbot-nginx # To get SSL certificates from Let's encrypt and have them served by nginx
- role: mushroomlabs.hub20
License
MIT
Author Information
Raphael Lullis (raphael@mushroomlabs.com)
Installs and sets up all hub20 services in any Debian-based linux distro
ansible-galaxy install mushroomlabs/ansible-role-hub20