Drone.io 部分配置在重新启动服务器后丢失

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

我有一个 Drone.io 0.5 服务器在个人服务器上运行良好。

然而,在重启运行 Drone 的物理服务器后,其配置、构建和机密都丢失了。准确的说,是丢失了一部分信息。看起来关机杀死了 Drone 服务器,只有两天前的状态保存在磁盘上。无论如何,看起来剩余的配置已损坏,所以我不得不重新配置所有内容(repos、secrets 等)

有什么方法可以让 Drone 更频繁地刷新磁盘上的数据吗?我担心意外重启,又遇到同样的问题。

编辑: 我测试过 $ docker-compose stop 足以停止服务器并保存所有数据。我还在担心万一服务器崩溃了怎么办

无人机将所有数据保存到数据库中。如果您使用的是默认配置,则这是一个 sqlite 数据库。文档建议在创建数据库的路径上将卷安装到主机,以便将数据库写入主机,而不是在销毁容器时销毁。

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 不在内存中存储数据。数据库事务完成的那一刻,记录被写入磁盘。这是任何 ACID-compliant 数据库所必需的。

Anyway, it looked like the configuration that remained was damaged

如果您认为您的 SQLite 数据库文件已损坏,建议阅读以下内容。这种情况很少见,但有可能。因此,始终建议定期进行数据库备份。