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

standalone custom port rather than 5000 #224

Closed
yezhengli-Mr9 opened this issue Dec 5, 2024 · 5 comments
Closed

standalone custom port rather than 5000 #224

yezhengli-Mr9 opened this issue Dec 5, 2024 · 5 comments
Labels
enhancement New feature or request

Comments

@yezhengli-Mr9
Copy link

Describe the feature
A clear and concise description of what feature you'd like to suggest.

python ibeam_starter.py

standalone custom port rather than 5000

Expected interaction
How would users interact with the feature. Include code if possible.

Possible implications
Describe which parts of the existing system could this feature affect and in what way.

Additional context
Add any other context about the feature here.

@yezhengli-Mr9 yezhengli-Mr9 added the enhancement New feature or request label Dec 5, 2024
@Voyz
Copy link
Owner

Voyz commented Dec 5, 2024

@yezhengli-Mr9
Copy link
Author

Thanks, I was able to check back this feature.

For standalone mode, tried to change yamls as well as modifying codes like
ibeam/src/var.py

support/verify_connection.py

import yaml

# Load the YAML configuration file
with open(os.path.join(GATEWAY_DIR,'root/conf.yaml'), 'r') as file:
    config = yaml.safe_load(file)
# Access the listenPort value
listen_port = config.get('listenPort')
print(f"Listen Port: {listen_port}")
GATEWAY_BASE_URL = os.environ.get('IBEAM_GATEWAY_BASE_URL', f"https://localhost:{listen_port}")

and copy_cache/clientportal.gw/root/webapps/demo/index.html

window.GATEWAY_BASE_URL = "https://localhost:6000/v1/api";

but still get

  19:00:08,652|I| Gateway running but not serving yet. Consider increasing IBEAM_GATEWAY_STARTUP timeout. Error: <urlopen error [Errno 111] Connection refused>
2024-12-30 19:00:08,652|I| NO SESSION Status(running=True, session=False, connected=False, authenticated=False, competing=False, collision=False, session_id=None, server_name=None, server_version=None, expires=None)
2024-12-30 19:00:08,652|I| Authentication strategy: "B"
2024-12-30 19:00:08,652|I| No active sessions, logging in...
2024-12-30 19:00:08,652|I| Loading auth webpage at https://localhost:6000/sso/Login?forwardTo=22&RL=1&ip2loc=on
 -> mount demo on /demo
Java Version: 19.0.2
****************************************************
version: a27ed42161ad96c53e715ca5c5e3e3fa4cff5262 Mon, 24 Apr 2023 15:41:53 -0400
****************************************************
This is the Client Portal Gateway
for any issues, please contact [email protected]
and include a copy of your logs
****************************************************
https://www.interactivebrokers.com/api/doc.html
****************************************************
Open https://localhost:6000 to login
App demo is available after you login under: https://localhost:6000/demo#/
2024-12-30 19:00:19,443|W| Cannot determine the version of IBKR website, assuming version 2
website_version 2
2024-12-30 19:00:40,064|E| Timeout reached when waiting for authentication. The website seems to not be loaded correctly. Consider increasing IBEAM_PAGE_LOAD_TIMEOUT. 
Website URL: https://localhost:6000/sso/Login?forwardTo=22&RL=1&ip2loc=on 
 
