Open air3ijai opened 1 year ago
Performed steps
Create unit file
file=/lib/systemd/system/ton-storage.service
public_ip=1.1.1.1
cat << EOF > $file
[Unit]
Description=TON Storage daemon
Documentation=https://docs.ton.org
After=network.target
[Service]
LimitNOFILE=10000
MemorySwapMax=0
TimeoutStartSec=infinity
Type=notify
User=root
Group=root
StateDirectory=ton-storage
ExecStart=/usr/local/bin/storage-daemon -v 5 --global-config /opt/ton/global.config.json --ip $public_ip:3333 -p 5555 --db /opt/ton/storage-db --logname /opt/ton/storage-daemon.log --daemonize
Restart=always
RestartSec=2
TimeoutStopSec=5
KillSignal=SIGINT
[Install]
WantedBy=default.target
EOF
Enable service
systemctl enable ton-storage
Start serivce
systemctl start ton-storage
Check status
systemctl status ton-storage
● ton-storage.service - TON Storage daemon
Loaded: loaded (/lib/systemd/system/ton-storage.service; enabled; vendor preset: enabled)
Active: activating (start) since Fri 2023-04-28 17:12:30 UTC; 3min 46s ago
Docs: https://docs.ton.org
Main PID: 37976 (storage-daemon)
Tasks: 15 (limit: 1116)
Memory: 26.1M (swap max: 0B)
CPU: 23.046s
CGroup: /system.slice/ton-storage.service
└─37976 /usr/local/bin/storage-daemon -v 5 --global-config /opt/ton/global.config.json --ip 1.1.1.1:3333 -p 5555 --db /opt/ton/storage-db ->
Apr 28 17:12:30 ip-172-31-47-142 systemd[1]: Starting TON Storage daemon...
We see that
Active: activating
Starting TON Storage daemon...
It looks like it not started but starting and can't be restarted seamlessly.
Played with the IPFS in daemon mode
curl -OL https://github.com/ipfs/kubo/releases/download/v0.19.1/kubo_v0.19.1_linux-amd64.tar.gz
tar -zxvf kubo_v0.19.1_linux-amd64.tar.gz
bash kubo/install.sh
ipfs init
Run in daemon mode
ipfs daemon
Initializing daemon...
Kubo version: 0.19.1
Repo version: 13
System version: amd64/linux
Golang version: go1.19.8
Computed default go-libp2p Resource Manager limits based on:
- 'Swarm.ResourceMgr.MaxMemory': "496 MB"
- 'Swarm.ResourceMgr.MaxFileDescriptors': 524288
Theses can be inspected with 'ipfs swarm resources'.
2023/04/30 14:00:49 failed to sufficiently increase receive buffer size (was: 208 kiB, wanted: 2048 kiB, got: 416 kiB). See https://github.com/quic-go/quic-go/wiki/UDP-Receive-Buffer-Size for details.
Swarm listening on /ip4/127.0.0.1/tcp/4001
Swarm listening on /ip4/127.0.0.1/udp/4001/quic
Swarm listening on /ip4/127.0.0.1/udp/4001/quic-v1
Swarm listening on /ip4/127.0.0.1/udp/4001/quic-v1/webtransport/certhash/uEiCvH6BHMTkQzJhxsPDgQ3mokrGFpaPAanfiTIn44LY-uw/certhash/uEiArS423IOw-SiFiQnEIpQ2RDZquEQgotEe_z8-gu4CcTw
Swarm listening on /ip4/172.31.40.254/tcp/4001
...
Conclusion is that in daemon mode application is not not necessary to work in a foreground.
At the same time, systemd service
vi /lib/systemd/system/ipfs.service
[Unit]
Description=InterPlanetary File System (IPFS) daemon
Documentation=https://docs.ipfs.tech
After=network.target
[Service]
LimitNOFILE=10000
MemorySwapMax=0
TimeoutStartSec=infinity
Type=notify
User=root
Group=root
StateDirectory=ipfs
ExecStart=ipfs daemon
Restart=always
RestartSec=2
TimeoutStopSec=5
KillSignal=SIGINT
[Install]
WantedBy=default.target
systemctl enable ipfs
systemctl start ipfs
systemctl status ipfs
We see that service is active (running)
and we can manage it via systemctl (stop|start|restart)
.
Describe the issue
How to run
storage-daemon
as a daemon via systemd?What behavior did you expect?
When we run
storage-daemon
with-d
key it should be run as a daemon in backgroundWhat was the actual behavior?
Application is running in a foreground
How reliably can you reproduce the issue, what are the steps to do so?
storage-daemon
binaryglobal.config.json
configstorage-daemon -C global.config.json -I 0.0.0.0:3333 -p 5555 -D storage-db -d
What version of TON are you using, where did you get it (github actions, self-compiled, etc)?
https://github.com/ton-blockchain/ton/releases/tag/v2023.04
What type of machine are you observing the error on (OS/CPU and disk type)?
Thanks!