更改守护程序服务中的IPFS回购位置
我正在努力创建一个维护IPFS守护程序的服务,这是私人IPFS网络的一部分。
尝试&我可以轻松地将IPF放入所有用户,我选择在AN /OPT文件夹中初始化IPFS存储库。我在 /etc/bash.bashrc
中设置IPFS_PATH,以便所有用户的默认位置在此/OPT文件夹中:
18:53:02 [foo@server ~]
$ echo $IPFS_PATH
/opt/ipfsNode/.ipfs
完成此操作后,我成功初始化了我的IPFS Repo&amp&能够按预期启动守护程序。
$ ipfs daemon
Initializing daemon...
go-ipfs version: 0.12.2
Repo version: 12
System version: amd64/linux
Golang version: go1.16.15
Swarm is limited to private network of peers with the swarm key
Swarm key fingerprint: [redacted]
Swarm listening on /ip4/<ip>/tcp/4001
Swarm listening on /ip4/127.0.0.1/tcp/4001
Swarm listening on /ip6/::1/tcp/4001
Swarm listening on /p2p-circuit
Swarm announcing /ip4/<ip>/tcp/4001
Swarm announcing /ip4/127.0.0.1/tcp/4001
Swarm announcing /ip6/::1/tcp/4001
API server listening on /ip4/<ip>/tcp/5001
WebUI: http://<ip>:5001/webui
Gateway (readonly) server listening on /ip4/<ip>/tcp/8080
Daemon is ready
要将其转换为服务,我使用 /etc/systemd/systemd/systemd/ypfs.service 上创建此服务定义。 /2019/03/ipfs-network-data-replication.html“ rel =“ nofollow noreferrer”> eleks lab :
[Unit]
Description=IPFS Daemon
After=syslog.target network.target remote-fs.target nss-lookup.target
[Service]
Type=simple
ExecStart=/usr/local/bin/ipfs daemon --enable-namesys-pubsub
User=foo
[Install]
WantedBy=multi-user.target
但是,它似乎尝试&amp;在我的主目录之上初始化的回购〜/.ipfs
而不是 $ {ipfs_path}/。ipfs
启动服务时。我如何更改它以找到我已经初始化的回购?
● ipfs.service - IPFS Daemon
Loaded: loaded (/etc/systemd/system/ipfs.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Wed 2022-06-01 18:43:03 UTC; 17min ago
Process: 227966 ExecStart=/usr/local/bin/ipfs daemon --enable-namesys-pubsub (code=exited, status=1/FAILURE)
Main PID: 227966 (code=exited, status=1/FAILURE)
Jun 01 18:43:03 <server> systemd[1]: Started IPFS Daemon.
Jun 01 18:43:03 <server> ipfs[227966]: Initializing daemon...
Jun 01 18:43:03 <server> ipfs[227966]: go-ipfs version: 0.12.2
Jun 01 18:43:03 <server> ipfs[227966]: Repo version: 12
Jun 01 18:43:03 <server> ipfs[227966]: System version: amd64/linux
Jun 01 18:43:03 <server> ipfs[227966]: Golang version: go1.16.15
Jun 01 18:43:03 <server> ipfs[227966]: Error: no IPFS repo found in /home/foo/.ipfs.
Jun 01 18:43:03 <server> ipfs[227966]: please run: 'ipfs init'
Jun 01 18:43:03 <server> systemd[1]: ipfs.service: Main process exited, code=exited, status=1/FAILURE
Jun 01 18:43:03 <server> systemd[1]: ipfs.service: Failed with result 'exit-code'.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这是一个非常古老的问题,所以我想您已经弄清楚了 - 但是由于没有答案,我花了很多时间克服了相同的情况,所以我所做的是使它起作用:
〜/.config/.config/systemd/user/ipfs.service
after =
服务文件的条件以等待要安装的外部磁盘,例如after = network.target dev-disk-by \ x2dlabel-&lt; devicelabel&gt; .device
(并在启动期间将此设备设置为自动板)loginctl enable-linger&lt; user&gt;
都应该工作。
This is quite an old question, so I suppose you have already figured it out - but since there's no answer and I spent a lot of time to overcome the same situation, here's what I have done to make it work:
~/.config/systemd/user/ipfs.service
After=
condition of your service file to wait for the external disk to be mounted, E.G.After=network.target dev-disk-by\x2dlabel-<DEVICELABEL>.device
(and remeber to set this device to auto-mount during boot)loginctl enable-linger <USER>
It should work then.