Exception:
  File "/home/<USERNAME>/github/ibeam-custom/ibeam/ibeam_starter.py", line 172, in <module>
    success, shutdown, status = client.start_and_authenticate()
  File "/home/<USERNAME>/github/ibeam-custom/ibeam/src/gateway_client.py", line 62, in start_and_authenticate
    success, shutdown, status = self.strategy_handler.try_authenticating(request_retries=request_retries)
  File "/home/<USERNAME>/github/ibeam-custom/ibeam/src/handlers/strategy_handler.py", line 85, in try_authenticating
    return self._authentication_strategy_B(status, request_retries)
  File "/home/<USERNAME>/github/ibeam-custom/ibeam/src/handlers/strategy_handler.py", line 140, in _authentication_strategy_B
    return self._log_in(status)
  File "/home/<USERNAME>/github/ibeam-custom/ibeam/src/handlers/strategy_handler.py", line 151, in _log_in
    success, shutdown = self.login_handler.login()
  File "/home/<USERNAME>/github/ibeam-custom/ibeam/src/handlers/login_handler.py", line 467, in login
    self.handle_timeout_exception(e, targets, driver, website_version, self.route_auth, self.base_url, self.outputs_dir)
  File "/home/<USERNAME>/github/ibeam-custom/ibeam/src/handlers/login_handler.py", line 433, in login
    wait_and_identify_trigger = self.load_page(targets, driver, self.base_url, self.route_auth)
                                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/<USERNAME>/github/ibeam-custom/ibeam/src/handlers/login_handler.py", line 406, in load_page
    wait_and_identify_trigger(is_clickable(targets['USER_NAME']), skip_identify=True)
  File "/home/<USERNAME>/github/ibeam-custom/ibeam/src/handlers/login_handler.py", line 67, in _wait_and_identify_trigger
    trigger = WebDriverWait(driver, timeout).until(any_of(*expected_conditions))
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/<USERNAME>/miniconda3/lib/python3.12/site-packages/selenium/webdriver/support/wait.py", line 105, in until
    raise TimeoutException(message, screen, stacktrace)

  <class 'selenium.common.exceptions.TimeoutException'> Message: 

2024-12-30 19:00:40,065|I| Cleaning up the resources. Display: <pyvirtualdisplay.display.Display object at 0x7f503b24d130> | Driver: <selenium.webdriver.chrome.webdriver.WebDriver (session="cf8ce32abb09d2208cd907b83d07c25c")>
2024-12-30 19:00:40,135|I| Logging in failed
2024-12-30 19:00:40,137|I| Starting maintenance with interval 60 seconds
^C2024-12-30 19:00:54,604|I| Keyboard interrupt, shutting down.

@yezhengli-Mr9
Copy link
Author

Complete logs is here

