mushroomlabs.hub20
Hub20
This role helps set up an instance of Hub20 along with its background jobs.
Requirements
This role is only responsible for installing and setting up the following Hub20 services:
- API: The REST API (a Django application, served by Uvicorn)
- Web3 Event Listener: A background job that listens for important web3 events (like ETH/ERC20 transfers to our service accounts, opening/closing of Raiden channels, and any other events defined by the user)
- Raiden Sync: A background job that collects and processes all events from your Raiden instance
- Track Pending Payments: A background job that checks for pending transactions targeting any of the Hub20 internal wallets
This role DOES NOT set up the services Hub20 relies on, such as PostgreSQL and Redis. It also does not provide a web server in front of Uvicorn to serve static files. The service is meant to run behind a web server or load balancer (check Uvicorn's deployment tips for options).
This role assumes you are using a Debian-based Linux distribution that uses systemd. Also, since Hub20 depends on Python version 3.7 or higher, ensure your distribution is recent, or you may need to add tasks to install a recent version of Python.
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) 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:
hub20_database_password
: Password to connect to the database.hub20_service_secret_key
: The secret key for the Hub20 web application used for session management, CSRF token generation, etc.
Example Playbook
- hosts: hub20_servers
roles:
- role: geerlingguy.nginx # Using nginx as the front proxy
- role: lullis.certbot-nginx # To get SSL certificates from Let's Encrypt and serve them via 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.hub20