{"action":"created","issue":{"url":"https://api.github.com/repos/drone/drone/issues/1436","repository_url":"https://api.github.com/repos/drone/drone","labels_url":"https://api.github.com/repos/drone/drone/issues/1436/labels{/name}","comments_url":"https://api.github.com/repos/drone/drone/issues/1436/comments","events_url":"https://api.github.com/repos/drone/drone/issues/1436/events","html_url":"https://github.com/drone/drone/issues/1436","id":128778485,"number":1436,"title":"drone 0.4 database ping failed","user":{"login":"valentinbud","id":3338528,"avatar_url":"https://avatars.githubusercontent.com/u/3338528?v=3","gravatar_id":"","url":"https://api.github.com/users/valentinbud","html_url":"https://github.com/valentinbud","followers_url":"https://api.github.com/users/valentinbud/followers","following_url":"https://api.github.com/users/valentinbud/following{/other_user}","gists_url":"https://api.github.com/users/valentinbud/gists{/gist_id}","starred_url":"https://api.github.com/users/valentinbud/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/valentinbud/subscriptions","organizations_url":"https://api.github.com/users/valentinbud/orgs","repos_url":"https://api.github.com/users/valentinbud/repos","events_url":"https://api.github.com/users/valentinbud/events{/privacy}","received_events_url":"https://api.github.com/users/valentinbud/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":36,"created_at":"2016-01-26T10:03:26Z","updated_at":"2016-04-18T17:26:46Z","closed_at":"2016-01-26T19:27:19Z","body":"First of all allow me to tell you that I think drone is an exquisite piece of technology that's very easy to understand and use. Thank you for sharing :).\r\n\r\nI am trying to deploy drone 0.4 with Postgres Database located in another container.\r\n\r\n```\r\n$ docker run -d --name drone-postgres -e POSTGRES_USER=drone -e POSTGRES_DB=drone -e POSTGRES_PASSWORD=drone postgres\r\n```\r\n\r\nI have verified that the database is up and running with another docker container.\r\n\r\n```\r\n$ docker run -it --link drone-postgres:postgres --rm postgres sh -c 'exec psql -h \"$POSTGRES_PORT_5432_TCP_ADDR\" -p \"$POSTGRES_PORT_5432_TCP_PORT\" -U drone'\r\n```\r\n\r\nAfter entering `drone` password I am inside a psql shell. I suppose it is working.\r\n\r\nNext I have run drone with environment variables.\r\n\r\n```\r\n$ docker run --rm -it -e DATABASE_DRIVER=postgres -e DATABASE_CONFIG=postgres://drone:drone@172.17.0.2:5432/drone drone/drone:0.4\r\n\r\nINFO[0000] using database driver postgres\r\nINFO[0000] using database config postgres://drone:drone@172.17.0.2:5432/drone\r\nINFO[0000] database ping failed. retry in 1s\r\nINFO[0001] database ping failed. retry in 1s\r\nINFO[0002] database ping failed. retry in 1s\r\nINFO[0003] database ping failed. retry in 1s\r\nINFO[0004] database ping failed. retry in 1s\r\nINFO[0005] database ping failed. retry in 1s\r\nINFO[0006] database ping failed. retry in 1s\r\nINFO[0007] database ping failed. retry in 1s\r\nINFO[0008] database ping failed. retry in 1s\r\nINFO[0009] database ping failed. retry in 1s\r\nINFO[0010] database ping failed. retry in 1s\r\n```\r\n\r\nThe IP Address is from `docker inspect drone-postgres`. Could you please tell what have I done wrong or another way to deploy drone with Postgres, both in docker containers.\r\n"},"comment":{"url":"https://api.github.com/repos/drone/drone/issues/comments/211486274","html_url":"https://github.com/drone/drone/issues/1436#issuecomment-211486274","issue_url":"https://api.github.com/repos/drone/drone/issues/1436","id":211486274,"user":{"login":"bradrydzewski","id":817538,"avatar_url":"https://avatars.githubusercontent.com/u/817538?v=3","gravatar_id":"","url":"https://api.github.com/users/bradrydzewski","html_url":"https://github.com/bradrydzewski","followers_url":"https://api.github.com/users/bradrydzewski/followers","following_url":"https://api.github.com/users/bradrydzewski/following{/other_user}","gists_url":"https://api.github.com/users/bradrydzewski/gists{/gist_id}","starred_url":"https://api.github.com/users/bradrydzewski/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bradrydzewski/subscriptions","organizations_url":"https://api.github.com/users/bradrydzewski/orgs","repos_url":"https://api.github.com/users/bradrydzewski/repos","events_url":"https://api.github.com/users/bradrydzewski/events{/privacy}","received_events_url":"https://api.github.com/users/bradrydzewski/received_events","type":"User","site_admin":false},"created_at":"2016-04-18T17:26:46Z","updated_at":"2016-04-18T17:26:46Z","body":"I'm able to consistently reproduce this issue under three conditions:\r\n\r\n1. incorrectly mount the volume\r\n2. instruct sqlite3 to create the database in a folder that does not exist (usually related to number 1)\r\n3. invalid permissions to write the file (usually related selinux or apparmor)\r\n\r\nI would recommend you do some additional debugging to try to uncover the root cause. Here are some things I can suggest:\r\n\r\n1. try using `docker volume create` to create a container volume instead of a host volume\r\n2. try using a container volume like `--volume=/var/lib/drone`\r\n3. try using `DATABASE_CONFIG=/` to avoid volumes all together and to create the database inside the container root directory (not this will not persist and should be used for debugging only)\r\n4. try compiling your own version of drone and add debugging code. Add Go code that checks the directory and tries to write a file. Perhaps Go will provide more meaningful error messaging.\r\n\r\nAside from the above suggestions I'm not sure how much more I'm going to be able to help simply due to inability to reproduce. The issue also seems to be isolated to a small number of installations which makes this even more difficult to troubleshoot ... it would be much easier if everyone was having this issue, although I'm glad they aren't :)\r\n\r\n"}}