Skip to content

Commit

Permalink
Health check restored
Browse files Browse the repository at this point in the history
  • Loading branch information
rylorin committed Feb 28, 2024
1 parent 9002a14 commit 4f7802a
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 9 deletions.
4 changes: 3 additions & 1 deletion .github/workflows/build-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,15 @@ jobs:
IB_ACCOUNT: ${{ secrets.IB_ACCOUNT }}
IB_PASSWORD: ${{ secrets.IB_PASSWORD }}
TRADE_MODE: paper
IMAGE_NAME: ${{ github.repository }}

- name: Run ib_insync example
run: |
docker run --rm \
-e IB_ACCOUNT=$IB_ACCOUNT \
-e IB_PASSWORD=$IB_PASSWORD \
-e TRADE_MODE=$TRADE_MODE \
-p 4001:4001 \
-p 4002:4001 \
-d \
${{ github.repository }} tail -f /dev/null;
sleep 30;
Expand All @@ -57,6 +58,7 @@ jobs:
IB_ACCOUNT: ${{ secrets.IB_ACCOUNT }}
IB_PASSWORD: ${{ secrets.IB_PASSWORD }}
TRADE_MODE: paper
IMAGE_NAME: ${{ github.repository }}

# - uses: "google-github-actions/setup-gcloud@v0"
# with:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/deploy-dockerhub.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ on:
jobs:
deploy:
runs-on: ubuntu-latest
timeout-minutes: 15
timeout-minutes: 16
strategy:
matrix:
IBG_VERSION: [stable, latest]
Expand Down
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ ENV IBGW_WATCHDOG_PROBE_TIMEOUT 10
EXPOSE 4001/tcp
EXPOSE 5900/tcp

# HEALTHCHECK --interval=20s --timeout=10s --start-period=90s --retries=3 \
# CMD python healthcheck.py || exit 1
HEALTHCHECK --interval=30s --timeout=10s --start-period=30s --retries=5 \
CMD python healthcheck.py || exit 1

ENTRYPOINT [ "sh", "/root/cmd.sh" ]
4 changes: 2 additions & 2 deletions docker-stack.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ services:
environment:
IB_ACCOUNT: ${TWS_USERID}
IB_PASSWORD: ${TWS_PASSWORD}
TRADE_MODE: ${TRADING_MODE:-paper}
TRADE_MODE: ${TRADE_MODE:-paper}
VNC_SERVER_PASSWORD: ${VNC_SERVER_PASSWORD:-}
IB_GATEWAY_PING_CLIENT_ID: ${IB_GATEWAY_PING_CLIENT_ID:-1001}
IBGW_WATCHDOG_CLIENT_ID: ${IBGW_WATCHDOG_CLIENT_ID:-1002}
Expand All @@ -16,7 +16,7 @@ services:
- default
ports:
- target: 4001
published: 4001
published: 4002
protocol: tcp
mode: ingress
- target: 5900
Expand Down
4 changes: 2 additions & 2 deletions examples/ib_insync/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ docker run --rm \
-e IB_ACCOUNT=$IB_ACCOUNT \
-e IB_PASSWORD=$IB_PASSWORD \
-e TRADE_MODE=$TRADE_MODE \
-p 4001:4001 \
-p 4002:4001 \
-d \
manhinhang/ib-gateway-docker:latest tail -f /dev/null
rylorin/ib-gateway-docker:latest tail -f /dev/null

pip install ib_insync pandas
python ib_insync/scripts/connect_gateway.py
Expand Down
3 changes: 2 additions & 1 deletion test/test_ib_gateway_fail.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ def host(request):
'--env', 'IB_ACCOUNT={}'.format(account),
'--env', 'IB_PASSWORD={}'.format(password),
'--env', 'TRADE_MODE={}'.format(trade_mode),
'-p', '4002:4001' \
'-d', IMAGE_NAME,
"tail", "-f", "/dev/null"]).decode().strip()
# return a testinfra connection to the container
Expand All @@ -32,7 +33,7 @@ def test_ib_connect_fail(host):
from ib_insync import *
IB.sleep(60)
ib = IB()
ib.connect('localhost', 4001, clientId=998)
ib.connect('localhost', 4002, clientId=998)
ib.disconnect()
"""
cmd = host.run("python -c \"{}\"".format(script))
Expand Down

0 comments on commit 4f7802a

Please sign in to comment.