Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TWS with IBC running in an rdesktop container. #45

Merged
merged 17 commits into from
Nov 26, 2023
Merged

TWS with IBC running in an rdesktop container. #45

merged 17 commits into from
Nov 26, 2023

Conversation

gnzsnz
Copy link
Owner

@gnzsnz gnzsnz commented Nov 21, 2023

first running version

Changes to be committed:
modified: .gitignore
modified: .pre-commit-config.yaml
new file: Dockerfile.tws.template
new file: image-files/tws-scripts/start_session.sh
new file: latest/Dockerfile.tws
new file: latest/tws-scripts/start_session.sh
new file: tws-docker-compose.yml

to use it

docker compose -f tws-docker-compose.yml up

first running version

 Changes to be committed:
	modified:   .gitignore
	modified:   .pre-commit-config.yaml
	new file:   Dockerfile.tws.template
	new file:   image-files/tws-scripts/start_session.sh
	new file:   latest/Dockerfile.tws
	new file:   latest/tws-scripts/start_session.sh
	new file:   tws-docker-compose.yml
@gnzsnz
Copy link
Owner Author

gnzsnz commented Nov 21, 2023

@nalon99

could you please check this branch?

you would need to

# pull code
git close https://github.com/gnzsnz/ib-gateway-docker
cd ib-gateway-docker
git switch tws-desktop
# run container
docker compose -f tws-docker-compose.yml up

Based on #43 I explored further the idea of using docker-rdesktop, and I have a very first working version.

the only thing that is working is the desktop environment it self, IBC and TWS. not much more at the moment. but is a good starting point.

If you could review this and provide feedback I would appreciate, after all it was your original idea to run TWS on the container. this will be a different container that ib-gateway-docker, but the codebase if common. I just needed a start-up script for docker-rdesktop and a really simple Dockerfile.tws.

@gnzsnz
Copy link
Owner Author

gnzsnz commented Nov 21, 2023

Open points

  • what we do with CUSTOM_CONFIG, it might not be needed for TWS
    • keep it in common.sh
  • implement SSH tunnel
    • done in common.sh
  • SSH for rdp
  • how to manage ssh-agent, xfce is launching it already
  • fix socat
  • manage abc user password
    • use default pass or set it through env variables
  • timezone for TWS
    • managed in jts.ini , part of common.sh
  • map ports for ibgateway/tws and paper/live trading
  • fix dependencies for chromium
  • test ibgateway with common scipts
    • ssh
    • socat
    • vnc
    • TWS API
  • use custom tls certificates
  • [] CI/CD pipeline
  • [] test
  • update README.sh
  • pin rdesktop version, manage updates of rdesktop
  • enable activeX and socker client
    • "activeX and socker client" enabled in all my tests with no need of telenet
  • can we rename user abc

Changes to be committed:
	modified:   docker-compose.yml
	modified:   image-files/config/ibc/config.ini.tmpl
- logic to switch from user to abc user
- defined common logic between ibgateway and tws in common.sh
- defined logic to default ports based on image type ibgateway/tws and paper/live trading mode
- implemented CUSTOM_CONFIG logic for tws
On branch tws-desktop
Changes to be committed:
	modified:   docker-compose.yml
	modified:   latest/Dockerfile
	modified:   latest/Dockerfile.tws
	new file:   latest/scripts/common.sh
	modified:   latest/scripts/port_forwarding.sh
	modified:   latest/scripts/run.sh
	new file:   latest/tws-scripts/run_tws.sh
	modified:   latest/tws-scripts/start_session.sh
	modified:   tws-docker-compose.yml

Changes not staged for commit:
	modified:   image-files/tws-scripts/start_session.sh
	modified:   latest/scripts/run.sh
	modified:   latest/tws-scripts/start_session.sh
update image-files scripts and config files

Changes to be committed:
	modified:   Dockerfile.template
	modified:   Dockerfile.tws.template
	new file:   image-files/scripts/common.sh
	modified:   image-files/scripts/port_forwarding.sh
	modified:   image-files/scripts/run.sh
	new file:   image-files/tws-scripts/run_tws.sh
	modified:   image-files/tws-scripts/start_session.sh
	modified:   update.sh
keep up-to-date with changes going to main
@nalon99
Copy link

nalon99 commented Nov 24, 2023

