How to graceful-exit on Truenas?

hi, could you share how you proceed with graceful-exit on Truenas? I couldn’t find any documentations. When I tried

docker exec -it storagenode /app/storagenode exit-satellite --identity-dir /app/identity

using Truenas shell command, it says no such container.

Thank you in advance.

Depends on how you run the container.
If using the app, then it likely run in kubernetes.
For this you need to have either kubectl or search in the UI how you can exec a command inside the running pod, but basically you need something like

kubectl get po -A | grep "storagenode"

this will allow you to find the pod with storagenode
then

kubectl exec -it here_is_the_name_of_the_storagenode_pod ./storagenode exit-satellite --identity-dir identity --config-dir config

If you run it as a usual docker container, you need to figure out what is the container name

docker ps | grep storagenode
1 Like

hi Alexy

I was able to find my pod and I need to add k3s before the command you provided, but after I run the command , it shows

error: unknown flag: --identity-dir

any suggestions?
Thanks

Please show the whole command

root@truenas[~]# k3s kubectl exec -it storj1-storj-node-579dbdfb7c-wmnhp ./storagenode exit-satellite --identity-dir identity --config-dir config
error: unknown flag: --identity-dir
See 'kubectl exec --help' for usage.
root@truenas[~]# 

oh yes, sorry

Usage:
  kubectl exec (POD | TYPE/NAME) [-c CONTAINER] [flags] -- COMMAND [args...] [options]

so,

k3s kubectl exec -it storj1-storj-node-579dbdfb7c-wmnhp -- ./storagenode exit-satellite --identity-dir identity --config-dir config

Thanks Alexey!

The following command worked for me with namespace ix-storj1

k3s kubectl exec -it --namespace ix-storj1 storj1-storj-node-579dbdfb7c-wmnhp -- ./storagenode exit-satellite --identity-dir identity --config-dir config
1 Like

I think you may also simple open a shell to the app and execute the command there, i.e.

./storagenode exit-satellite --identity-dir identity --config-dir config
1 Like

yes, just tried this method, go to APP and choose the SHELL for Storj and it works perfectlly.
Thanks!

3 Likes

hi bigjimmy how do you find your podname ?

Hello @nico1234,
Welcome to the forum!

The easiest would be to open a shell directly in the application’s menu

1 Like

thank you

ok i got you.

maybe its amateur problem, but when i execute the command above

kubectl exec -it here_is_the_name_of_the_storagenode_pod ./storagenode exit-satellite --identity-dir identity --config-dir config

my system give me back /bin/sh: kubectl not found

after 16+ months it would be nice to get a greatful exit.

in a monetary way its not a great deal but… i like to see things work =)

the biggest problem is,

Wahts the name of my storage node or the pod name ?

There is no need to know the pod name. You can just open a shell inside the container and execute the storagenode command. This is from TrueNAS Scale but Core should have a similar button or menu.

1 Like

There are three alternatives:

  1. via docker
# to find the container
sudo docker ps | grep storj
# to enter the shell
sudo docker exec -it <container-name> bash
  1. via kubectl
# to get the pod name
sudo k3s kubectl get pod -A | grep storj
# to enter the shell
sudo k3s kubectl exec -it <pod-name> -n ix-storj -- bash
  1. via UI
1 Like

Thank you for you fast response.

I choose the way above within the app shellPreformatted text

WARNING: Your user does not have sudo privileges so /usr/local/bin/k3s command will run
on your behalf. This might cause permission issues.

$ ./storagenode exit-satellite --identity-dir identity --config-dir config./storagenode exit-satellite --identity-dir identity --config-dir config
2024-04-16T16:05:46Z    INFO    Configuration loaded    {"Process": "storagenode", "Location": "/app/config/config.yaml"}
2024-04-16T16:05:46Z    INFO    Anonymized tracing enabled      {"Process": "storagenode"}
2024-04-16T16:05:46Z    INFO    Identity loaded.        {"Process": "storagenode", "Node ID": "12ke4aaDAJK3Vuf5uZprmxwgswzgw32XdK1jrkP1Rv3Wy4zfGNr"}
By starting a graceful exit from a satellite, you will no longer receive new uploads from that satellite.
This action can not be undone.
Are you sure you want to continue? [y/n]
 :y
Domain Name                  Node ID                                              Space Used  
saltlake.tardigrade.io:7777  1wFTAgs9DP5RSnCqKV1eLf6N9wtk4EAtmN5DpSxcs8EjT69tGE   122.67 GB   
ap1.storj.io:7777            121RTSDpyNZVcEU84Ticf2L1ntiuUimbWgfATz21tuvgk3vzoA6  153.23 GB   
us1.storj.io:7777            12EayRS2V1kEsWESU9QMRseFhdxYxKicsiFmxrsLZHeLUtdps3S  3.10 TB     
eu1.storj.io:7777            12L9ZFwhzVpuEKMUNUqkaTLGzwY9G24tbiigLiXpmZWKwmcNDDs  2.23 TB     
Please enter a space delimited list of satellite domain names you would like to gracefully exit. Press enter to continue:

Invalid input. Please use valid satellite domian names.
Error: Invalid satellite domain names
$ saltlake
/bin/sh: 2: saltlake: not found
$ us1.storj.io
/bin/sh: 3: us1.storj.io: not found
$ us.storj.io:7777
/bin/sh: 4: us.storj.io:7777: not found
$ ^C
$ ap1.storj.io:7777
/bin/sh: 5: ap1.storj.io:7777: not found
$

Thank you for your guidance and patience

it should be like I suggested before

please note, these paths identity and config should be like that, they are paths inside the container.
Perhaps the simple double paste and you actually did run it correctly not like you presented here?

you need to provide them as a list of their domain names including port, i.e.

saltlake.tardigrade.io:7777,ap1.storj.io:7777,us1.storj.io:7777,eu1.storj.io:7777

Seems you pressed the Enter passing an empty list, so the command was finished with a error.

1 Like

thanks the only issue was the empty list its work now thanks a lot

1 Like