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

A11y bus #60

Merged
merged 3 commits into from
Jan 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Dockerfile.tws.template
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ ENV IBC_PATH=/opt/ibc
ENV IBC_INI=${IBC_PATH}/config.ini
ENV SCRIPT_PATH=/defaults
ENV GATEWAY_OR_TWS=tws
ENV NO_AT_BRIDGE=1

ARG DEBIAN_FRONTEND=noninteractive

Expand Down
2 changes: 1 addition & 1 deletion image-files/scripts/common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

setup_ssh() {
# setup SSH Tunnel
if [ "$SSH_TUNNEL" = "yes" ]; then
if [ "$SSH_TUNNEL" = "yes" ] || [ "$SSH_TUNNEL" = "both" ]; then
echo ".> Setting SSH tunnel"

_SSH_OPTIONS="-o ServerAliveInterval=${SSH_ALIVE_INTERVAL:-20}"
Expand Down
31 changes: 21 additions & 10 deletions image-files/scripts/port_forwarding.sh
Original file line number Diff line number Diff line change
@@ -1,13 +1,6 @@
#!/bin/bash

# validate API port
if [ -z "${API_PORT}" ]; then
echo ".> API_PORT not set, port: ${API_PORT}"
exit 1
fi

if [ "$SSH_TUNNEL" = "yes" ]; then

start_ssh() {
if [ -n "$(pgrep -x ssh)" ]; then
# if this script is already running don't start it
echo ".> SSH tunnel already active. Not starting a new one"
Expand All @@ -34,12 +27,18 @@ if [ "$SSH_TUNNEL" = "yes" ]; then
echo ".> SSH_RDP_TUNNEL set to :${SSH_SCREEN}"
fi

if [ "$SSH_TUNNEL" = "both" ]; then
start_socat
fi

while true; do
echo ".> Starting ssh tunnel with ssh sock: $SSH_AUTH_SOCK"
bash -c "ssh ${SSH_ALL_OPTIONS} -TNR 127.0.0.1:${API_PORT}:localhost:${SSH_REMOTE_PORT} ${SSH_SCREEN:-} ${SSH_USER_TUNNEL}"
sleep "${SSH_RESTART:-5}"
done
else
}

start_socat() {
if [ -z "${SOCAT_PORT}" ]; then
echo ".> SOCAT_PORT not set, port: ${SOCAT_PORT}"
exit 1
Expand All @@ -56,5 +55,17 @@ else
#
printf "Forking :::%d onto 0.0.0.0:%d > trading mode %s \n" \
"${API_PORT}" "${SOCAT_PORT}" "${TRADING_MODE}"
socat TCP-LISTEN:"${SOCAT_PORT}",fork TCP:127.0.0.1:"${API_PORT}"
socat TCP-LISTEN:"${SOCAT_PORT}",fork TCP:127.0.0.1:"${API_PORT}" &
}

# validate API port
if [ -z "${API_PORT}" ]; then
echo ".> API_PORT not set, port: ${API_PORT}"
exit 1
fi

if [ "$SSH_TUNNEL" = "yes" ] || [ "$SSH_TUNNEL" = "both" ]; then
start_ssh
else
start_socat
fi
2 changes: 1 addition & 1 deletion image-files/scripts/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ set_ports
# Java heap size
set_java_heap

# forward ports, socat or ssh
# forward ports, socat/ssh
"${SCRIPT_PATH}/port_forwarding.sh" &

echo ".> Starting IBC with params:"
Expand Down
2 changes: 1 addition & 1 deletion image-files/tws-scripts/run_tws.sh
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ apply_settings
# Java heap size
set_java_heap

# forward ports, socat or ssh
# forward ports, socat/ssh
"${SCRIPT_PATH}/port_forwarding.sh" &

# start IBC
Expand Down
2 changes: 1 addition & 1 deletion template_README.md
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ All environment variables are common between ibgateway and TWS image, unless spe
| `TWS_SETTINGS_PATH` | Settings path used by IBC's parameter `--tws_settings_path`. Use with a volume to preserve settings in the volume. | |
| `CUSTOM_CONFIG` | If set to `yes`, then `run.sh` will not generate config files using env variables. You should mount config files. Use with care and only if you know what you are doing. | NO |
| `JAVA_HEAP_SIZE` | Set Java heap, default 768MB, TWS might need more. Proposed value 1024. Enter just the number, don't enter units, ex mb. See [Increase Memory Size for TWS](https://ibkrguides.com/tws/usersguidebook/priceriskanalytics/custommemory.htm) | **not defined** |
| `SSH_TUNNEL` | If set to `yes` then `socat` won't start, instead a remote ssh tunnel is started. SSH keys should be provided to container through ~/.ssh volume. | **not defined** |
| `SSH_TUNNEL` | If set to `yes` then `socat` won't start, instead a remote ssh tunnel is started. if set to `both` then `socat` and remote ssh tunnel are started. SSH keys should be provided to container through ~/.ssh volume. | **not defined** |
| `SSH_OPTIONS` | additional options for [ssh](https://manpages.ubuntu.com/manpages/jammy/en/man1/ssh.1.html) client | **not defined** |
| `SSH_ALIVE_INTERVAL` | [ssh](https://manpages.ubuntu.com/manpages/jammy/en/man1/ssh.1.html) `ServerAliveInterval` setting. Don't set it in `SSH_OPTIONS` as this behavior is undefined. | 20 |
| `SSH_ALIVE_COUNT` | [ssh](https://manpages.ubuntu.com/manpages/jammy/en/man1/ssh.1.html) `ServerAliveCountMax` setting. Don't set it in `SSH_OPTIONS` as this behavior is undefined. | 3 |
Expand Down
Loading