2024-12-30 19:00:08,616|I| ############ Starting IBeam version 0.5.5 ############
2024-12-30 19:00:08,618|I| Secrets source: env
2024-12-30 19:00:08,618|I| Health server started at port=5001
2024-12-30 19:00:08,619|I| Configuration:
{'INPUTS_DIR': '/srv/inputs/', 'OUTPUTS_DIR': '/home/<USERNAME>/github/ibeam-custom/outputs', 'GATEWAY_DIR': '/home/<USERNAME>/Downloads/clientportal.gw', 'CHROME_DRIVER_PATH': '/usr/bin/chromedriver', 'GATEWAY_STARTUP': 20, 'GATEWAY_PROCESS_MATCH': 'ibgroup.web.core.clientportal.gw.GatewayStart', 'MAINTENANCE_INTERVAL': 60, 'SPAWN_NEW_PROCESSES': False, 'LOG_LEVEL': 'INFO', 'LOG_TO_FILE': True, 'LOG_FORMAT': '%(asctime)s|%(levelname)-.1s| %(message)s', 'REQUEST_RETRIES': 2, 'REQUEST_TIMEOUT': 15, 'RESTART_FAILED_SESSIONS': True, 'RESTART_WAIT': 15, 'REAUTHENTICATE_WAIT': 15, 'HEALTH_SERVER_PORT': 5001, 'SECRETS_SOURCE': 'env', 'GCP_SECRETS_URL': None, 'START_ACTIVE': True, 'GATEWAY_BASE_URL': 'https://localhost:6000', 'ROUTE_AUTH': '/sso/Login?forwardTo=22&RL=1&ip2loc=on', 'ROUTE_VALIDATE': '/v1/portal/sso/validate', 'ROUTE_REAUTHENTICATE': '/v1/portal/iserver/reauthenticate?force=true', 'ROUTE_INITIALISE': '/v1/api/iserver/auth/ssodh/init', 'ROUTE_AUTH_STATUS': '/v1/api/iserver/auth/status', 'ROUTE_TICKLE': '/v1/api/tickle', 'ROUTE_LOGOUT': '/v1/api/logout', 'USER_NAME_EL': None, 'PASSWORD_EL': 'NAME@@password', 'SUBMIT_EL': 'CSS_SELECTOR@@.btn.btn-lg.btn-primary', 'ERROR_EL': None, 'SUCCESS_EL_TEXT': 'TAG_NAME@@Client login succeeds', 'OAUTH_TIMEOUT': 15, 'PAGE_LOAD_TIMEOUT': 15, 'ERROR_SCREENSHOTS': False, 'MAX_FAILED_AUTH': 5, 'MIN_PRESUBMIT_BUFFER': 5, 'MAX_PRESUBMIT_BUFFER': 30, 'MAX_IMMEDIATE_ATTEMPTS': 10, 'IBKEY_PROMO_EL_CLASS': 'CLASS_NAME@@ibkey-promo-skip', 'AUTHENTICATION_STRATEGY': 'B', 'MAX_STATUS_CHECK_RETRIES': 120, 'MAX_REAUTHENTICATE_RETRIES': 3, 'UI_SCALING': 1.0, 'TWO_FA_EL_ID': 'ID@@twofactbase', 'TWO_FA_NOTIFICATION_EL': 'CLASS_NAME@@login-step-notification', 'TWO_FA_INPUT_EL_ID': 'ID@@chlginput', 'TWO_FA_HANDLER': None, 'STRICT_TWO_FA_CODE': True, 'TWO_FA_SELECT_EL_ID': 'ID@@sf_select', 'TWO_FA_SELECT_TARGET': 'IB Key', 'CUSTOM_TWO_FA_HANDLER': 'custom_two_fa_handler.CustomTwoFaHandler'}
2024-12-30 19:00:08,632|I| Gateway not found, starting new one...
2024-12-30 19:00:08,632|I| Note that the Gateway log below may display "Open https://localhost:[PORT] to login" - ignore this command.
2024-12-30 19:00:08,632|I| Starting Gateway as Linux process with params: ['bash', 'bin/run.sh', 'root/conf.yaml']
2024-12-30 19:00:08,650|I| Gateway started with pids: [12866]
2024-12-30 19:00:08,651|D| GET https://localhost:6000 (unverified)
2024-12-30 19:00:08,651|I| Gateway running but not serving yet. Consider increasing IBEAM_GATEWAY_STARTUP timeout. Error: <urlopen error [Errno 111] Connection refused>
2024-12-30 19:00:08,651|I| Gateway connection established
2024-12-30 19:00:08,651|D| POST https://localhost:6000/v1/api/tickle (unverified)
2024-12-30 19:00:08,652|I| Gateway running but not serving yet. Consider increasing IBEAM_GATEWAY_STARTUP timeout. Error: <urlopen error [Errno 111] Connection refused>
2024-12-30 19:00:08,652|I| NO SESSION Status(running=True, session=False, connected=False, authenticated=False, competing=False, collision=False, session_id=None, server_name=None, server_version=None, expires=None)
2024-12-30 19:00:08,652|I| Authentication strategy: "B"
2024-12-30 19:00:08,652|I| No active sessions, logging in...
2024-12-30 19:00:08,652|I| Loading auth webpage at https://localhost:6000/sso/Login?forwardTo=22&RL=1&ip2loc=on
2024-12-30 19:00:19,443|W| Cannot determine the version of IBKR website, assuming version 2
2024-12-30 19:00:19,443|D| Targets: {'PASSWORD': Target(NAME@@password), 'SUBMIT': Target(CSS_SELECTOR@@.btn.btn-lg.btn-primary), 'SUCCESS': Target(TAG_NAME@@Client login succeeds), 'IBKEY_PROMO': Target(CLASS_NAME@@ibkey-promo-skip), 'TWO_FA': Target(ID@@twofactbase), 'TWO_FA_NOTIFICATION': Target(CLASS_NAME@@login-step-notification), 'TWO_FA_INPUT': Target(ID@@chlginput), 'TWO_FA_SELECT': Target(ID@@sf_select), 'USER_NAME': Target(NAME@@username), 'ERROR': Target(CSS_SELECTOR@@.xyz-errormessage)}
2024-12-30 19:00:40,064|E| Timeout reached when waiting for authentication. The website seems to not be loaded correctly. Consider increasing IBEAM_PAGE_LOAD_TIMEOUT. 
Website URL: https://localhost:6000/sso/Login?forwardTo=22&RL=1&ip2loc=on 
 
