How to use <storage.path: config/storage>?

I noticed in the config.yaml that it might be possible to specify a separate place for storage data:

# path to store data in
# storage.path: config/storage

I have not found any examples on the forum related to it. I understand it should be pretty similar to separating database files with some examples being present on the forum. Those database separation examples seem to be still leaving config.yaml file in the same directory as orders and storage.

What I would like to do is to separate config.yaml and database files from storage. I mean to have in one place only storage and orders and in the other place all other files like database files and config.yaml. Is it possible? Is it maybe possible to set up a node with such a configuration from the very beginning (during the initialization phase)?

For Docker, seems to look that maybe something like that:

    --mount type=bind,source="$idpath",destination=/app/identity \
    --mount type=bind,source="$configpath",destination=/app/config \
    --mount type=bind,source="$storagepath",destination=/app/storage \
    --mount type=bind,source="$dbspath",destination=/app/dbs \
    --mount type=bind,source="$dbspath",destination=/dbs/trust-cache.json

And in config.yaml:

# path to store data in
storage.path: app/storage

# directory to store databases. if empty, uses data path
storage2.database-dir: "dbs"

# file path where trust lists should be cached
storage2.trust.cache-path: "dbs/trust-cache.json"

# url for revocation database (e.g. bolt://some.db OR redis://127.0.0.1:6378?db=2&password=abc123)
server.revocation-dburl: bolt://config/revocations.db

Not sure.

It seems that rather such configuration might be possible after initiating a node with vanilla setup, stopping, changing config.yaml by adding text as in the second snippet and then starting it again with the commands as in the first snippet? Could it be possible to initiate such or similar configuration from the very beginning?

Any comments / suggestions?

Tried, no, receiving:

Error: Error starting master database on storagenode: group:
--- stat app/storage/blobs: no such file or directory
--- stat app/storage/temp: no such file or directory
--- stat app/storage/garbage: no such file or directory
--- stat app/storage/trash: no such file or directory

Maybe should use:

--mount type=bind,source="$storagepath",destination=/config/storage \

instead of initially used

--mount type=bind,source="$storagepath",destination=/app/storage \

Have to admit that not quite in full understand this directory structure inside a container. Any suggestions welcomed.

This is the option to provide a path for data location.
In the docker version it’s defaulted to /app/config/storage.

When you specified path like this:

your mount option should be

--mount type=bind,source="$storagepath",destination=/app/app \

because the default working directory inside the container is /app.
By the way with this mount your storage folder will be $storagepath/storage.

So, you either need to provide an absolute path in the option or take into a consideration that working directory is /app, if you going to use relative paths.

This will not work:

you either need to mount a folder or file, otherwise inside the container you will get a folder, named trust-cache.json with database files inside.
So, in your case this mount is redundant:

However, I do not understand what are you trying to achieve?

However, I do not understand what are you trying to achieve?

Sorry. I indicated it in the third paragraph of my initial post in this thread. Let me briefly rephrase. The aim is to configure my storage node in a way that:

i) all database files (*.db), config.yaml and also trust-cache.json (forgot about this file earlier) are located in: /absolute/path/to/directory1

and

ii) directories such as orders and storage are located in: /absolute/path/to/directory2.

Ideally, I would like to do it at the moment of the very first start of my node (setup stage).

So far, I’ve been reading posts about moving database files and some also about moving orders directory (to be clear I do not think moving orders is to my interest currently - as I wrote would like it to stay in the same place as storage).

I was doing it in a two (or three) stage process: setting up vanilla node, starting vanilla node, stopping vanilla node, accessing config.yaml and making there appropriate changes, starting a node with adjusted configuration which resulted in a situation that:

a) in my “config location” I had: config.yaml, orders directory, revocations.db and storage directory,

and

b) in my other location I had all *.db files and trust-cache.json.

Which I hope you can see, is slightly different from what I would like to achieve finally.

Do you think that it is possible to do a setup as I have on my mind?

When you run the docker setup command, you simply define your desired paths.
For example for database you add
--mount type=bind,source="path/to/database",destination=/app/database and
--storage2.database-dir database.
This maps the host file system database path to docker app database path and sets it accordingly in the config.yaml.
For all other desired changes you would have to do it similarly.

1 Like

Thanks. I was not aware that I can add this command when starting a node. My understanding so far was that I need at least two steps, creation and modification of config.yaml. Will give it a try to reach my desired setup.

Check out this thread it should help:

1 Like

Hi, it seems there were some breaking changes or I still do not fully understand what is going on. Really looking for some additional comments, best would be a straight solution. Below pls find the code. Sorry that this time it is podman not docker, however, the difference should be negligible.

$snname=storagenode
idpath="$homedir/.local/share/storj/identity/$snname"

configpath="/absolute/path/to/directory1"
databasepath="/absolute/path/to/directory1"

storagepath="/absolute/path/to/directory2"

mkdir -p $configpath
mkdir -p $storagepath
podman run --rm  \
    -e PUID=$(id -u) \
    -e PGID=$(id -g) \
    --volume "$idpath":/app/identity:Z \
    --volume "$configpath":/app/config:Z \
    --volume "$databasepath":/app/database:Z \
    --volume "$storagepath":/app/storage \
    --name $snname docker.io/storjlabs/storagenode:latest \
    --identity-dir identity --config-dir config  --storage2.database-dir database --storage.path storage --log.output database/storagenode.log

Result:

2023-07-22 23:50:36,694 INFO success: storagenode-updater entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
2023-07-22 23:50:36,734 INFO exited: storagenode (exit status 1; not expected)
2023-07-22 23:50:38,738 INFO spawned: 'storagenode' with pid 85
2023-07-22 23:50:38,776 INFO exited: storagenode (exit status 1; not expected)
2023-07-22 23:50:41,780 INFO spawned: 'storagenode' with pid 94
2023-07-22 23:50:41,820 INFO exited: storagenode (exit status 1; not expected)
2023-07-22 23:50:42,821 INFO gave up: storagenode entered FATAL state, too many start retries too quickly
2023-07-22 23:50:43,822 WARN received SIGQUIT indicating exit request
2023-07-22 23:50:43,823 INFO waiting for processes-exit-eventlistener, storagenode-updater to die
2023-07-22T23:50:43.823Z        INFO    Got a signal from the OS: "terminated"  {"Process": "storagenode-updater"}
2023-07-22 23:50:43,825 INFO stopped: storagenode-updater (exit status 0)
2023-07-22 23:50:44,827 INFO stopped: processes-exit-eventlistener (terminated by SIGTERM)

What I would like to do is to:

i) all database files (*.db), config.yaml and also trust-cache.json to be located in: /absolute/path/to/directory1, also I would like to keep the the log file in this location

and

ii) directories such as orders and storage to be located in: /absolute/path/to/directory2.

Would there be any referential example of code that separates storage from all other files?

Since you did not specify the path to orders subfolder, it will be created in the --config-dir location by default.

for that you should mount it like this:

--volume "$storagepath/storage":/app/storage \

because you specified --storage.path like this:

Please provide the 20 last lines from your logs in "$databasepath/storagenode.log"