{"action":"reopened","issue":{"url":"https://api.github.com/repos/o1lab/xmysql/issues/43","repository_url":"https://api.github.com/repos/o1lab/xmysql","labels_url":"https://api.github.com/repos/o1lab/xmysql/issues/43/labels{/name}","comments_url":"https://api.github.com/repos/o1lab/xmysql/issues/43/comments","events_url":"https://api.github.com/repos/o1lab/xmysql/issues/43/events","html_url":"https://github.com/o1lab/xmysql/issues/43","id":352105540,"node_id":"MDU6SXNzdWUzNTIxMDU1NDA=","number":43,"title":"Issue when xmysql container startup is before mysql container startup","user":{"login":"Dpvh","id":36078078,"node_id":"MDQ6VXNlcjM2MDc4MDc4","avatar_url":"https://avatars2.githubusercontent.com/u/36078078?v=4","gravatar_id":"","url":"https://api.github.com/users/Dpvh","html_url":"https://github.com/Dpvh","followers_url":"https://api.github.com/users/Dpvh/followers","following_url":"https://api.github.com/users/Dpvh/following{/other_user}","gists_url":"https://api.github.com/users/Dpvh/gists{/gist_id}","starred_url":"https://api.github.com/users/Dpvh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Dpvh/subscriptions","organizations_url":"https://api.github.com/users/Dpvh/orgs","repos_url":"https://api.github.com/users/Dpvh/repos","events_url":"https://api.github.com/users/Dpvh/events{/privacy}","received_events_url":"https://api.github.com/users/Dpvh/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-08-20T12:03:46Z","updated_at":"2018-08-23T12:48:38Z","closed_at":null,"author_association":"NONE","body":"When using xmysql in a docker network(trough a docker compose), there is a chance xmysql gets spinned up before the related database container is ready.\r\nIf that happens it seems that only /tables works but actual requests trough the /api/ don't seem to work.\r\nOnly manually restarting the xmysql image seems to fix it.\r\n\r\nI fixed it by adding a  health check to the docker compose.\r\nLike so:\r\n\r\nxmysql-report:\r\n      image: \"markuman/xmysql:0.4.2\"\r\n      expose:\r\n          - \"80\"\r\n      entrypoint: /bin/sh\r\n      command: [ \"-c\", \"cd /usr/src/app/ && node index.js --host DATABASE_HOST --password PASSWORD --database report --user root --apiPrefix /xmysql-report/api/ --portNumber 80 --ipAddress 0.0.0.0\" ]\r\n      depends_on:\r\n        database-DATABASE:\r\n          condition: service_healthy\r\n\r\ndatabase-DATABASE:\r\n    image: \"MYSQL-IMAGE\"\r\n    expose:\r\n      - \"3306\"\r\n    ports:\r\n      - \"33306:3306\"\r\n    environment:\r\n      - \"TZ=Europe/Amsterdam\"\r\n    healthcheck:\r\n      test: [\"CMD\", \"mysqladmin\" ,\"ping\", \"-h\", \"localhost\"]\r\n      timeout: 5s\r\n      retries: 10\r\n\r\n\r\n\r\n\r\nbut docker documentation recommends the software (xmysql in this case) should be more flexible in this situation, so no healthcheck would be needed.\r\n\r\n"}}
{"actor":{"display_login":"Dpvh"}}