iotaledger / one-click-tangle

"One Click Tangle" intends to make lives easier to IOTA adopters by providing pre-configured scripts and recipes that allow to deploy IOTA Networks and Nodes "in one click".
MIT License
55 stars 35 forks source link

Fix/wrong permissions for local snapshots #32

Closed peterokwara closed 3 years ago

peterokwara commented 3 years ago

Description of change

When hornet reaches a checkpoint, the following error shows up in the hornet logs

2021-03-16T14:22:44Z    INFO    Snapshot    snapshot/local_snapshot.go:382  creating local snapshot for targetIndex 16764
2021-03-16T14:22:44Z    WARN    Snapshot    snapshot/plugin.go:196  mkdir snapshots/mainnet: permission denied: creating snapshot failed

A private tangle shouldn't sync up with the mainnet, but it's part of the database.

A path should be added to the local snapshots that hornet is taking (for recovery purpose when database file crashes). Permissions need to be given to the snapshots/private-tangle folder to write out the file. This problem shows up on the node, coo and spammer hence changes need to be made to the config files of this files.

Type of change

Bug fix (a non-breaking change which fixes an issue)

How the change has been tested

The snapshots/private-tangle folder permission were changed to enable hornet to write to the folder.

The config file for the node, spammer and coo, in the snapshots section added the required path. Respectively.

After running the node, coo and spammer till the 100th milestone, the error vanished and instead we have the message

2021-03-19T12:18:42Z    INFO    Tangle  tangle/milestones.go:31 Valid milestone detected! Index: 101, Hash: MVQOKZDLAHYIKKZSHSNG9EMVTSDAL9BHIDGPPQBX9SFMWULACQTSOOWXRSZSJPCDUPUVJODNNNRPZB999
2021-03-19T12:18:42Z    INFO    Tangle  tangle/solidifier.go:394        Run solidity check for Milestone (101)...
2021-03-19T12:18:42Z    INFO    Tangle  tangle/solidifier.go:211        Solidifier finished: txs: 0, collect: 0s, solidity 0s, propagation: 0s, total: 0s
2021-03-19T12:18:42Z    INFO    Tangle  tangle/solidifier.go:449        Milestone confirmed (101): txsConfirmed: 4, txsValue: 0, txsZeroValue: 4, txsConflicting: 0, collect: 0s, total: 0s
2021-03-19T12:18:42Z    INFO    Tangle  tangle/solidifier.go:480        New solid milestone: 101, 0.07 TPS, 0.07 CTPS, 100.00% conf.rate
2021-03-19T12:18:42Z    INFO    Snapshot        snapshot/local_snapshot.go:382  creating local snapshot for targetIndex 51
2021-03-19T12:18:42Z    INFO    Snapshot        snapshot/local_snapshot.go:469  created local snapshot for target index 51 (sha256: 21df71b9354b1aabaea02c03218bc1a57f6f66742de1dfc78812c25e57fd1cd2), took 5.937165ms

And checking the snapshot folder we see the respective bin files listed

image

Change checklist

CaixiangFan commented 3 years ago

Hi, after this fix, I got a permission denied error by running ./private-tangle.sh start 16 on Ubuntu 18.04.

Generating an initial IOTA address holding all IOTAs... Creating network "private-tangle" with the default driver Creating hornet-private-net_address-generator_run ... done ./private-tangle.sh: line 237: ./snapshots/private-tangle/snapshot.csv: Permission denied

I have to use root to run it: sudo ./private-tangle.sh start 16

jmcanterafonseca-iota commented 3 years ago

@CaixiangFan you are totally right, please review this patch https://github.com/iotaledger/one-click-tangle/pull/33