stalkopat / hummingbot-kubernetes

Running hummingbot on kubernetes
14 stars 6 forks source link

Example-StatefulSet-BTC-USDT.yaml no longer functioning? #2

Open RichGenesis opened 1 year ago

RichGenesis commented 1 year ago

I set up a k8s cluster using https://k3s.io/ - all seems fine so far, I have run other pods on it successfully.

Downloaded Example-StatefulSet-BTC-USDT.yaml and ran it with

# kubectl apply -f ./Example-StatefulSet-BTC-USDT.yaml

# kubectl get pods
NAME                          READY   STATUS             RESTARTS        AGE
btc-usdt-0                    0/1     CrashLoopBackOff   6 (2m29s ago) 8m22s

and the logs:

# kubectl logs btc-usdt-0
Traceback (most recent call last):
  File "bin/hummingbot_quickstart.py", line 152, in <module>
    fork_and_start(main)
  File "/home/hummingbot/bin/docker_connection.py", line 137, in fork_and_start
    main_function()
  File "bin/hummingbot_quickstart.py", line 148, in main
    asyncio.get_event_loop().run_until_complete(quick_start(args, secrets_manager))
  File "/home/hummingbot/miniconda3/envs/hummingbot/lib/python3.8/asyncio/base_events.py", line 616, in run_until_complete
    return future.result()
  File "bin/hummingbot_quickstart.py", line 83, in quick_start
    if not Security.login(secrets_manager):
  File "/home/hummingbot/hummingbot/client/config/security.py", line 42, in login
    if not validate_password(secrets_manager):
  File "/home/hummingbot/hummingbot/client/config/config_crypt.py", line 72, in validate_password
    with open(PASSWORD_VERIFICATION_PATH, "r") as f:
FileNotFoundError: [Errno 2] No such file or directory: '/home/hummingbot/conf/.password_verification'

I have tried updating the example my own password, and with .password_verification before the quickstart.yml:

data: .password_verification: | 7b226.....0337d quickstart.yml: |

But then regardless of what I try, the best I can manage is:

:
  File "/home/hummingbot/hummingbot/client/config/config_crypt.py", line 75, in validate_password
    decrypted_word = secrets_manager.decrypt_secret_value(PASSWORD_VERIFICATION_WORD, encrypted_word)
  File "/home/hummingbot/hummingbot/client/config/config_crypt.py", line 59, in decrypt_secret_value
    value = binascii.unhexlify(value)
binascii.Error: Odd-length string

I can't get a shell into the pod to check exactly what is being created.

Has something changed with using this image in the 8 months since the example.yaml was posted, or am I doing something wrong here?

stalkopat commented 1 year ago

Its possible that the required configuration files have changed since I created this repo, please remove the startup arguments inside the yaml, you should then be able to ssh / exec into the pod and check what the contents of .password_verification are after its mounted and copied from the ConfigMap. I'm guessing there is some missing part of your .password_verification or possibly an escaping issue.

RichGenesis commented 1 year ago

Thank you for your reply. I took the downloaded yaml and removed the containers:command: and args: section, then I was able to get a shell.

There doesn't appear to be a .password_verification file as "standard", which would explain my initial error.

# kubectl exec --stdin --tty  btc-usdt-0  -- /bin/bash
root@btc-usdt-0:/home/hummingbot# ls -al conf
lrwxrwxrwx 1 root root 5 Oct 26 13:26 conf -> /conf
root@btc-usdt-0:/home/hummingbot# ls -al conf/
total 40
drwxr-xr-x 4 hummingbot hummingbot 4096 Nov 22 14:34 .
drwxr-xr-x 1 root       root       4096 Nov 22 14:34 ..
-rw-r--r-- 1 hummingbot hummingbot   55 Oct 26 13:01 .dockerignore
-rw-r--r-- 1 hummingbot hummingbot   36 Oct 26 13:01 .gitignore
-rw-r--r-- 1 hummingbot hummingbot 4140 Oct 26 13:01 __init__.py
-rw-r--r-- 1 root       root       4218 Nov 22 14:34 conf_client.yml
drwxr-xr-x 2 hummingbot hummingbot 4096 Nov 22 14:34 connectors
drwxr-xr-x 2 hummingbot hummingbot 4096 Nov 22 14:34 strategies
root@btc-usdt-0:/home/hummingbot# find conf/ 
conf/
conf/conf_client.yml
conf/__init__.py
conf/connectors
conf/connectors/__init__.py
conf/connectors/.gitignore
conf/connectors/.dockerignore
conf/strategies
conf/strategies/__init__.py
conf/strategies/.gitignore
conf/strategies/.dockerignore
conf/.gitignore
conf/.dockerignore

When I did the same to my copy with the .password_verification section in the yaml, when I create a shell in I get:

# more /readonly-conf/.password_verification
7b22...337d

so that seems "OK", i'll keep investigating what might be going on!

RichGenesis commented 1 year ago

I finally diagnosed the .password_verification issue as a stray 0A char, and I had to modify the -f parameter in the "args" to include /conf/ before it would start, so finished with this:

          args:
            - -c
            - >
              cp -r /readonly-conf/. /conf ; cat /conf/.password_verification_lf | tr -d '\n' > /conf/.password_verification ; /home/hummingbot/miniconda3/envs/$(head -1 setup/environment-linux.yml | cut -d' ' -f2)/bin/python3
              bin/hummingbot_quickstart.py
              -p ...
              -f /conf/quickstart.yml

(there are probably more elegant ways to solve the 0A issue)