Embeddable dashboard and API for Quartz.NET: list, create, edit, pause, trigger and delete jobs, and see execution history, from inside your ASP.NET Core app.
翻译准备中
取自仓库 README
正在加载完整 README。
查看完整 README ↗A spotlight on your Quartz.NET jobs. Cronlight is a dashboard and API for Quartz.NET that you add to the ASP.NET Core app already running your scheduler: list, create, edit, pause, resume, run and delete jobs, and see what is running and what failed.
It uses the scheduler you already configured. It needs no connection string or schema of its own and never starts a second scheduler.
Website · Live demo · Documentation
IJob types a name, a form with typed and required parameters, and masked
secrets, which can be kept out of the database as references to configuration.| .NET | ASP.NET Core 10 (net10.0). Hosts on .NET 8 can use 0.1.0-beta.2 |
| Quartz.NET | 3.13.1 or a later 3.x, set up with AddQuartz(); tested on 3.22.7. Quartz 4 is not supported yet |
| Job store | Any. Execution history is kept in the Quartz database on SQL Server, PostgreSQL, MySQL or SQLite, and in memory otherwise |
Until 1.0, a minor version (0.2, 0.3) may change options and endpoints, and its release notes say how; a patch version (0.1.1) does not.
dotnet add package Cronlight.Quartz.Dashboard
dotnet add package Cronlight.Quartz.Dashboard.History # optional: execution history
dotnet add package Cronlight.Quartz.Dashboard.Mcp # optional: an MCP server for AI assistants, and AI mode
The setup below also calls AddQuartzHostedService(), from Quartz.Extensions.Hosting (or Quartz.AspNetCore).
Cronlight does not install it, since your app owns its scheduler setup.
// 1. Your existing Quartz setup stays exactly as it is
builder.Services.AddQuartz(q =>
{
q.UsePersistentStore(s =>
{
s.UseProperties = true;
s.UseSqlServer(builder.Configuration.GetConnectionString("Quartz")!);
s.UseNewtonsoftJsonSerializer();
});
});
builder.Services.AddQuartzHostedService();
// 2. Add Cronlight, and the optional features you want
builder.Services.AddCronlight(o =>
{
o.ViewPolicy = "QuartzViewers"; // required outside Development
o.ManagePolicy = "QuartzAdmins"; // create, edit, pause, run and delete
});
builder.Services.AddCronlightHistory(); // execution history
builder.Services.AddCronlightAlerts(o => builder.Configuration.GetSection("CronlightAlerts").Bind(o)); // alerts
builder.Services.AddHealthChecks().AddCronlight(); // health check
var app = builder.Build();
app.UseAuthentication();
app.UseAuthorization();
// 3. Map it under any path
app.MapCronlight("/ops/jobs");
Open /ops/jobs/. The API is at /ops/jobs/api/*, described by an OpenAPI document at /ops/jobs/api/openapi.json.
Access: without a ViewPolicy, the dashboard answers 403 outside the Development environment.
Scripts: requests that change jobs must send an X-Cronlight-Request header (any value), which keeps other
sites from using a viewer's cookies:
curl -X POST -H "X-Cronlight-Request: 1" https://…/ops/jobs/api/jobs/DEFAULT/nightly/trigger
Job types: any IJob in your app can be created from the dashboard. Attributes give one a proper form:
[CronlightJob("Send invoices", Description = "Emails pending invoices for a customer")]
[JobParameter("customerId", Type = JobParameterType.Int, Required = true)]
[JobParameter("smtpPassword", Type = JobParameterType.Secret)]
public class InvoiceJob : IJob { ... }
MIT. See LICENSE.