Skip to content

Commit 347d647

Browse files
committed
adapt readme file
1 parent a8ecf31 commit 347d647

File tree

6 files changed

+96
-106
lines changed

6 files changed

+96
-106
lines changed

GROUPVARS.md

Lines changed: 0 additions & 10 deletions
This file was deleted.

HOSTVARS.md

Lines changed: 0 additions & 65 deletions
This file was deleted.

Makefile

Lines changed: 0 additions & 6 deletions
This file was deleted.

README.md

Lines changed: 95 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -6,30 +6,103 @@ This repository contains Ansible roles to install and run
66

77
They include a Systemd service file both.
88

9+
## Requirements
10+
11+
- Ansible. you can install it by running `pip install ansible`
12+
- [optional] Working moledule setup with docker for running the tests
13+
14+
## Installation
15+
16+
### Git
17+
Use `git clone` or `git submodule add` to clone the ansible-ipfs-cluster role (`https://github.com/hsanjuan/ansible-ipfs-cluster.git`) into the `roles` folder of your playbook to pull the latest edge commit of the role from GitHub.
18+
919
## Usage
1020

1121
If you are familiar with Ansible, you can just re-use the modules in the way
1222
that fits you best. Otherwise follow these steps:
1323

14-
0. Make sure you have ansible installed: `pip install ansible`.
15-
1. Fill in `inventory.yml` and place the hostnames of your nodes under the `[ipfs]` group.
16-
2. Edit the `group_vars/ipfs.yml` and `group_vars/ipfs_cluster.yml` file
17-
setting the right configuration values, including generating an
18-
[IPFS Cluster secret](https://cluster.ipfs.io/documentation/guides/security/#the-cluster-secret)
19-
with `od -vN 32 -An -tx1 /dev/urandom | tr -d ' \n' ; echo`
20-
3. Add a file for each hostname (filename is the hostname), to the `host_vars`
21-
folder as outlined in [`host_vars/README.md`](host_vars/README.md),
22-
containing the necessary host-specific variables (example in the
23-
`host_vars` README).
24-
4. Run `make`.
25-
26-
`make` will run ansible for the `ipfs` and the `ipfs-cluster` roles, which
27-
apply to the `[ipfs]` and `[ipfs_cluster]` inventory group. Upon successful,
28-
both `go-ipfs` and `ipfs-cluster` should be running in the nodes (they are
29-
installed under `/usr/local/bin` and run by a created `ipfs` system user).
30-
31-
You can use `systemctl status ipfs` and `systemctl status ipfs-cluster` to
32-
check the status of the new services.
33-
34-
Note that `ipfs` configuration has been generated using `profile=server`, thus
35-
will not automatically scan the local network.
24+
- Fill in `inventory.yml` and place the hostnames of your nodes under the `[ipfs]` and `[ipfs-cluster]` groups.
25+
- Edit the `group_vars/ipfs.yml` and `group_vars/ipfs_cluster.yml` files setting the right configuration values including generating an [IPFS Cluster secret](https://cluster.ipfs.io/documentation/guides/security/#the-cluster-secret) with `od -vN 32 -An -tx1 /dev/urandom | tr -d ' \n' ; echo`
26+
- Add a file for each hostname (filename is the hostname), to the `host_vars` folder as outlined in [`Host Vars`](#host-vars), containing the necessary host-specific variables (example in the `molecule/default/molecule.yml` file).
27+
28+
Upon successful execution, both `go-ipfs` and `ipfs-cluster` should be running in the nodes (they are installed under `/usr/local/bin` and run by a created `ipfs` system user).
29+
30+
You can use `systemctl status ipfs` and `systemctl status ipfs-cluster` to check the status of the new services.
31+
32+
Note that `ipfs` configuration has been generated using `profile=server`, thus will not automatically scan the local network.
33+
34+
### Host Vars
35+
36+
Add one file for each ipfs-cluster host. The filename should match a domain name from your inventory, i.e. `example.org`.
37+
38+
Each file should contain the following variables, updated for your cluster:
39+
40+
```yaml
41+
ipfs_peer_id: "<ipfs_daemon_peer_id>"
42+
ipfs_private_key: "<ipfs_daemon_private_key>"
43+
44+
ipfs_cluster_id: "<cluster_peer_id>"
45+
ipfs_cluster_private_key: "<cluster_peer_private_key>"
46+
47+
ipfs_cluster_peer_addr: "/dns4/<hostname>/tcp/9096/ipfs/<ipfs_cluster_peer_id>"
48+
```
49+
50+
To generate the `ipfs_peer_id`/`ipfs_private_key` and `ipfs_cluster_id`/`ipfs_cluster_private_key` key-pairs, use [`ipfs-key`]. Theymust be all different (no ID or Key can be shared between daemons).
51+
52+
To install [`ipfs-key`], with Go installed, run:
53+
54+
```console
55+
$ go get github.com/whyrusleeping/ipfs-key
56+
```
57+
58+
then generate a key-pair:
59+
60+
```console
61+
$ ipfs-key | base64 -w 0
62+
63+
# or on macos
64+
$ ipfs-key | base64
65+
66+
Generating a 2048 bit RSA key...
67+
Success!
68+
ID for generated key: Qmat3Bk4SixhZdU5j5pf2uXcpUuTSxKHQu7whbWrdFwn5g
69+
CAASqAkwggSkAgEAAoIBAQCUzxjdml2fORveg9PN98qqiENexLzoaSeNc6N7K8iVzneCU1aDZpM...
70+
```
71+
72+
Where:
73+
74+
- the value of `ID for generated key: <PeerId>` is your `ipfs_peer_id` or `ipfs_cluster_id`
75+
- the subsequent line is your `ipfs_private_key` or `ipfs_cluster_private_key`, encoded as base64
76+
77+
Copy those values into your host config file.
78+
79+
For `ipfs_cluster_peer_addr` you need to specify a valid [multiaddr] by taking the example below
80+
81+
```
82+
"/dns4/<hostname>/tcp/9096/ipfs/<ipfs_cluster_peer_id>"
83+
```
84+
and replacing:
85+
86+
`hostname`: with the host from your invetory that this file is for, e.g `example.org` `ipfs_cluster_peer_id`: with the peer id for this cluster node, that you just created.
87+
88+
89+
You can also define `ipfs_cluster_peername` to name your cluster peer for conviniency. Otherwise, the hostname will be used.
90+
91+
[`ipfs-key`]: https://github.com/whyrusleeping/ipfs-key
92+
[multiaddr]: https://multiformats.io/multiaddr/
93+
94+
### Group Vars
95+
96+
The `group_vars` file can be used to set variables to control the common configuration for of all ipfs and ipfs-cluster peers.
97+
98+
Edit the `ipfs.yml` file in this folder and set the appropiate values for the variables.
99+
100+
Note the cluster `service.json` template can be fully customized by defining the appropiate variables, and otherwise they will take sensisble defaults.
101+
102+
## Running the tests
103+
104+
Assumes you have a working molecule setup with docker, running `molecule test` should spin up a docker container and execute the test playbook declared in `molecule/default/converge.yml`.
105+
106+
```console
107+
python 3 -m molecule test
108+
```

molecule/default/converge.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
tasks:
55
- name: "Include ansible-ipfs-cluster"
66
vars:
7-
ipfs_enable: false
7+
ipfs_enable: true
88
ipfs_cluster_enable: true
99
include_role:
1010
name: "ansible-ipfs-cluster"

molecule/default/molecule.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,6 @@ provisioner:
1818
ipfs_peer_id: "QmUdZCogpVVrPMxdPHhtT2KuUuxNVi1uLb7UC4HwHBqejb"
1919
ipfs_private_key: "CAASqAkwggSkAgEAAoIBAQC3NFhK6XMF9tDDky2aoCdwnNsIzk0DnvkVtfTsM1/fCqnrlMDzvVOY7tsMFBNBHsjCAuLwjUMxtLTgY2+8b8vil5TTuYk0A2nCCTwyxqKHoxwn5RW3J5HlBBMgTV9vKtRyrDONFnRwvVmUbCaxblOp74tl03KEfF3zH46+vz8bzVeNdqDrGmEIc1tWnERddFAeqcM5r8fhNVsVInCWFThqFA2qUahif43Uo1B/gBySnyXWr61htiHoWBXqPK8eFk4FCBodhs+Ct81KE4QQhV9OQaZeQkChGezIPidvwiojY8Lr40xBsRn0H95AKYWwdo0lTbAJ7dtFuBinZrTNdSz/AgMBAAECggEAM7Ism+7mCy/LVvSn8LLyjh9k20ZDixsH1G2E0EXq7qg2rIhMLjslZMk5vF3J1R1Xrw9bdF+YL2V7iLnmZLjzQlxdnaUEJ04zQJKUjwtn/3gyULue9hDPZV1R/FJ49IiUbEtVPKGyd8GmjnA6NuUX7KLwpeoVrXbel+U2xXJ332MGU1uydteq4iH27FYKYK+6UZUzHLd+V9BOwzGXEXG22Z25hT8n0mp0u1LcJy5tecAj3PAPW0uhsvAFX95c/jkQRkUNj8mntTb2AL2aw4MGNj8UbLYg0EdBRfE3V+esyj0ob7OUt0Nk5d6yCOBXDSZdD/P1mDYOgiL6JpaG9445YQKBgQDvgSKClI4TmXPerRNHhN8ZKbgLy1Hcu9hMs/pmv4Up0KQ6VbrsArXD1KMglrpsXZojgKeDuLmzLnVmMeslZyYqlWS3wWXeJZ2Ms2PlcnNDQlxlwJbJapNO4V9UZTIGcydg5lJ0QWL7HVGANNvM0Jg4wFQbvjj+tXS6kVYNz4JCDwKBgQDD0owaNJNIfo9JvkXFCNaf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