sorry for my late answer, too busy at work these days :-(
I followed your instructions to build this new image but when docker compose is starting the container it stops with the following error:
Error response from daemon: error gathering device information while adding custom device "/dev/dri": no such file or directory

@gnzsnz
Copy link
Owner Author

gnzsnz commented Nov 25, 2023

Error response from daemon: error gathering device information while adding custom device "/dev/dri": no such file or directory

edit tws-docker-compose.yml and comment out these lines

    devices:
      - /dev/dri:/dev/dri #optional

it's a recommended setting, but it's optional.

@gnzsnz
Copy link
Owner Author

gnzsnz commented Nov 25, 2023

error message on log

algo-trader-tws-1  | 2023-11-25 18:34:44:465 IBC: detected frame entitled: Dow Jones Today's Top Ten; event=Focused
algo-trader-tws-1  | java.util.concurrent.CompletionException: com.teamdev.jxbrowser.engine.MissingDependencyException: Missing dependencies have been detected:
algo-trader-tws-1  |    chromium => libnssutil3.so libnss3.so libsmime3.so libnspr4.so
algo-trader-tws-1  |    at java.util.concurrent.CompletableFuture.encodeThrowable(CompletableFuture.java:273)
algo-trader-tws-1  |    at java.util.concurrent.CompletableFuture.completeThrowable(CompletableFuture.java:280)
algo-trader-tws-1  |    at java.util.concurrent.CompletableFuture$AsyncSupply.run(CompletableFuture.java:1592)
algo-trader-tws-1  |    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
algo-trader-tws-1  |    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
algo-trader-tws-1  |    at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180)
algo-trader-tws-1  |    at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293)
algo-trader-tws-1  |    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
algo-trader-tws-1  |    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
algo-trader-tws-1  |    at java.lang.Thread.run(Thread.java:748)
algo-trader-tws-1  | Caused by: com.teamdev.jxbrowser.engine.MissingDependencyException: Missing dependencies have been detected:
algo-trader-tws-1  |    chromium => libnssutil3.so libnss3.so libsmime3.so libnspr4.so
algo-trader-tws-1  |    at com.teamdev.jxbrowser.engine.internal.LinuxDependencies.lambda$checkAvailability$1(LinuxDependencies.java:82)
algo-trader-tws-1  |    at java.util.Optional.ifPresent(Optional.java:159)
algo-trader-tws-1  |    at com.teamdev.jxbrowser.engine.internal.LinuxDependencies.checkAvailability(LinuxDependencies.java:67)
algo-trader-tws-1  |    at com.teamdev.jxbrowser.engine.internal.EngineImpl.newInstance(EngineImpl.java:152)
algo-trader-tws-1  |    at com.teamdev.jxbrowser.engine.Engine.newInstance(Engine.java:163)
algo-trader-tws-1  |    at feature.webapp.F.b(F.java:800)
algo-trader-tws-1  |    at feature.webapp.F.a(F.java:709)
algo-trader-tws-1  |    at feature.webapp.F.c(F.java:664)
algo-trader-tws-1  |    at java.util.concurrent.CompletableFuture$AsyncSupply.run(CompletableFuture.java:1590)
al

missing ubuntu packages libnspr4 libnss3

@gnzsnz
Copy link
Owner Author

gnzsnz commented Nov 25, 2023

TWS running in a docker-rdesktop container with XFCE and IBC

Screenshot 2023-11-25 at 20 46 53

update github actions to support ibgateway and tws-rdesktop images
Changes to be committed:
	new file:   .github/workflows/build.yml
	new file:   .github/workflows/on-push-n-pr.yml
	modified:   .github/workflows/publish.yml
	modified:   image-files/tws-scripts/run_tws.sh
	modified:   latest/tws-scripts/run_tws.sh
	modified:   tws-docker-compose.yml
	modified:   update.sh
Changes to be committed:
	modified:   image-files/tws-scripts/run_tws.sh
kill xfce session ssh-agent and gpg-agent
include chromiun dependencies libnspr4 libnss3
avoid duplicate ssh tunnel and agent on tws restart

Changes to be committed:
	modified:   docker-compose.yml
	modified:   image-files/config/ibc/config.ini.tmpl
	modified:   latest/Dockerfile.tws
	modified:   latest/config/ibc/config.ini.tmpl
	modified:   latest/scripts/common.sh
	modified:   latest/scripts/port_forwarding.sh
	modified:   latest/tws-scripts/run_tws.sh
	modified:   latest/tws-scripts/start_session.sh
	modified:   tws-docker-compose.yml
align image-files with latest
fix socat start after tws restart. don't re-start if already running
add messages to run.sh
Changes to be committed:
	modified:   latest/scripts/common.sh
	modified:   latest/scripts/port_forwarding.sh
	modified:   latest/scripts/run.sh
Changes to be committed:
	modified:   tws-docker-compose.yml
@gnzsnz gnzsnz merged commit b47990d into master Nov 26, 2023
0 of 4 checks passed
@ownrepo1s
Copy link
Contributor

ownrepo1s commented Jan 27, 2024

Error response from daemon: error gathering device information while adding custom device "/dev/dri": no such file or directory

edit tws-docker-compose.yml and comment out these lines

    devices:
      - /dev/dri:/dev/dri #optional

it's a recommended setting, but it's optional.

This fixed the same issue happens when running docker compose up on https://github.com/gnzsnz/ib-gateway-docker/blob/master/tws-docker-compose.yml on the main channel.

@gnzsnz
Copy link
Owner Author

gnzsnz commented Jan 27, 2024 via email

@gnzsnz gnzsnz deleted the tws-desktop branch February 26, 2024 12:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants