Octopus
Enabling the Plugin
Enabling the SqlServerPlugin requires three steps: adding the NuGet package reference, registering the plugin in Program.cs, and providing the connection string credential ID in appsettings.json.
Step 1 — Package Reference
<!-- Add to your Octopus host project's .csproj -->
<PackageReference Include="BizFirst.Octopus.SqlServerPlugin" Version="*" />
Step 2 — Register in Program.cs
// Program.cs
var builder = WebApplication.CreateBuilder(args);
builder.Services.AddOctopus(config =>
{
// SqlServerPlugin MUST be the first plugin registered.
// All other plugins depend on the services it provides
// (OctopusDbContext, IAgentStore, IEpisodicMemoryStore, etc.)
config.AddPlugin<SqlServerPlugin>();
// Other plugins follow
config.AddPlugin<SemanticKernelPlugin>();
config.AddPlugin<ChatbotUIPlugin>();
config.AddPlugin<ProcessPlugin>();
});
var app = builder.Build();
app.UseOctopus();
app.Run();
Step 3 — appsettings.json Configuration
{
"SqlServerPlugin": {
"ConnectionStringCredentialId": 1,
"CommandTimeoutSeconds": 30,
"EnableRetryOnFailure": true,
"MaxRetryCount": 3,
"MaxRetryDelaySeconds": 30,
"RunMigrationsOnStartup": true,
"MigrationTimeout": 120
}
}
| Setting | Type | Default | Description |
|---|---|---|---|
ConnectionStringCredentialId | int | — (required) | Credential ID for the SQL Server connection string |
CommandTimeoutSeconds | int | 30 | EF Core command timeout for individual queries |
EnableRetryOnFailure | bool | true | Enables Polly-backed transient fault retry |
MaxRetryCount | int | 3 | Retry attempts before propagating the exception |
MaxRetryDelaySeconds | int | 30 | Max delay between retries (exponential backoff) |
RunMigrationsOnStartup | bool | true | Whether to run pending EF Core migrations automatically |
MigrationTimeout | int | 120 | Seconds to allow for migration on startup |
Credential Setup
The connection string is stored as a credential — never in appsettings.json directly. Register it once via the Octopus admin API:
POST /api/credentials
Content-Type: application/json
{
"name": "OctopusSqlServer",
"description": "Connection string for Octopus SQL Server database",
"type": "ConnectionString",
"value": "Server=sql.internal.company.com;Database=OctopusAI;Integrated Security=True;TrustServerCertificate=True;"
}
// Response:
{
"id": 1,
"name": "OctopusSqlServer"
}
// Use the returned id as ConnectionStringCredentialId in appsettings.json
Verifying the Setup
On a successful startup, the application log will contain the following lines in order:
[SqlServerPlugin] Resolving connection string from credential 1
[SqlServerPlugin] Connection to OctopusAI verified
[SqlServerPlugin] Running pending EF Core migrations...
[SqlServerPlugin] Applied migration: 20240101_InitialOctopusSchema
[SqlServerPlugin] Applied migration: 20240615_AddAreaTables
[SqlServerPlugin] Database schema is up to date
[SqlServerPlugin] Startup complete — all Octopus SQL services available
Cold start time. On first deployment, migrations create all tables and indexes. This can take 5–30 seconds depending on SQL Server load. Subsequent startups are fast — only pending migrations run.