Exception:
  File "/home/<USERNAME>/github/ibeam-custom/ibeam/ibeam_starter.py", line 172, in <module>
    success, shutdown, status = client.start_and_authenticate()
  File "/home/<USERNAME>/github/ibeam-custom/ibeam/src/gateway_client.py", line 62, in start_and_authenticate
    success, shutdown, status = self.strategy_handler.try_authenticating(request_retries=request_retries)
  File "/home/<USERNAME>/github/ibeam-custom/ibeam/src/handlers/strategy_handler.py", line 85, in try_authenticating
    return self._authentication_strategy_B(status, request_retries)
  File "/home/<USERNAME>/github/ibeam-custom/ibeam/src/handlers/strategy_handler.py", line 140, in _authentication_strategy_B
    return self._log_in(status)
  File "/home/<USERNAME>/github/ibeam-custom/ibeam/src/handlers/strategy_handler.py", line 151, in _log_in
    success, shutdown = self.login_handler.login()
  File "/home/<USERNAME>/github/ibeam-custom/ibeam/src/handlers/login_handler.py", line 467, in login
    self.handle_timeout_exception(e, targets, driver, website_version, self.route_auth, self.base_url, self.outputs_dir)
  File "/home/<USERNAME>/github/ibeam-custom/ibeam/src/handlers/login_handler.py", line 433, in login
    wait_and_identify_trigger = self.load_page(targets, driver, self.base_url, self.route_auth)
                                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/<USERNAME>/github/ibeam-custom/ibeam/src/handlers/login_handler.py", line 406, in load_page
    wait_and_identify_trigger(is_clickable(targets['USER_NAME']), skip_identify=True)
  File "/home/<USERNAME>/github/ibeam-custom/ibeam/src/handlers/login_handler.py", line 67, in _wait_and_identify_trigger
    trigger = WebDriverWait(driver, timeout).until(any_of(*expected_conditions))
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/<USERNAME>/miniconda3/lib/python3.12/site-packages/selenium/webdriver/support/wait.py", line 105, in until
    raise TimeoutException(message, screen, stacktrace)

  <class 'selenium.common.exceptions.TimeoutException'> Message: 

2024-12-30 19:00:40,065|I| Cleaning up the resources. Display: <pyvirtualdisplay.display.Display object at 0x7f503b24d130> | Driver: <selenium.webdriver.chrome.webdriver.WebDriver (session="cf8ce32abb09d2208cd907b83d07c25c")>
2024-12-30 19:00:40,135|I| Logging in failed
2024-12-30 19:00:40,137|I| Starting maintenance with interval 60 seconds
2024-12-30 19:00:54,604|I| Keyboard interrupt, shutting down.

@yezhengli-Mr9
Copy link
Author

Believe stuck here

-12-30 19:00:40,064|E| Timeout reached when waiting for authentication. The website seems to not be loaded correctly. Consider increasing IBEAM_PAGE_LOAD_TIMEOUT. 
Website URL: https://localhost:6000/sso/Login?forwardTo=22&RL=1&ip2loc=on

@yezhengli-Mr9
Copy link
Author

Replaced by #230

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants