Collection of ansible playbooks and roles to operate The Graph Indexer infrastructure.
WARNING: var files contain sensitive information, keep them safe or encrypt with ansible vault
This repo contains a number of roles and playbooks to run any kind of Indexer infrastructure deployments.
Sample playbooks will show you how to use roles to run all components on a single node or provision infrastructure to multiple nodes.
Make sure you have installed all of the following prerequisites on your machine:
- Python 3+
- Ansible (Install instructions)
- Paramiko
Make sure that all servers have your ssh autorized_keys in place, so you won't be asked for a password during provisioning. If you don't have any keys, here is the easiest way to generate them and add them to your servers is to use ssh-copy-id.
- Ubuntu 20.04
- graph-node
- indexer-agent
- indexer-service
- postgres-docker
- prometheus
- grafana-docker
- vector-docker
- wireguard
- geerlingguy.postgresql
- geerlingguy.docker
- geerlingguy.pip
- geerlingguy.firewall
Before using sample playbooks you need to install the required roles:
ansible-galaxy install -r requirements.yml
It's necessary to adjust few variables before running an Indexer.
Copy an example
cp vars/single-node-testnet.yml.example vars/single-node-testnet.yml
Adjust variables in vars/single-node-testnet.yml
Copy an example
cp single-node.inventory.example single-node.inventory
Set an IP address of your server in single-node.inventory
ansible-playbook -i single-node.inventory single-node-testnet.yml -u root -e @vars/single-node-testnet.yml
Multi-node configuration is a bit more complicated because of the Wireguard VPN setup.
But it's also possible to run without the wireguard but with a local network instead.
Copy an example
cp vars/multi-node-testnet.yml.example vars/multi-node-testnet.yml
Adjust variables in vars/multi-node-testnet.yml
Copy an example
cp multi-node.inventory.example multi-node.inventory
Set an IP address of your servers in multi-node.inventory
.
Generate pairs of keys for each server and set them at the bottom of inventory file.
To generate a pair of keys you can use these commands:
private_key=$(wg genkey)
public_key=$(echo $private_key | wg pubkey)
echo "private key: $private_key"
echo "public key: $public_key"
ansible-playbook -i multi-node.inventory multi-node-testnet.yml -u root -e @vars/multi-node-testnet.yml
Generate wireguard config to connect to network:
ansible-playbook -i multi-node.inventory wg_local.yml -u root
ansible thegraph -m ping -i multi-node.inventory -u root
docker ps
docker logs --tail 20 <container-name>
Contributions are always welcome!