Drone v.0.8 + Docker-compose unable to open database file

Hi!

Not luck with new installation http://docs.drone.io/installation/

How i can debug the issue with sqlite3 db?
Thank u in advance!

version: ‘2’

services:
drone-server:
image: drone/drone:0.8
ports:
- 8089:8000
- 9000
volumes:
- ./drone:/var/lib/drone/
restart: always
environment:
- DRONE_BITBUCKET=true
- DRONE_BITBUCKET_CLIENT=xxxxxxxx
- DRONE_BITBUCKET_SECRET=xxxxxx
- DRONE_OPEN=true
- DRONE_SECRET=drone
- DRONE_ADMIN=admin
- DRONE_HOST=http://xxx.xxx.xxx.xx:8089
volumes:
- /home/ubuntu/key.pem:/etc/bitbucket/key.pem

drone-agent:
image: drone/agent:0.8
command: agent
restart: always
depends_on: [ drone-server ]
volumes:
- /var/run/docker.sock:/var/run/docker.sock
environment:
- DRONE_SERVER=drone-server:9000
- DRONE_SECRET=drone
- DRONE_HOST=http://xxx.xx.xx.xxx:8089

[email protected]:/tmp# docker-compose up
Creating tmp_drone-server_1 … done
Creating tmp_drone-server_1 …
Creating tmp_drone-agent_1 … done
Attaching to tmp_drone-server_1, tmp_drone-agent_1
drone-agent_1 | time=“2018-02-25T16:08:30Z” level=fatal msg="version control system not configured"
tmp_drone-agent_1 exited with code 1

drone-server_1 | time=“2018-02-25T16:08:59Z” level=error msg="unable to open database file"
drone-server_1 | time=“2018-02-25T16:08:59Z” level=fatal msg="database ping attempts failed"
tmp_drone-agent_1 exited with code 1
tmp_drone-server_1 exited with code 1

It looks like you are using the wrong image for your agent. It should be drone/agent:0.8, not drone/drone:0.8

Appreciate for the fast reply!

Sorry it just typo in this post (fixed).

drone-agent:
image: drone/agent:0.8

This error is coming directly from libsqlite3 and indicates that the sqlite3 library cannot open the database file. The only root cause for this error is a problem with your volume mount configuration. This can include security settings (apparmor, selinux, etc) from preventing the process from writing to the host machine [1].

[1] https://www.projectatomic.io/blog/2015/06/using-volumes-with-docker-can-cause-problems-with-selinux/

Will double check, but it can create ./drone directory, but no drone-sqlite file…

Did you read the link I provided? In some instances, the host machine security settings can prevent the process running in the container from writing to the volume, unless properly configured.

i’m in it. Will check the stuff and inform you!
thank you for assistance!

I’ve also got the same issue/problem/challenge as @den-vasyliev!

I’ve;

  • ensured that the agent uses drone/agent:0.8 image
  • ensured that the server uses drone/drone:0.8 image
  • been told by colleages that we’re running RHEL servers without SELinux enabled (on-purpose turned off)

What else could this error message then be caused by?
I’ve made a gist with some normal (and verbose) output here.

Could I so humbly ask for some assistance/advise as to how to debug this? =)
PS: I’ll continue to google around/ask to see if I can confirm the SELinux claim!
(But I’ve already tried with the :z and :Z flags on the mount…)

Just confirmed SELinux having been turned off with the different commands found here:
https://docs-old.fedoraproject.org/en-US/Fedora/13/html/Security-Enhanced_Linux/sect-Security-Enhanced_Linux-Working_with_SELinux-Enabling_and_Disabling_SELinux.html.

did you add the :z to your volume mount as was recommended at the link I posted?

-v `/var/lib/drone:/var/lib/drone:z`

Could I so humbly ask for some assistance/advise as to how to debug this?

Perhaps consider asking the question on Stackoverflow? Keep in mind that this error message comes from the libsqlite3 library and indicates that libsqlite3 cannot write to the directory. The inability to write to a mounted volume from inside a container needs to be debugged at the Docker or Linux level. I therefore recommend Stack Overflow because you might need a different set of expertise to resolve this issue.

Yes, I did try that, just without the qoutes =)
I’ll try that before logging off for today!

Thank you so much for the quick response!
I’ll make a question(/maybe also answer?) at S/O before I take my leave for today =)

@den-vasyliev You have two volumes section in your compose file. The second one where you define your pem file overwrites the first one where the Drone sqlLite path is mounted. So the sqlLite path doesn’t exist and can’t be created.

Group your two volumes into one like this:

version: ‘2’

services:
drone-server:
image: drone/drone:0.8
ports:
  - 8089:8000
  - 9000
volumes:
  - ./drone:/var/lib/drone/
  - /home/ubuntu/key.pem:/etc/bitbucket/key.pem
restart: always
environment:
  - DRONE_BITBUCKET=true
  - DRONE_BITBUCKET_CLIENT=xxxxxxxx
  - DRONE_BITBUCKET_SECRET=xxxxxx
  - DRONE_OPEN=true
  - DRONE_SECRET=drone
  - DRONE_ADMIN=admin
  - DRONE_HOST=http://xxx.xxx.xxx.xx:8089