diff --git a/.env b/.env index ebebb8a..1da32e8 100644 --- a/.env +++ b/.env @@ -1,2 +1,2 @@ -CUR_IB_GATEWAY_VER=10.19.2o +CUR_IB_GATEWAY_VER=10.19.2p CUR_IBC_VER=3.20.0 diff --git a/.github/workflows/detect-new-ver.yml b/.github/workflows/detect-new-ver.yml index 21275b6..99be885 100644 --- a/.github/workflows/detect-new-ver.yml +++ b/.github/workflows/detect-new-ver.yml @@ -46,7 +46,7 @@ jobs: - name: Update files with new version if: steps.check-update.outputs.has_update == 'true' run: | - sed -i -E -e 's/(IB Gateway\]*\()([^)]+)(\))/\1${{steps.check-update.outputs.ib-gateway-ver}}\3/' -e 's/(IBC.*\()([^)]+)(\))/\1${{steps.check-update.outputs.ibc-ver}}\3/' README.md + sed -e 's/###IB_GATEWAY_VER###/${{steps.check-update.outputs.ib-gateway-ver}}/' -e 's/###IBC_VER###/${{steps.check-update.outputs.ibc-ver}}/' README.template > README.md - name: Create PR if: ${{ steps.check-update.outputs.has_update == 'true' }} env: diff --git a/README.md b/README.md index b440c43..eec0b60 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ It's just pure `IB Gateway` and don't include any VNC service (for security reas This docker image just installed: -- [IB Gateway](https://www.interactivebrokers.com/en/index.php?f=16457) (10.19.2o) +- [IB Gateway](https://www.interactivebrokers.com/en/index.php?f=16457) (10.19.2p) - [IBC](https://github.com/IbcAlpha/IBC) (3.20.0) @@ -86,7 +86,6 @@ services: retries: 3 start_period: 60s ``` - ### CLI Execute `healthcheck` to detect IB gateway haelth status diff --git a/README.template b/README.template index 87d47d5..215ca93 100644 --- a/README.template +++ b/README.template @@ -26,7 +26,7 @@ docker run -d \ --env IB_ACCOUNT= \ #YOUR_USER_ID --env IB_PASSWORD= \ #YOUR_PASSWORD --env TRADING_MODE= \ #paper or live ---p 4002:4002 \ #brige IB gateway port to your local port 4002 +-p 4002:4002 \ #brige IB gateway port to your local port 4002 manhinhang/ib-gateway-docker ``` @@ -53,6 +53,76 @@ ib-gateway-docker | - | - | - | | ib_insync | [examples/ib_insync](./examples/ib_insync) | This example demonstrated how to connect `IB Gateway` + +## Health check container + +### API + +Healthcheck via api call `http://localhost:8080/healthcheck` + +Config `HEALTHCHECK_API_ENABLE=true` in environment variable to enable API + +```bash +curl -f http://localhost:8080/healthcheck +``` + +- Docker compose example + +```yaml +services: + ib-gateway: + image: manhinhang/ib-gateway-docker + ports: + - 4002:4002 + environment: + - IB_ACCOUNT=$IB_ACCOUNT + - IB_PASSWORD=$IB_PASSWORD + - TRADING_MODE=$TRADING_MODE + - HEALTHCHECK_API_ENABLE=true + healthcheck: + test: ["CMD", "curl", "-f", "http://localhost:8080/healthcheck"] + interval: 60s + timeout: 30s + retries: 3 + start_period: 60s +``` +### CLI +Execute `healthcheck` to detect IB gateway haelth status + +```bash +healthcheck +# output: Ping IB Gateway successful +echo $? +# output: 0 +``` + +```bash +healthcheck +# output: Can not connect to IB Gateway +echo $? +# output: 1 +``` + +- Docker compose example + +```yaml +services: + ib-gateway: + image: manhinhang/ib-gateway-docker + ports: + - 4002:4002 + environment: + - IB_ACCOUNT=$IB_ACCOUNT + - IB_PASSWORD=$IB_PASSWORD + - TRADING_MODE=$TRADING_MODE + healthcheck: + test: /healthcheck/bin/healthcheck + interval: 60s + timeout: 30s + retries: 3 + start_period: 60s +``` + # Tests The [test cases](test/test_ib_gateway.py) written with testinfra.