Help: Systemd file for IPFS Cluster Service

@hector I was trying to run ipfs-cluster-service daemon with this systemd file.

[Unit]
Description=IPFS Cluster Daemon

[Service]
ExecStart=/usr/local/bin/ipfs-cluster-service daemon
KillSignal=SIGINT

[Install]
WantedBy=default.target

But got this error.

● ipfs-cluster.service - IPFS Cluster Daemon
   Loaded: loaded (/etc/systemd/system/ipfs-cluster.service; disabled; vendor preset: enabled)
   Active: failed (Result: exit-code) since Thu 2020-01-23 14:35:02 UTC; 34s ago
  Process: 29321 ExecStart=/usr/local/bin/ipfs-cluster-service daemon (code=exited, status=1/FAILURE)
 Main PID: 29321 (code=exited, status=1/FAILURE)

Jan 23 14:35:02 ip-172-31-40-167 systemd[1]: Started IPFS Cluster Daemon.
Jan 23 14:35:02 ip-172-31-40-167 ipfs-cluster-service[29321]: 14:35:02.516  INFO    service: Initializing. For verbose output run with "-l debug". Ple
Jan 23 14:35:02 ip-172-31-40-167 ipfs-cluster-service[29321]: 14:35:02.519 ERROR     config: error reading the configuration file:  open /root/.ipfs-c
Jan 23 14:35:02 ip-172-31-40-167 ipfs-cluster-service[29321]: error loading configurations: open /root/.ipfs-cluster/service.json: no such file or dir
Jan 23 14:35:02 ip-172-31-40-167 systemd[1]: ipfs-cluster.service: Main process exited, code=exited, status=1/FAILURE
Jan 23 14:35:02 ip-172-31-40-167 systemd[1]: ipfs-cluster.service: Unit entered failed state.
Jan 23 14:35:02 ip-172-31-40-167 systemd[1]: ipfs-cluster.service: Failed with result 'exit-code'.

I’m running ipfs daemon using systemd as discussed here.

1 Like

UPDATE 1:

Jan 23 14:35:02 ip-172-31-40-167 ipfs-cluster-service[29321]: error loading configurations: open /root/.ipfs-cluster/service.json: no such file or dir

Ok. I see the silly error :sweat_smile:

UPDATE 2: I copied the .ipfs-cluster folder to the root and then ran the systemd service. It works.

Is there any security issue in running ipfs cluster daemon from root?

The current recommendation is to have a dedicated ipfs system user to run ipfs and ipfs-cluster, thus getting some containment, as these programs do not really need root anyways.

2 Likes

I get ipfs-cluster on node-0, with:

ipfs-cluster-service daemon

and on node-1, with:

ipfs-cluster-service daemon --bootstrap /ip4/51.91.78.225/tcp/9096/p2p /12D3KooWPd67ZZcQfKAZdLLZRg4WEsfkNPqjYpSKZF4mqkdmTHeZ

and pin files between them.

But when trying to use systemd, it doesn’t give me an error but they don’t connect between them. The ipfs-cluster-service of node-0 that I am using is:

[Unit]
Description = IPFS-Cluster Daemon (MASTER)
Requires = ipfs
After = syslog.target network.target remote-fs.target nss-lookup.target ipfs

[Service]
Type = simple
ExecStart = / home / ubuntu / gopath / bin / ipfs-cluster-service daemon
User = ubuntu

[Install]
WantedBy = multi-user.target

And at node-1:

[Unit]
Description = IPFS-Cluster Daemon
Requires = ipfs
After = syslog.target network.target remote-fs.target nss-lookup.target ipfs

[Service]
Type = simple
ExecStart = /home/ubuntu/gopath/bin/ipfs-cluster-service daemon --bootstrap /ip4/51.91.78.225/tcp/9096/p2p /12D3KooWPd67ZZcQfKAZdLLZRg4WEsfkNPqjYpSKZF4mqkdmTHeZ
User =ubuntu

[Install]
WantedBy = multi-user.target

I try with other config. but give error. With this simply nothing, no errors no conections
Any help?

Share the logs please.

When I enable the systemd of node-1. In node-1:

sudo systemctl status ipfs-cluster

Give me:

