0
icoretchi created
- Template: microservice
- Created ABP Studio Version: 0.9.26
- Current ABP Studio Version: 2.0.2
- Multi-Tenancy: Yes
- UI Framework: angular
- Theme: leptonx
- Theme Style: system
- Run Install Libs: Yes
- Database Provider: ef
- Database Management System: sqlserver
- Mobile Framework: none
- Public Website: No
- Include Tests: Yes
- Dynamic Localization: Yes
- Kubernetes Configuration: Yes
- Grafana Dashboard: Yes
- Use Local References: No
- Optional Modules:
- GDPR
- FileManagement
- TextTemplateManagement
- AuditLogging
- Chat
- OpenIddictAdmin
- Exception message and full stack trace:
- Steps to reproduce the issue:
Hi,
Can you provide step by stept instruction how to configure Elsa for Abp microservices solution.
Thanks
4 Answer(s)
-
0
- Solution Below is a practical, end-to-end way to add and run Elsa in an ABP microservices solution (Angular UI, OpenIddict, SQL Server, multi-tenant). It covers two common integration paths:
- A) Use ABP’s Elsa Module (Pro) as the integration layer and run Elsa Studio separately.
- B) Use native Elsa packages directly inside a microservice (without ABP Pro module), including the HTTP activities and the Studio.
Pick A if you have ABP Team or higher license and want a maintained integration. Pick B if you prefer a pure Elsa setup.
A) Using ABP Elsa Module (Pro)
- Decide the topology
- Recommended: Host Elsa Server + Elsa API in one service (e.g., Administration or a dedicated Workflow service).
- Host Elsa Studio as a separate Blazor WASM app (recommended) or embed the Studio page in the gateway UI.
- Install the ABP Elsa Module in the chosen service
- Add references to:
- Volo.Elsa.Abp.AspNetCore (AbpElsaAspNetCoreModule)
- Volo.Elsa.Abp.Identity (AbpElsaIdentityModule) if you want to sign in Studio against ABP Identity/OpenIddict
- Volo.Elsa.Abp.Application / .Application.Contracts to include permissions
- In your Host module:
[DependsOn( typeof(Volo.Elsa.Abp.AspNetCore.AbpElsaAspNetCoreModule), typeof(Volo.Elsa.Abp.Identity.AbpElsaIdentityModule), typeof(Volo.Elsa.Abp.Application.AbpElsaApplicationModule), typeof(Volo.Elsa.Abp.Application.Contracts.AbpElsaApplicationContractsModule) )] public class WorkflowHostModule : AbpModule { public override void ConfigureServices(ServiceConfigurationContext context) { var configuration = context.Services.GetConfiguration(); // Typical ABP auth is already configured via OpenIddict. // Nothing special here for Elsa; ABP Elsa modules will wire integration. } }- Configure authentication model between Elsa Studio and your Auth Server (OpenIddict)
- Option 1: Authorization Code Flow (recommended):
- In Elsa Studio (Blazor WASM) Program.cs:
builder.Services.AddLoginModule().UseOpenIdConnect(connectConfiguration => { var authority = configuration["AuthServer:Authority"]!.TrimEnd('/'); connectConfiguration.AuthEndpoint = $"{authority}/connect/authorize"; connectConfiguration.TokenEndpoint = $"{authority}/connect/token"; connectConfiguration.EndSessionEndpoint = $"{authority}/connect/endsession"; connectConfiguration.ClientId = configuration["AuthServer:ClientId"]!; connectConfiguration.Scopes = new[] { "openid","profile","email","phone","roles","offline_access","<YourResourceName>" }; });- Option 2: Password Flow via ABP Identity integration in Elsa Server:
- In Elsa Server:
context.Services.AddElsa(elsa => elsa.UseAbpIdentity(identity => { identity.TokenOptions = options => options.SigningKey = "large-signing-key-for-signing-JWT-tokens"; }));- In Elsa Studio:
builder.Services.AddLoginModule().UseElsaIdentity();- Configure persistence and Elsa Server API in the host service
- Use SQL Server for Elsa persistence and enable Elsa API endpoints:
public override void ConfigureServices(ServiceConfigurationContext context) { var configuration = context.Services.GetConfiguration(); var elsaSection = configuration.GetSection("Elsa"); context.Services.AddElsa(elsa => elsa .UseEntityFrameworkPersistence(ef => DbContextOptionsBuilderExtensions.UseSqlServer( ef, configuration.GetConnectionString("Default"))) .AddHttpActivities(elsaSection.GetSection("Server").Bind) .AddQuartzTemporalActivities() .AddJavaScriptActivities() .AddWorkflowsFrom<Startup>() // optional: scan and register workflows ); context.Services.AddElsaApiEndpoints(); // ABP Anti-forgery exception for Elsa API endpoints Configure<AbpAntiForgeryOptions>(options => { options.AutoValidateFilter = type => type.Assembly != typeof(Elsa.Server.Api.Endpoints.WorkflowRegistry.Get).Assembly; }); // CORS for Studio if served from a different origin context.Services.AddCors(cors => cors.AddDefaultPolicy(policy => policy .AllowAnyHeader() .AllowAnyMethod() .AllowAnyOrigin() .WithExposedHeaders("Content-Disposition"))); } public override void OnApplicationInitialization(ApplicationInitializationContext context) { var app = context.GetApplicationBuilder(); app.UseCors(); app.UseHttpActivities(); // for HTTP activities app.UseConfiguredEndpoints(); }- appsettings.json (server base URL for Elsa HTTP activities):
{ "Elsa": { "Http": { "BaseUrl": "https://<your-workflow-host-base-url>" } } }- Secure access (permissions) to the Studio UI
- Define a permission, add it to the ABP menu and protect the Studio route with [Authorize(...)] so only permitted users can access.
- If embedding Studio inside an ABP module UI, add a page like /workflow and guard it via ABP permission.
- Multi-tenancy & microservices specifics
- Ensure AuthServer:Authority in each microservice points to the same public authority (with trailing slash) so tokens validate correctly behind gateway/k8s. If running behind ingress with different hostnames, add ValidIssuers accordingly in AddAbpJwtBearer if needed.
- Configure distributed event bus provider (e.g., RabbitMQ) for a real microservice deployment since modules may rely on it.
- If you want Elsa-triggered HTTP endpoints to be reachable via Web Gateway, add a YARP route:
- Route: /elsa/api/* → the workflow host service
- Route: /signals, /workflows (if exposed) → host service
- Ensure CORS and forwarded headers are correctly set in gateway and service.
- Run
- Migrate/seed your regular ABP DBs, then ensure Elsa EF tables are created by letting Elsa run with UseEntityFrameworkPersistence against your Default connection.
- Start the Workflow host and Elsa Studio, sign in via your OpenIddict AuthServer, then create and run workflows.
B) Using Elsa without ABP Elsa Module (pure Elsa integration) Use this path if you don’t have ABP Pro Elsa module:
- Install Elsa packages into the chosen host service
- Elsa
- Elsa.Activities.Http
- Elsa.Activities.Temporal.Quartz
- Elsa.Persistence.EntityFramework.SqlServer
- Elsa.Server.Api
- Elsa.Designer.Components.Web (for embedded Studio page)
- Register Elsa in the host service
public override void ConfigureServices(ServiceConfigurationContext context) { var configuration = context.Services.GetConfiguration(); var elsaSection = configuration.GetSection("Elsa"); context.Services.AddElsa(elsa => elsa .UseEntityFrameworkPersistence(ef => DbContextOptionsBuilderExtensions.UseSqlServer( ef, configuration.GetConnectionString("Default"))) .AddHttpActivities(elsaSection.GetSection("Server").Bind) .AddQuartzTemporalActivities() .AddJavaScriptActivities() .AddWorkflowsFrom<Startup>()); context.Services.AddElsaApiEndpoints(); // CORS if Studio is on another origin context.Services.AddCors(cors => cors.AddDefaultPolicy(policy => policy .AllowAnyHeader().AllowAnyMethod().AllowAnyOrigin())); // If you embed Studio page, no ABP perm system here; secure via your own middleware or auth. } public override void OnApplicationInitialization(ApplicationInitializationContext context) { var app = context.GetApplicationBuilder(); app.UseCors(); app.UseHttpActivities(); app.UseConfiguredEndpoints(endpoints => { // If you add a Razor page hosting Studio component, map fallback to your _Host page endpoints.MapFallbackToPage("/_Host"); }); }- Add Studio page (if embedding) and secure it
- Add a Razor page at /elsa that references the Elsa.Designer components and points server-url to your workflow host base URL. If using ABP UI in the same service, guard with an authorization attribute.
- Configure gateway routes (if any)
- Proxy /signalr-hubs/* or /elsa/api/* to the workflow host service.
- Allow CORS and forward Auth headers if Studio is served on a different origin.
- Multi-tenancy & auth
- Keep AuthServer:Authority consistent and publicly resolvable. If tokens fail with issuer validation in Kubernetes behind an ingress, set ValidIssuers to include the public authority (ensure trailing slash), as you would for other microservices.
Notes for ABP Angular UI
- Angular talks to backend services through the gateway. Expose Elsa API endpoints via the gateway when the Studio or activity endpoints need browser access.
- No change to Angular code is required unless you embed Studio into Angular; otherwise, host Studio as a separate Blazor WASM app.
- Sources
- Elsa Module (Pro) overview and notes (validated):
- https://abp.io/docs/10.0//modules/elsa-pro
- Distributed/microservice deployment guidance (validated):
- https://abp.io/docs/10.0//deployment/distributed-microservice
- Community article integrating Elsa into ABP (step-by-step, Elsa 2 style; concepts still applicable) (validated):
- https://abp.io/community/articles/773siqi9
This response was generated by AI. If it didn’t solve your problem, feel free to post a new answer — our support team will jump in to help you soon.
-
0
The suggestions does not based on last verison of Elsa. I have problems even with db migration generation.
-
0
-
0



