You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+95-22Lines changed: 95 additions & 22 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,30 +6,103 @@ This repository contains Ansible roles to install and run
6
6
7
7
They include a Systemd service file both.
8
8
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
+
9
19
## Usage
10
20
11
21
If you are familiar with Ansible, you can just re-use the modules in the way
12
22
that fits you best. Otherwise follow these steps:
13
23
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
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:
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
`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.
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`.
0 commit comments