Mario S
Mario S

Reputation: 1984

Part of Drone.io configuration were lost after reboot the server

I have a Drone.io 0.5 server working great on a personal server.

However, after reboot the physical server where Drone runs, its configuration, builds and secrets were lost. To be exact, part of the information were lost. It looks like the shutdown killed the Drone server and only the state from two days ago was saved on disk. Anyway, it looked like the configuration that remained was corrupted, so I had to reconfigure everything again (repos, secrets, etc.)

Is there any way to make Drone flush its data on disk more often? I'm worried for an unexpected reboot, and have the same problem again.

EDIT: I tested and $ docker-compose stop is enough to stop the server and save all the data. I'm still worried about what to do in case of a server crash.

Upvotes: 1

Views: 888

Answers (1)

Brad Rydzewski
Brad Rydzewski

Reputation: 2563

Drone persists all data to a database. If you are using the default configuration this is a sqlite database. The documentation recommends mounting a volume to the host machine, at the path where the database is created, so that the database is written to the host machine and not destroyed when the containers are destroyed.

Drone mounts a volume on the host machine to persist the sqlite database. This is not required when using alternate database engines.

services:
  drone-server:
    image: drone/drone:0.5
    ports:
      - 80:8000
    volumes:
      - ./drone:/var/lib/drone/
    restart: always

Is there any way to make Drone flush its data on disk more often? I'm worried for an unexpected reboot, and have the same problem again.

SQLite does not store data in memory. The minute a database transaction completes, the record is written to disk. This is required by any ACID-compliant database.

Anyway, it looked like the configuration that remained was damaged

If you think your SQLite database file was corrupted, below is some recommended reading. This would be rare, but possible. For this reason regular database backups are always recommended.

Upvotes: 1

Related Questions