I’m trying to setup a drone build to use foundationdb 5.2.5 as a service container, but I’m getting this error.
/var/fdb/.fdbenv: line 2: 192.168.192.2: command not found
Starting FDB server on 172.17.0.4:4500
Invalid cluster file `/var/fdb/fdb.cluster': 2104 Connection string invalid
Error: Connection string invalid
If I try to start a container from the same image on the drone build agent instance, it starts without error. What is drone doing different when starting a container than when I do it as a regular user, which might have this affect?
My .drone.yaml file:
2 path: /drone/src/github.com/${DRONE_REPO}/${DRONE_BUILD_NUMBER}
3
4 pipeline:
9 build_and_test:
10 image: us.gcr.io/projectx/projectx-build-debian:9.4
12 pull: true
13 commands:
14 - sleep 15
15 - ./gradlew build test
16 when:
17 status: [success]
18 event: tag
19
41
42 # Foundation DB Service Container. Available for connections at hostname: fdb
43 services:
44 fdb:
45 image: foundationdb/foundationdb:5.2.5
I found the problem with the service container. It uses some scripts to detect the IP address of the system it’s running on to generate a config file, and when running in drone /etc/hosts contains two IP’s for the same hostname. The script was only written expecting a single match. I’m not quite sure why the drone version of the same container has multiple IP’s though. I’m also not sure which one should be used to serve foundation db on for the build container to connect to. Perhaps it doesn’t matter?
The /etc/hosts file is created by Docker so I can only speculate, but my guess is that docker creates one IP address for the container name (2311108acaf7) and one for the container alias (fdb) [1]. If you docker inspect you would see both aliases listed under networks.
"Aliases": [
"fdb",
"2311108acaf7"
],
If there is a way to improve how we handle services I am certainly open to feedback and/or patches. You can see our Docker implementation here.