1

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.

Mario S
  • 1,914
  • 1
  • 19
  • 32
  • "it looked like the configuration that remained was damaged" ... can you explain why you think it was damaged? Data loss and data damage are not necessarily the same thing, and this question claims both – Brad Rydzewski Jan 18 '17 at 02:22
  • Let me explain myself: after reboot the server, I fired up again Drone. When I accessed to the UI, I found my repos, but when I tried to restart the each pipeline, but they didn't work. Sorry if I have no more info. I didn't take screenshots. I just deleted the sqllite database and started again. – Mario S Jan 18 '17 at 03:09
  • This tells me the data was not damaged. A damaged database file will not open. When you restarted Drone, if the file were damaged and unable to open, Drone would have exited with an error and would not have started. – Brad Rydzewski Jan 18 '17 at 03:16
  • When you say "they didn't work" what does that mean? – Brad Rydzewski Jan 18 '17 at 03:19
  • @BradRydzewski After I opened the UI, I opened one pipeline. Before the reboot, the server was built the 15 commits. After the reboot, I saw only six. Well, I opened the last commit, the sixth one, clicked on "Restart," but nothing happened. I tried two more times, and nothing. The same with the other pipeline... If there was not a database corruption, what could have been? – Mario S Jan 18 '17 at 03:21
  • @BradRydzewski It's not big deal. I didn't take screenshots or something useful to try to understand what happened. Just in case, I wrote a shutdown script for Drone, to call `docker-compose stop` when the physical server be manually rebooted or shutdown. Also, if I take backups of the database should be enough. Thanks again! – Mario S Jan 18 '17 at 04:12

1 Answers1

1

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.

Community
  • 1
  • 1
Brad Rydzewski
  • 2,523
  • 14
  • 18
  • Actually, I'm using the volume "./drone:/var/lib/drone". Because the UI show the status from two days ago, I thought that it was a "flush" problem, but yes, I understand what you say. The database just was corrupted. I will follow your advice about backup the SQLite database. Thanks for your help! – Mario S Jan 18 '17 at 03:16