gnzsnz / ib-gateway-docker

Docker image with IB Gateway/TWS and IBC
https://github.com/users/gnzsnz/packages/container/package/ib-gateway
MIT License
272 stars 50 forks source link

Could not fire up the TWS docker #110

Closed SarunasSS closed 6 months ago

SarunasSS commented 6 months ago

Describe the bug

I've deployed the docker of TWS and it seems to work, but there is no TWS available

To Reproduce

I've deployed the container as per instructuction, but when I connect to it using RDP it shows XRDP login screen which works with credentials abc abc and then I just get into xfce.

Expected

A view of TWS platform

Container logs

tws.tmp.logs.txt

Versions

Additional context

gnzsnz commented 6 months ago

please provide the output of docker compose config, I request in the new issue template to provide it, because most of the issues can be identified by the users themself with it.

what version are you running?, please paste the output of docker images --digests | grep tws-rdesktop

taking bug label off, as that needs to be established.

SarunasSS commented 6 months ago

I've deployed it straight to k8s and here's the config

apiVersion: apps/v1
kind: Deployment
metadata:
  name: &name tws
spec:
  selector:
    matchLabels:
      app: *name
  replicas: 1
  template:
    metadata:
      labels:
        app: *name
    spec:
      containers:
        - name: *name
          image: ghcr.io/gnzsnz/tws-rdesktop:10.29.1f
          ports:
            - containerPort: 3389 # rdp
          env:
            - name: TRADING_MODE
              value: "live"
            - name: READ_ONLY_API
              value: "no"
            - name: AUTO_RESTART_TIME
              value: "11:45 PM"
            - name: TWS_USERID
              valueFrom:
                secretKeyRef:
                  name: ib-account
                  key: username
            - name: TWS_PASSWORD
              valueFrom:
                secretKeyRef:
                  name: ib-account
                  key: password
gnzsnz commented 6 months ago

i still need to know what image version you are using.

in any case, somehow it's falling on this line (or just past it)

https://github.com/gnzsnz/ib-gateway-docker/blob/4b28926bb461eed93bcf3a6f3ca0e8927df9efc3/image-files/tws-scripts/run_tws.sh#L18

I don't see why that might be the case. you can try with:

there is not much on the log file pointing to an issues. there is not even an error message

SarunasSS commented 6 months ago

The PUID & GUID setting worked! So now it opens but does not login, so will have a look what's up there.

Btw, any suggestion how to change the XRDP pass & user?

gnzsnz commented 6 months ago

The PUID & GUID setting worked! So now it opens but does not login, so will have a look what's up there.

it's unlikely that PUID and GUID was the root cause. probably your volume don't have the right permissions. but it's not easy to tell for sure.

make sure you get the container working with docker, and once you are comfortable with it move to k8s.

Btw, any suggestion how to change the XRDP pass & user?

yes, please check the README. I have invested quite some time on it. any suggestion to make it more understandable are more than welcome.

gnzsnz commented 6 months ago

I have confirmed this as a bug. The sample docker compose for TWS works fine, it's just that by not providing PUID and PGID the image fails to start.

This ONLY fails if sample configuration and docker-compose files are not used.

steps to reproduce:

Results:

tws-1  | *************************************************************************
tws-1  | .> Launching IBC/TWS service
tws-1  | *************************************************************************
tws-1  | .> Setting user password
tws-1  | uid=0(root) gid=0(root) groups=0(root)
tws-1  | .> Setting timezone to: Europe/Zurich
tws-1  | .> Openning Xrdp session
tws-1  | .> Xrdp started on DISPLAY=:10
tws-1  | .> Setting permissions for /opt/ibkr and /opt/ibc
tws-1  | *************************************************************************
tws-1  | .> Starting IBC/TWS
tws-1  | *************************************************************************
tws-1  | .> Running as user
tws-1  | uid=911(abc) gid=911(abc) groups=911(abc),27(sudo),44(video),100(users),109(kvm)
tws-1  | .> Disabling ssh-agent and gpg-agent
tws-1  | *************************************************************************
tws-1  | .> Launching IBC/TWS service
tws-1  | *************************************************************************
***** then repeats

XRDP is working and can be used. by manually doing touch /config/.config/disable_agents from terminal within xrdp, the start script is able to continue

tws-1  | *************************************************************************
tws-1  | .> Starting IBC/TWS
tws-1  | *************************************************************************
tws-1  | .> Running as user
tws-1  | uid=911(abc) gid=911(abc) groups=911(abc),27(sudo),44(video),100(users),109(kvm)
tws-1  | .> Disabling ssh-agent and gpg-agent
tws-1  | *************************************************************************
tws-1  | .> Launching IBC/TWS service
tws-1  | *************************************************************************
tws-1  | .> Setting user password
tws-1  | uid=0(root) gid=0(root) groups=0(root)
tws-1  | .> Setting timezone to: Europe/Zurich
tws-1  | .> Openning Xrdp session
tws-1  | .> Xrdp started on DISPLAY=:10                                                                                                                                                                     tws-1  | .> Setting permissions for /opt/ibkr and /opt/ibc                                                                                                                                                  tws-1  | *************************************************************************
tws-1  | .> Starting IBC/TWS
tws-1  | *************************************************************************
tws-1  | .> Running as user
tws-1  | uid=911(abc) gid=911(abc) groups=911(abc),27(sudo),44(video),100(users),109(kvm)
tws-1  | .> Found '/config/.config/disable_agents' agents already disabled
tws-1  | .> Disabling xfce compositing
tws-1  | .> Setting SSH tunnel
tws-1  | .> SSH options: -o ServerAliveInterval=20 -o ServerAliveCountMax=3
tws-1  | .> Java heap size set to 1024m
tws-1  | .> API_PORT set to: 7496
tws-1  | .> SOCAT_PORT set to: 7498
tws-1  | .> Appling settings to IBC's config.ini

somehow the script fails after line 20 of run_tws.sh

something is failing after echo, it could xfconf-query, pkill or touch

    if [ ! -f /config/.config/disable_agents ]; then
        echo ".> Disabling ssh-agent and gpg-agent"
        # disable xfce
        xfconf-query -c xfce4-session -p /startup/ssh-agent/enabled -n -t bool -s false
        xfconf-query -c xfce4-session -p /startup/gpg-agent/enabled -n -t bool -s false
        # kill ssh-agent and gpg-agent
        pkill -x ssh-agent
        pkill -x gpg-agent
        touch /config/.config/disable_agents
gnzsnz commented 6 months ago

fixed on 2534d85