- Bot now takes shard id (optional) and total shards (optional) command line arguments (changed from shard id and parent process id)

- Sharding with coordinator now works properly
- Documented creds.yml RestartCommand - it has no effect when coordinator is starting the bot
- Regenerated creds_example.yml
- Removed all db migrators as the v3 requires the user to have updated 2.x all the way
- TotalShards in creds.yml gets overriden by coord.yml's TotalShards if the bot is ran through coordinator (more precisely, by the command line argument to the bot)
- Coordinator now runs on http://localhost:3442 by default, you can change this in appsettings.json
    - This is done because of macos https issues
    - Primarily because https for regular users is a massive hassle. Coordinator shouldn't be exposed anyway
- Minor cleanup
This commit is contained in:
Kwoth
2021-06-25 19:14:34 +02:00
parent a1ef862382
commit 670b0aca96
14 changed files with 119 additions and 398 deletions

View File

@@ -24,6 +24,12 @@ namespace Nadeko.Common
Type = "sqlite",
ConnectionString = "Data Source=data/NadekoBot.db"
};
CoordinatorUrl = "http://localhost:3442";
RestartCommand = new()
{
};
}
[Comment(@"DO NOT CHANGE")]
@@ -36,7 +42,6 @@ namespace Nadeko.Common
**DO NOT ADD PEOPLE YOU DON'T TRUST**")]
public ICollection<ulong> OwnerIds { get; set; }
// todo update total shards on startup
[Comment(@"The number of shards that the bot will running on.
Leave at 1 if you don't know what you're doing.")]
public int TotalShards { get; set; }
@@ -65,8 +70,9 @@ go to https://www.patreon.com/portal -> my clients -> create client")]
[Comment(@"Database options. Don't change if you don't know what you're doing. Leave null for default values")]
public DbOptions Db { get; set; }
public RestartConfig RestartCommand { get; set; }
[Comment(@"Address and port of the coordinator endpoint. Leave empty for default.
Change only if you've changed the coordinator address or port.")]
public string CoordinatorUrl { get; set; }
[YamlIgnore]
public string PatreonCampaignId => Patreon?.CampaignId;
@@ -94,6 +100,19 @@ Used for cryptocurrency related commands.")]
[Comment(@"Api key used for Osu related commands. Obtain this key at https://osu.ppy.sh/p/api")]
public string OsuApiKey { get; set; }
[Comment(@"Command and args which will be used to restart the bot.
Only used if bot is executed directly (NOT through the coordinator)
placeholders:
{0} -> shard id
{1} -> total shards
Linux default
cmd: dotnet
args: ""NadekoBot.dll -- {0}""
Windows default
cmd: NadekoBot.exe
args: {0}")]
public RestartConfig RestartCommand { get; set; }
public class DbOptions
{