Spinning up a drone for integration testing

I’m writing a book that comes with an example application demonstrating the principles in the book. The example application is a drone agent balancer that can spin up agents to meet demands of the server. The actual utility of this application is zero since you now already provide this as a service :slight_smile:

Nonetheless, I require access to a drone server during my integration tests. However, my simple docker-compose configuration is failing to bring up a drone server:

version: "2.2"

# http://docs.drone.io/installation/

services:
  # ready:
  #   image: hello-world
  #   depends_on:
  #     drone-server:
  #       condition: service_healthy

  drone-server:
    image: drone/drone:0.8

    ports:
      - 8000:8000
    volumes:
      - ./drone/certs:/etc/certs/localhost
    restart: always
    environment:
      - DRONE_OPEN=true
#      - DRONE_HOST=https://localhost:8000
      - DRONE_HOST=http://localhost:8000
      - DRONE_SECRET=supertopsecret
#      - DRONE_SERVER_CERT=/etc/certs/localhost/drone.crt
#      - DRONE_SERVER_KEY=/etc/certs/localhost/drone.key

I’m getting

time="2018-08-17T18:12:36Z" level=fatal msg="version control system not configured"

Assuming I get past that, could somebody please advise how I can achieve the following:

  1. add a dummy project so drone can provide all the JSON endpoints.
  2. it looks like the official image doesn’t provide a healthcheck, what would be a good one to use?

version control system not configured

you need to configure a version control system (e.g. github, gitea) before Drone will initialize. You could just set a dummy gitea instance, for example DRONE_GITEA=true and DRONE_GITEA_URL=https://try.gitea.io, allowing drone to start

add a dummy project so drone can provide all the JSON endpoints.

we actually did this to test out our node sdk. We populated the sqlite database from a file before executing our tests. The example is outdated (from 0.4) but might give you some good hints https://github.com/drone/drone-node/blob/master/.drone.yml

it looks like the official image doesn’t provide a healthcheck, what would be a good one to use?

This is an interesting topic. Most healthchecks I’ve seen are simple curl commands that execute inside the container. I wonder under what circumstances one would be unable to curl the drone server from inside the container – if such a situation occurred I would expect the server to quite and the container to exit with a non-zero exit code. I know that doesn’t answer you question, but just something I’ve been wondering :slight_smile:

With that being said, there is a simple endpoint that you can access to verify the server is up and running: https://beta.drone.io/healthz

1 Like