Skip to content
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
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ env:
jobs:
deploy:
runs-on: ubuntu-latest
timeout-minutes: 35
timeout-minutes: 60
permissions:
contents: read
id-token: write
Expand Down
1 change: 1 addition & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ RUN apt-get update && \
libgtk-3-0 \
libxtst6 \
python3-pip \
x11-apps \
xdotool && \
pip3 install pyotp ib_insync --break-system-packages && \
apt-get clean && \
Expand Down
22 changes: 17 additions & 5 deletions container_overrides/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ start_vnc() {

start_IBC() {
configure_ibc_login_dialog_timeout
configure_ibc_second_factor_exit_interval
echo ".> Starting IBC in ${TRADING_MODE} mode, with params:"
echo ".> Version: ${TWS_MAJOR_VRSN}"
echo ".> program: ${IBC_COMMAND:-gateway}"
Expand All @@ -83,8 +84,9 @@ start_IBC() {
echo "$_p" >"/tmp/pid_${TRADING_MODE}"
}

configure_ibc_login_dialog_timeout() {
local timeout="${IBC_LOGIN_DIALOG_DISPLAY_TIMEOUT:-180}"
set_ibc_config_value() {
local key="$1"
local value="$2"
local files=(
"${IBC_INI:-/home/ibgateway/ibc/config.ini}"
"/home/ibgateway/ibc/config.ini"
Expand All @@ -96,14 +98,24 @@ configure_ibc_login_dialog_timeout() {
if [ ! -f "$file" ]; then
continue
fi
if grep -Eq '^LoginDialogDisplayTimeout\s*=' "$file"; then
sed -i -E "s/^LoginDialogDisplayTimeout\s*=.*/LoginDialogDisplayTimeout=${timeout}/" "$file"
if grep -Eq "^${key}\\s*=" "$file"; then
sed -i -E "s/^${key}\\s*=.*/${key}=${value}/" "$file"
else
printf '\nLoginDialogDisplayTimeout=%s\n' "$timeout" >>"$file"
printf '\n%s=%s\n' "$key" "$value" >>"$file"
fi
done
}

configure_ibc_login_dialog_timeout() {
local timeout="${IBC_LOGIN_DIALOG_DISPLAY_TIMEOUT:-180}"
set_ibc_config_value "LoginDialogDisplayTimeout" "$timeout"
}

configure_ibc_second_factor_exit_interval() {
local interval="${IBC_SECOND_FACTOR_AUTHENTICATION_EXIT_INTERVAL:-180}"
set_ibc_config_value "SecondFactorAuthenticationExitInterval" "$interval"
}

configure_ib_gateway_vmoptions() {
local parallel_threads="${IB_GATEWAY_PARALLEL_GC_THREADS:-2}"
local conc_threads="${IB_GATEWAY_CONC_GC_THREADS:-1}"
Expand Down
1 change: 1 addition & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ services:
- TWOFA_DEVICE=${TWOFA_DEVICE:-}
- TWOFA_TIMEOUT_ACTION=${TWOFA_TIMEOUT_ACTION:-restart}
- RELOGIN_AFTER_TWOFA_TIMEOUT=${RELOGIN_AFTER_TWOFA_TIMEOUT:-yes}
- IBC_SECOND_FACTOR_AUTHENTICATION_EXIT_INTERVAL=${IBC_SECOND_FACTOR_AUTHENTICATION_EXIT_INTERVAL:-180}
- EXISTING_SESSION_DETECTED_ACTION=${EXISTING_SESSION_DETECTED_ACTION:-primary}
# Set to no when IBC should use IBKR Mobile push approval instead of
# the local TOTP auto-fill helper.
Expand Down
7 changes: 6 additions & 1 deletion tests/test_docker_compose_ports.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,15 @@ grep -Fq 'chmod a+x /home/ibgateway/scripts/run.sh' "$dockerfile"
grep -Fq 'libgtk-3-0' "$dockerfile"
grep -Fq 'libglib2.0-0' "$dockerfile"
grep -Fq 'libxtst6' "$dockerfile"
grep -Fq 'x11-apps' "$dockerfile"
grep -Fq 'Xvfb "$DISPLAY" -ac -screen 0 "${IB_XVFB_SCREEN:-1024x768x24}" &' "$run_override"
grep -Fq -- '-ncache_cr -noxdamage' "$run_override"
grep -Fq 'configure_ibc_login_dialog_timeout' "$run_override"
grep -Fq 'IBC_LOGIN_DIALOG_DISPLAY_TIMEOUT:-180' "$run_override"
grep -Fq 'LoginDialogDisplayTimeout=${timeout}' "$run_override"
grep -Fq 'set_ibc_config_value "LoginDialogDisplayTimeout" "$timeout"' "$run_override"
grep -Fq 'configure_ibc_second_factor_exit_interval' "$run_override"
grep -Fq 'IBC_SECOND_FACTOR_AUTHENTICATION_EXIT_INTERVAL:-180' "$run_override"
grep -Fq 'set_ibc_config_value "SecondFactorAuthenticationExitInterval" "$interval"' "$run_override"
grep -Fq 'configure_ib_gateway_vmoptions' "$run_override"
grep -Fq 'find "${TWS_PATH}" -maxdepth 3 -name ibgateway.vmoptions' "$run_override"
grep -Fq 'IB_GATEWAY_PARALLEL_GC_THREADS:-2' "$run_override"
Expand All @@ -34,6 +38,7 @@ grep -Fq ' - READ_ONLY_API=${READ_ONLY_API:-no}' "$compose_file"
grep -Fq ' - TWOFA_DEVICE=${TWOFA_DEVICE:-}' "$compose_file"
grep -Fq ' - TWOFA_TIMEOUT_ACTION=${TWOFA_TIMEOUT_ACTION:-restart}' "$compose_file"
grep -Fq ' - RELOGIN_AFTER_TWOFA_TIMEOUT=${RELOGIN_AFTER_TWOFA_TIMEOUT:-yes}' "$compose_file"
grep -Fq ' - IBC_SECOND_FACTOR_AUTHENTICATION_EXIT_INTERVAL=${IBC_SECOND_FACTOR_AUTHENTICATION_EXIT_INTERVAL:-180}' "$compose_file"
grep -Fq ' - EXISTING_SESSION_DETECTED_ACTION=${EXISTING_SESSION_DETECTED_ACTION:-primary}' "$compose_file"
grep -Fq ' - IBKR_2FA_AUTOFILL=${IBKR_2FA_AUTOFILL:-yes}' "$compose_file"
grep -Fq ' - IBKR_2FA_MAX_SUBMISSIONS=${IBKR_2FA_MAX_SUBMISSIONS:-1}' "$compose_file"
Expand Down
2 changes: 1 addition & 1 deletion tests/test_workflow_shared_config.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ grep -Fq 'GCP_PROJECT_ID: interactivebrokersquant' "$workflow_file"
grep -Fq 'providers/github-ibkr-gateway-main' "$workflow_file"
grep -Fq 'ibkr-gateway-deploy@interactivebrokersquant.iam.gserviceaccount.com' "$workflow_file"
grep -Fq 'id-token: write' "$workflow_file"
grep -Fq 'timeout-minutes: 35' "$workflow_file"
grep -Fq 'timeout-minutes: 60' "$workflow_file"
grep -Fq 'sync_github_secrets_to_secret_manager:' "$workflow_file"
grep -Fq 'deploy_mode:' "$workflow_file"
grep -Fq 'workload_identity_provider: ${{ env.GCP_WORKLOAD_IDENTITY_PROVIDER }}' "$workflow_file"
Expand Down