ipfs-cluster.service - IPFS-Cluster Daemon
Loaded: loaded (/etc/systemd/system/ipfs-cluster.service; enabled; vendor prese
Active: active (running) since Tue 2020-06-23 13:28:28 CEST; 7s ago
Main PID: 27386 (ipfs-cluster-se)
Tasks: 5 (limit: 4587)
CGroup: /system.slice/ipfs-cluster.service
       └─27386 /home/ubuntu/gopath/bin/ipfs-cluster-service daemon --bootstrap

jun 23 13:28:28 vps777360 systemd[1]: Started IPFS-Cluster Daemon.
jun 23 13:28:28 vps777360 ipfs-cluster-service[27386]: 2020-06-23T13:28:28.698+020
jun 23 13:28:28 vps777360 ipfs-cluster-service[27386]: 2020-06-23T13:28:28.780+020
jun 23 13:28:28 vps777360 ipfs-cluster-service[27386]:         /ip4/127.0.0.1/tcp/
jun 23 13:28:28 vps777360 ipfs-cluster-service[27386]:         /ip4/51.77.211.146/

Looking deeper with:

journalctl -u ipfs-cluster --since today

Give me:

jun 23 13:28:09 vps777360 systemd[1]: /etc/systemd/system/ipfs-cluster.service:3: Failed to add dependency on ipfs, ignoring: Invalid argument
jun 23 13:28:09 vps777360 systemd[1]: /etc/systemd/system/ipfs-cluster.service:4: Failed to add dependency on ipfs, ignoring: Invalid argument
jun 23 13:28:21 vps777360 systemd[1]: /etc/systemd/system/ipfs-cluster.service:3: Failed to add dependency on ipfs, ignoring: Invalid argument
jun 23 13:28:21 vps777360 systemd[1]: /etc/systemd/system/ipfs-cluster.service:4: Failed to add dependency on ipfs, ignoring: Invalid argument
jun 23 13:28:28 vps777360 systemd[1]: Started IPFS-Cluster Daemon.
jun 23 13:28:28 vps777360 ipfs-cluster-service[27386]: 2020-06-23T13:28:28.698+0200        INFO        service        ipfs-cluster-service/daemon.go:46        Initializ
jun 23 13:28:28 vps777360 ipfs-cluster-service[27386]: 2020-06-23T13:28:28.780+0200        INFO        cluster        ipfs-cluster/cluster.go:132        IPFS Cluster v0
jun 23 13:28:28 vps777360 ipfs-cluster-service[27386]:         /ip4/127.0.0.1/tcp/9096/p2p/12D3KooWGxQWSTNBpfHsrVAottyXxP1KrEBBxkXoPU6sU4HDiKuN
jun 23 13:28:28 vps777360 ipfs-cluster-service[27386]:         /ip4/51.77.211.146/tcp/9096/p2p/12D3KooWGxQWSTNBpfHsrVAottyXxP1KrEBBxkXoPU6sU4HDiKuN
jun 23 13:28:38 vps777360 ipfs-cluster-service[27386]: 2020-06-23T13:28:38.782+0200        INFO        restapi        rest/restapi.go:515        REST API (HTTP): /ip4/1
jun 23 13:28:38 vps777360 ipfs-cluster-service[27386]: 2020-06-23T13:28:38.784+0200        INFO        ipfsproxy        ipfsproxy/ipfsproxy.go:320        IPFS Proxy: /i

At the same time, in node-0, give:

2020-06-23T11:28:38.580Z        WARN    cluster ipfs-cluster/cluster.go:400     met                                                                                     ric alert for ping: Peer: 12D3KooWGxQWSTNBpfHsrVAottyXxP1KrEBBxkXoPU6sU4HDiKuN.
2020-06-23T11:28:38.584Z        WARN    cluster ipfs-cluster/cluster.go:400     met                                                                                     ric alert for freespace: Peer: 12D3KooWGxQWSTNBpfHsrVAottyXxP1KrEBBxkXoPU6sU4HDiKuN

Thx for your help :clap: :clap:

Lines are cut. Please share the logs since the moment the peers are started. (you can use -l with journalctl to wrap the lines).

Share logs for both peers please.

Ok, sorry, I’m going a try again:

Nodo-0

ipfs-cluster-service daemon &

Log Nodo-0

2020-06-23T15:05:33.420Z    INFO    service ipfs-cluster-service/daemon.go:46  Initializing. For verbose output run with "-l debug". Please wait...
2020-06-23T15:05:33.573Z    INFO    cluster ipfs-cluster/cluster.go:132     IPFS Cluster v0.13.0-next+git6eb110d315559b7ebc202a1ac521dd0968b2dde0 listening on:
    /ip4/127.0.0.1/tcp/9096/p2p/12D3KooWPd67ZZcQfKAZdLLZRg4WEsfkNPqjYpSKZF4mqkdmTHeZ
    /ip4/51.91.78.225/tcp/9096/p2p/12D3KooWPd67ZZcQfKAZdLLZRg4WEsfkNPqjYpSKZF4mqkdmTHeZ


2020-06-23T15:05:33.582Z        INFO    restapi rest/restapi.go:515     REST API (HTTP): /ip4/127.0.0.1/tcp/9094
2020-06-23T15:05:33.582Z        INFO    ipfsproxy       ipfsproxy/ipfsproxy.go:320IPFS Proxy: /ip4/127.0.0.1/tcp/9095 -> /ip4/127.0.0.1/tcp/5001
2020-06-23T15:05:33.583Z        INFO    crdt    go-ds-crdt@v0.1.12/crdt.go:275  crdt Datastore created. Number of heads: 1. Current max-height: 11
2020-06-23T15:05:33.584Z        INFO    crdt    crdt/consensus.go:272   'trust all' mode enabled. Any peer in the cluster can modify the pinset.
2020-06-23T15:05:33.601Z        INFO    cluster ipfs-cluster/cluster.go:619     Cluster Peers (without including ourselves):
2020-06-23T15:05:33.601Z        INFO    cluster ipfs-cluster/cluster.go:621         - No other peers
2020-06-23T15:05:33.602Z        INFO    cluster ipfs-cluster/cluster.go:634     ** IPFS Cluster is READY **

After add Nodo-1

2020-06-23T15:06:02.625Z        INFO    cluster ipfs-cluster/cluster.go:850     Peer added 12D3KooWGxQWSTNBpfHsrVAottyXxP1KrEBBxkXoPU6sU4HDiKuN

Nodo-1

ipfs-cluster-service daemon --bootstrap /ip4/51.91.78.225/tcp/9096/p2p/12D3KooWPd67ZZcQfKAZdLLZRg4WEsfkNPqjYpSKZF4mqkdmTHeZ &

Log Nodo-1

2020-06-23T17:06:02.399+0200        INFO    service ipfs-cluster-service/daemon.go:46  Initializing. For verbose output run with "-l debug". Please wait...
2020-06-23T17:06:02.540+0200    INFO    cluster ipfs-cluster/cluster.go:132     IPFS Cluster v0.13.0-next+git6eb110d315559b7ebc202a1ac521dd0968b2dde0 listening on:
    /ip4/127.0.0.1/tcp/9096/p2p/12D3KooWGxQWSTNBpfHsrVAottyXxP1KrEBBxkXoPU6sU4HDiKuN
    /ip4/51.77.211.146/tcp/9096/p2p/12D3KooWGxQWSTNBpfHsrVAottyXxP1KrEBBxkXoPU6sU4HDiKuN


2020-06-23T17:06:02.618+0200    INFO    restapi rest/restapi.go:515     REST API (HTTP): /ip4/127.0.0.1/tcp/9094
2020-06-23T17:06:02.618+0200    INFO    ipfsproxy       ipfsproxy/ipfsproxy.go:320IPFS Proxy: /ip4/127.0.0.1/tcp/9095 -> /ip4/127.0.0.1/tcp/5001
2020-06-23T17:06:02.619+0200    INFO    service ipfs-cluster-service/daemon.go:218Bootstrapping to /ip4/51.91.78.225/tcp/9096/p2p/12D3KooWPd67ZZcQfKAZdLLZRg4WEsfkNPqjYpSKZF4mqkdmTHeZ
2020-06-23T17:06:02.621+0200    INFO    crdt    go-ds-crdt@v0.1.12/crdt.go:275  crdt Datastore created. Number of heads: 1. Current max-height: 11
2020-06-23T17:06:02.624+0200    INFO    crdt    crdt/consensus.go:272   'trust all' mode enabled. Any peer in the cluster can modify the pinset.
2020-06-23T17:06:02.672+0200    INFO    cluster ipfs-cluster/cluster.go:619     Cluster Peers (without including ourselves):
2020-06-23T17:06:02.673+0200    INFO    cluster ipfs-cluster/cluster.go:626         - 12D3KooWPd67ZZcQfKAZdLLZRg4WEsfkNPqjYpSKZF4mqkdmTHeZ
2020-06-23T17:06:02.674+0200    INFO    cluster ipfs-cluster/cluster.go:634     ** IPFS Cluster is READY **
2020-06-23T17:06:02.679+0200    INFO    cluster ipfs-cluster/cluster.go:988     12D3KooWGxQWSTNBpfHsrVAottyXxP1KrEBBxkXoPU6sU4HDiKuN: joined 12D3KooWPd67ZZcQfKAZdLLZRg4WEsfkNPqjYpSKZF4mqkdmTHeZ's cluster


In the moment to enable systemd in node-1

sudo systemctl status ipfs-cluster

Log Nodo-1

● ipfs-cluster.service - IPFS-Cluster Daemon
   Loaded: loaded (/etc/systemd/system/ipfs-cluster.service; enabled; vendor preset
   Active: active (running) since Tue 2020-06-23 17:13:55 CEST; 8s ago
 Main PID: 28773 (ipfs-cluster-se)
    Tasks: 5 (limit: 4587)
   CGroup: /system.slice/ipfs-cluster.service
           └─28773 /home/ubuntu/gopath/bin/ipfs-cluster-service daemon --bootstrap

jun 23 17:13:55 vps777360 systemd[1]: Started IPFS-Cluster Daemon.
jun 23 17:13:55 vps777360 ipfs-cluster-service[28773]: 2020-06-23T17:13:55.529+0200
jun 23 17:13:55 vps777360 ipfs-cluster-service[28773]: 2020-06-23T17:13:55.603+0200
jun 23 17:13:55 vps777360 ipfs-cluster-service[28773]:         /ip4/127.0.0.1/tcp/9
jun 23 17:13:55 vps777360 ipfs-cluster-service[28773]:         /ip4/51.77.211.146/t
lines 1-13/13 (END)...skipping...
● ipfs-cluster.service - IPFS-Cluster Daemon
   Loaded: loaded (/etc/systemd/system/ipfs-cluster.service; enabled; vendor preset: enabled)
   Active: active (running) since Tue 2020-06-23 17:13:55 CEST; 8s ago
 Main PID: 28773 (ipfs-cluster-se)
    Tasks: 5 (limit: 4587)
   CGroup: /system.slice/ipfs-cluster.service
           └─28773 /home/ubuntu/gopath/bin/ipfs-cluster-service daemon --bootstrap /ip4/51.91.78.225/tcp/9096/p2p/12D3KooWPd67ZZcQfKAZdLLZRg4WEsfkNPqjYpSKZF4mqkdmTHeZ

jun 23 17:13:55 vps777360 systemd[1]: Started IPFS-Cluster Daemon.
jun 23 17:13:55 vps777360 ipfs-cluster-service[28773]: 2020-06-23T17:13:55.529+0200        INFO        service        ipfs-cluster-service/daemon.go:46        Initializing. For verbose output run with "-l debug". Please wait...
jun 23 17:13:55 vps777360 ipfs-cluster-service[28773]: 2020-06-23T17:13:55.603+0200        INFO        cluster        ipfs-cluster/cluster.go:132        IPFS Cluster v0.13.0-next+git6eb110d315559b7ebc202a1ac521dd0968b2dde0 listening on:
jun 23 17:13:55 vps777360 ipfs-cluster-service[28773]:         /ip4/127.0.0.1/tcp/9096/p2p/12D3KooWGxQWSTNBpfHsrVAottyXxP1KrEBBxkXoPU6sU4HDiKuN
jun 23 17:13:55 vps777360 ipfs-cluster-service[28773]:         /ip4/51.77.211.146/tcp/9096/p2p/12D3KooWGxQWSTNBpfHsrVAottyXxP1KrEBBxkXoPU6sU4HDiKuN

Log Nodo-0 at the same moment:

2020-06-23T15:13:33.584Z    WARN    cluster ipfs-cluster/cluster.go:400        metric alert for ping: Peer: 12D3KooWGxQWSTNBpfHsrVAottyXxP1KrEBBxkXoPU6sU4HDiKuN.
2020-06-23T15:13:33.597Z    WARN    cluster ipfs-cluster/cluster.go:400        metric alert for freespace: Peer: 12D3KooWGxQWSTNBpfHsrVAottyXxP1KrEBBxkXoPU6sU4HDiKuN

In Nodo-1 in the Logs with:

 journalctl -lu ipfs-cluster.service --since today

Give me:

jun 23 17:31:39 vps777360 systemd[1]: Stopping IPFS-Cluster Daemon...
jun 23 17:31:39 vps777360 ipfs-cluster-service[29060]: 2020-06-23T17:31:39.820+0200        INFO        cluster        ipfs-cluster/cluster.go:665        shutting down Cluster
jun 23 17:31:39 vps777360 ipfs-cluster-service[29060]: 2020-06-23T17:31:39.826+0200        INFO        crdt        crdt/consensus.go:291        stopping Consensus component
jun 23 17:31:39 vps777360 ipfs-cluster-service[29060]: 2020-06-23T17:31:39.831+0200        INFO        monitor        pubsubmon/pubsubmon.go:174        stopping Monitor
jun 23 17:31:39 vps777360 ipfs-cluster-service[29060]: 2020-06-23T17:31:39.831+0200        INFO        restapi        rest/restapi.go:556        stopping Cluster API
jun 23 17:31:39 vps777360 ipfs-cluster-service[29060]: 2020-06-23T17:31:39.831+0200        INFO        ipfsproxy        ipfsproxy/ipfsproxy.go:286        stopping IPFS Proxy
jun 23 17:31:39 vps777360 ipfs-cluster-service[29060]: 2020-06-23T17:31:39.831+0200        INFO        ipfshttp        ipfshttp/ipfshttp.go:235        stopping IPFS Connector
jun 23 17:31:39 vps777360 ipfs-cluster-service[29060]: 2020-06-23T17:31:39.832+0200        INFO        pintracker        stateless/stateless.go:217        stopping StatelessPinTracker
jun 23 17:31:40 vps777360 systemd[1]: Stopped IPFS-Cluster Daemon.
jun 23 17:31:46 vps777360 systemd[1]: /etc/systemd/system/ipfs-cluster.service:3: Failed to add dependency on ipfs, ignoring: Invalid argument
jun 23 17:31:46 vps777360 systemd[1]: /etc/systemd/system/ipfs-cluster.service:4: Failed to add dependency on ipfs, ignoring: Invalid argument
jun 23 17:31:51 vps777360 systemd[1]: /etc/systemd/system/ipfs-cluster.service:3: Failed to add dependency on ipfs, ignoring: Invalid argument
jun 23 17:31:51 vps777360 systemd[1]: /etc/systemd/system/ipfs-cluster.service:4: Failed to add dependency on ipfs, ignoring: Invalid argument
jun 23 17:31:55 vps777360 systemd[1]: Started IPFS-Cluster Daemon.
jun 23 17:31:55 vps777360 ipfs-cluster-service[29172]: 2020-06-23T17:31:55.213+0200        INFO        service        ipfs-cluster-service/daemon.go:46        Initializing. For verbose output run with "-l debug". Please wait...
jun 23 17:31:55 vps777360 ipfs-cluster-service[29172]: 2020-06-23T17:31:55.283+0200        INFO        cluster        ipfs-cluster/cluster.go:132        IPFS Cluster v0.13.0-next+git6eb110d315559b7ebc202a1ac521dd0968b2dde0 listening on:
jun 23 17:31:55 vps777360 ipfs-cluster-service[29172]:         /ip4/127.0.0.1/tcp/9096/p2p/12D3KooWGxQWSTNBpfHsrVAottyXxP1KrEBBxkXoPU6sU4HDiKuN
jun 23 17:31:55 vps777360 ipfs-cluster-service[29172]:         /ip4/51.77.211.146/tcp/9096/p2p/12D3KooWGxQWSTNBpfHsrVAottyXxP1KrEBBxkXoPU6sU4HDiKuN
jun 23 17:32:00 vps777360 ipfs-cluster-service[29172]: 2020-06-23T17:32:00.297+0200        INFO        restapi        rest/restapi.go:515        REST API (HTTP): /ip4/127.0.0.1/tcp/9094
jun 23 17:32:00 vps777360 ipfs-cluster-service[29172]: 2020-06-23T17:32:00.298+0200        INFO        ipfsproxy        ipfsproxy/ipfsproxy.go:320        IPFS Proxy: /ip4/127.0.0.1/tcp/9095 -> /ip4/127.0.0.1/tcp/5001
jun 23 17:32:00 vps777360 ipfs-cluster-service[29172]: 2020-06-23T17:32:00.298+0200        INFO        service        ipfs-cluster-service/daemon.go:218        Bootstrapping to /ip4/51.91.78.225/tcp/9096/p2p/12D3KooWPd67ZZcQfKAZdLLZRg4WEsfkNPqjYpSKZF4mqkdmTHeZ
jun 23 17:32:00 vps777360 ipfs-cluster-service[29172]: 2020-06-23T17:32:00.300+0200        INFO        crdt        go-ds-crdt@v0.1.12/crdt.go:275        crdt Datastore created. Number of heads: 1. Current max-height: 11
jun 23 17:32:00 vps777360 ipfs-cluster-service[29172]: 2020-06-23T17:32:00.301+0200        INFO        crdt        crdt/consensus.go:272        'trust all' mode enabled. Any peer in the cluster can modify the pinset.
jun 23 17:32:00 vps777360 ipfs-cluster-service[29172]: 2020-06-23T17:32:00.306+0200        ERROR        p2p-gorpc        go-libp2p-gorpc@v0.1.0/call.go:64        failed to dial 12D3KooWPd67ZZcQfKAZdLLZRg4WEsfkNPqjYpSKZF4mqkdmTHeZ: all dials failed
jun 23 17:32:00 vps777360 ipfs-cluster-service[29172]:   * [/ip4/51.91.78.225/tcp/9096] failed to negotiate security protocol: incoming message was too large
jun 23 17:32:00 vps777360 ipfs-cluster-service[29172]: 2020-06-23T17:32:00.307+0200        ERROR        cluster        ipfs-cluster/cluster.go:917        failed to dial 12D3KooWPd67ZZcQfKAZdLLZRg4WEsfkNPqjYpSKZF4mqkdmTHeZ: all dials failed
jun 23 17:32:00 vps777360 ipfs-cluster-service[29172]:   * [/ip4/51.91.78.225/tcp/9096] failed to negotiate security protocol: incoming message was too large
jun 23 17:32:00 vps777360 ipfs-cluster-service[29172]: 2020-06-23T17:32:00.307+0200        ERROR        service        ipfs-cluster-service/daemon.go:221        bootstrap to /ip4/51.91.78.225/tcp/9096/p2p/12D3KooWPd67ZZcQfKAZdLLZRg4WEsfkNPqjYpSKZF4mqkdmTHeZ failed: failed to dial 12D3KooWPd67ZZcQfKAZdLLZRg4WEsfkNPqjYpSKZF4mqkdmTHeZ: a
jun 23 17:32:00 vps777360 ipfs-cluster-service[29172]:   * [/ip4/51.91.78.225/tcp/9096] failed to negotiate security protocol: incoming message was too large
jun 23 17:32:00 vps777360 ipfs-cluster-service[29172]: 2020-06-23T17:32:00.314+0200        INFO        cluster        ipfs-cluster/cluster.go:619        Cluster Peers (without including ourselves):
jun 23 17:32:00 vps777360 ipfs-cluster-service[29172]: 2020-06-23T17:32:00.314+0200        INFO        cluster        ipfs-cluster/cluster.go:621            - No other peers
jun 23 17:32:00 vps777360 ipfs-cluster-service[29172]: 2020-06-23T17:32:00.314+0200        INFO        cluster        ipfs-cluster/cluster.go:634        ** IPFS Cluster