Docker setup command with settings?

When using docker run \ --rm -e SETUP="true" \ is it possible to add settings parameters for config.yaml within the command? If yes, how can this be done?

No, it’s not possible in normal way. The entrypoint inside the container looks like:

As you can see, nothing custom transferred to the storagenode setup command.

But you can hack it:

docker run -it --rm --entrypoint /app/storagenode \
  --mount type=bind,source=/mnt/storj/storagenode/identity,destination=/app/identity \
  --mount type=bind,source=/mnt/storj/storagenode,destination=/app/config \
  storjlabs/storagenode:latest \
  setup --config-dir config --identity-dir identity --log.output config/storagenode.log

I added --log.output config/storagenode.log in that example

5 Likes

Thanks, I’ll have a look at it.

1 Like

This works very well.
Just one more question: When I add a mount for an orders directory and use the flag --storage2.orders.path string and run the setup command I get Error: unknown flag: --storage2.orders.

Can this flag not be used on setup?

Oh I just realized I did not copy the flag fully into my setup command.

With the correct command it is working without a problem.

Seems you missed the last part of the option - .path

docker exec -it storagenode2 ./storagenode setup --help | sls orders

      --storage2.orders.archive-ttl duration                     length of time to archive orders before deletion
(default 168h0m0s)
      --storage2.orders.cleanup-interval duration                duration between archive cleanups (default 5m0s)
      --storage2.orders.max-sleep duration                       maximum duration to wait before trying to send orders
(default 30s)
      --storage2.orders.path string                              path to store order limit files in (default
"/root/.local/share/storj/storagenode/orders")
      --storage2.orders.sender-dial-timeout duration             timeout for dialing satellite during sending orders
(default 1m0s)
      --storage2.orders.sender-interval duration                 duration between sending (default 1h0m0s)
      --storage2.orders.sender-timeout duration                  timeout for sending (default 1h0m0s)

It should be something like

docker run -it ... --mount type=bind,source=/var/storj/orders,destination=/app/orders  --name storagenode storjlabs/storagenode --storage2.orders.path=/app/orders

If we still talking about setup, then

docker run -it --rm --entrypoint /app/storagenode \
  --mount type=bind,source=/mnt/storj/storagenode/identity,destination=/app/identity \
  --mount type=bind,source=/mnt/storj/storagenode,destination=/app/config \
  --mount type=bind,source=/var/storj/orders,destination=/app/orders \
  storjlabs/storagenode:latest \
  setup --config-dir config --identity-dir identity --log.output config/storagenode.log \
    --storage2.orders.path=/app/orders

Yes exactly. I did not copy the full flag from my list of flags.

1 Like

My working setup command is no longer working. I get:

docker: Error response from daemon: OCI runtime create failed: container_linux.go:344: starting container process caused "exec: \"/app/storagenode\": stat /app/storagenode: no such file or directory": unknown.

Has there been a change in code that requires a change to the command?

There was a controversial change where the storagenode binary is no longer shipped with the container because we wanted more control over the rollout. (There was a big thread somewhere, can’t find it).

The container entrypoint now downloads storagenode-updater which in turn downloads the storagenode binary.

I see, so what is the correct command now to make those changes on setup?

It may be enough to remove --entrypoint /app/storagenode and setup

If not you may find some hints in storj/entrypoint at 7afdb15fc872e555ed7b5ef6a43405d2f5a617f0 · storj/storj · GitHub on what variables to set or which ones we’d need to expose with a change request.

1 Like

Woot, yes you are right. Thanks. :partying_face:

Not everyone is a coder and I can barely read my own code… :scream:

1 Like