gobackup:一款基础的服务器端备份工具
本工具是为满足 GoFile 上传需求而开发的,现有的任何备份模组都无法满足这一需求。它旨在适用于那些限制访问 .sh 文件且不允许在服务器存储上进行备份的主机(例如 PebbleHost),并利用 GoFile 廉价的大容量存储特性。
警告
此模组需要 GoFile Patreon 订阅(以访问 API,每月仅需 5 美元,同时你也支持了所有人的免费存储空间),并且不保证能按预期工作。请自行承担风险使用!
警告
本模组不包含恢复功能。实现起来较为困难。请确保你或你信任的人始终能够访问备份文件夹——你可以通过将每个文件夹设置为带密码的公开状态来允许他人使用它们。
注意
本模组并非设计用于客户端,也未对此进行测试。仅在服务器上使用该模组。
配置
配置文件位于 config 文件夹中,包含以下字段:
gofile-api-key - 你的 GoFile API 密钥。登录后可在 你的 GoFile 个人主页 找到。
gofile-container-folder - 存放备份的文件夹 ID。在 GoFile 侧边栏进入 My Files,创建一个文件夹,进入该文件夹,并将 URL 中 /d/ 后面的部分填入此处。
backup-type - 尚未实现。保持为 world 或从配置中完全删除。
- 此选项实现后,将允许你备份所有服务器文件,而不仅仅是世界文件。
allow-manual - 是否允许通过 /gobackup now 进行手动备份。
announce-backup - 是否在备份服务器时在聊天中发布公告。
- 无论此设置为何值,当服务器进行备份时,你始终会在服务器日志中收到通知。
do-schedule - 是否按计划执行备份。
interval - 计划备份之间的时间间隔,单位为秒。
- 请了解你在做什么。如果将其设置为非常小的值(如 1 秒),请做好服务器很快崩溃的准备。
- 建议至少设置为 10 分钟,以避免过载服务器、被限速以及超出账户配额。
backup-limit - 存储的最大备份数量。一旦备份数量超过此数值,最旧的备份将被删除以便为新备份腾出空间。
- 请根据实际情况决定此值。例如,如果你希望每 30 分钟备份一次小型世界,并希望保留最近两天的记录,那么备份限制应为 96。
- 手动备份不计入此限制。
show-progress-messages - 是否在控制台记录消息以指示备份进行的步骤。
show-debug-messages - 出错时是否在控制台中显示完整的错误日志和 GoFile API 响应。
如果你设法(无论如何)搞坏了文件,只需删除它,就会生成一个新的空文件。
虽然 GoFile 提供廉价且优质的存储空间,但请确保不要违反其 条款。捐赠者不应像免费用户那样滥用存储空间,因此请设置合理的间隔和限制。
用法
一切都将按照配置文件中定义的方式自动发生!不过,如果允许的话,你也可以使用 /gobackup now 立即进行一次备份——这会将备份发送到一个单独的文件夹,其中的备份不会被模组自动删除。
在处理文件期间请勿删除文件或文件夹
GoBackup 旨在尽可能具备韧性,以应对你对文件的交互操作。然而,当其处于活动状态时,如果未能及时跟上变化,请不要感到惊讶。为了最大程度地确保安全,当你想要修改存储结构时,应先执行 /gobackup disable。准备就绪后,再运行 /gobackup enable。
许可证
本项目采用 OSSAL 许可证,该许可证禁止对基于本项目或修改自本项目的代码使用 GPL 及其他要求分发源代码的许可证进行授权。然而,本项目可用于任何其他用途,且在很大程度上类似于 MIT / Expat 许可证。
gobackup: a basic server-side backup tool
This tool was made out of a need for GoFile uploads that couldn't be satisfied by any existing backup mod. It's intended to work on cheaper hosts that restrict access to .sh files and don't allow backups on server storage like PebbleHost, taking advantage of GoFile's cheap high-volume storage.
Warning
This mod requires a GoFile Patreon subscription (to access the API, it only costs $5 per month and you're also supporting free storage for everyone) and there is no guarantee that it will work as expected. Use at your own risk!
Warning
Restoration is not included in this mod. It's difficult to implement. Make sure you or somebody you trust always has access to the backup folders - you can allow other people to use them by setting each folder to be public with a password.
Note
This mod is not intended for use on the client side, and is not tested for this. Only use this on servers.
Configuration
The configuration file can be found in the config folder and will contain the following fields:
gofile-api-key - Your API key for GoFile. This can be found in on your GoFile profile page when logged in.
gofile-container-folder - The ID for the folder that will contain your backups. Go to My Files on the GoFile sidebar, create a folder, go into it, and insert the part after /d/ in the URL here.
backup-type - Not yet implemented. Keep as world or remove from config entirely.
- This option, when implemented, will allow you to back all your server files up instead of just your worlds.
allow-manual - Whether manual backups should be allowed via /gobackup now.
announce-backup - If the mod should announce when it's backing the server up in chat.
- Regardless of what this is set to, you'll always be notified of when the server is being backed up in the server logs.
do-schedule - Whether backups should be performed on a schedule.
interval - How much time should be taken between scheduled backups, in seconds.
- Know what you're doing. If you set this to something very small, like 1 second, expect your server to die quickly.
- At least 10 minutes are recommended to avoid overloading the servers, being ratelimited, and exceeding your account's quotas.
backup-limit - The maximum amount of backups stored. Once the amount of backups you have exceeds this number, the oldest will be deleted to make space for the next one.
- Use logic to decide what this should be. For example, if you want to back a small world up every 30 minutes and want the two most recent days of records at any point, you want a limit of 96 backups.
- Manual backups are not counted.
show-progress-messages - Whether the mod should log messages in your console to indicate what step it's on in a backup.
show-debug-messages - Whether to show complete error logs and GoFile API responses in the console when things go wrong.
If you manage to (somehow) screw your file up, just delete it and a new empty one will be made.
While GoFile offers great cheap storage, make sure not to violate their terms. Donators are asked not to abuse their storage the same way free users shouldn't, so make sure to set a reasonable interval and limit.
Usage
Everything will happen automatically as and if defined in the config file! However, you can also use /gobackup now to backup off your defined frequency if this is allowed - this will send a backup to a seperate folder where backups will not be deleted automatically by the mod.
Don't delete files or folders while they're being handled
GoBackup is made to be as resilient as possible when it comes to you interacting with your files. However, you should not be surprised if it fails to catch up while it's active. To stay as safe as possible, when you want to modify your storage structure, you should first do /gobackup disable. Run /gobackup enable once you're ready to go again.
License
This project is licensed under the OSSAL license, which does not permit licensing code that uses this project or modifies it under the GPL and other licenses that require source code distribution. However, this project can be used in any other way and is otherwise very similar to the MIT / Expat license.
评论 0
登录后参与评分
还没有评论,来抢沙发吧