Skip to content

Feature/tenant lifecycle automation#1150

Merged
iammukeshm merged 4 commits into
developfrom
feature/tenant-lifecycle-automation
Dec 3, 2025
Merged

Feature/tenant lifecycle automation#1150
iammukeshm merged 4 commits into
developfrom
feature/tenant-lifecycle-automation

Conversation

@iammukeshm
Copy link
Copy Markdown
Member

This pull request introduces several improvements and updates focused on tenant lifecycle automation, multitenancy infrastructure, dependency upgrades, and enhanced logging for background jobs. The changes collectively improve the reliability, observability, and maintainability of tenant provisioning and background job execution.

Tenant Lifecycle Automation and Multitenancy Enhancements:

  • Added a comprehensive documentation file outlining the goals, scope, requirements, and flow for automated tenant provisioning and lifecycle management. This includes background job orchestration, health verification, idempotency, and operational/audit requirements.
  • Refactored AppTenantInfo to use a record type inheriting from TenantInfo, improved constructors for EF/tooling compatibility, and clarified property handling for connection strings and validity management. [1] [2] [3] [4]
  • Introduced a constant for tenant schema in MultitenancyConstants, supporting schema-based multi-tenancy strategies.

Dependency and Package Updates:

  • Upgraded several NuGet package versions, including Finbuckle.MultiTenant and related packages to v10, Npgsql.EntityFrameworkCore.PostgreSQL to v10, and other supporting libraries to ensure compatibility and access to new features. [1] [2] [3]
  • Added a direct reference to Finbuckle.MultiTenant.Abstractions in the shared project for improved type access.

Background Job and Hangfire Configuration Improvements:

  • Enhanced Hangfire and background job configuration: options binding for HangfireOptions, improved database options retrieval, and ensured tenant context is set using the updated AppTenantInfo record. [1] [2] [3]
  • Changed audit scope registration from singleton to scoped to ensure proper context per request in auditing module.
  • Added missing Microsoft.AspNetCore.Http import for audit publisher.

Logging and Observability:

  • Changed job lifecycle logging from InfoFormat to DebugFormat in LogJobFilter to reduce log noise and improve log level appropriateness for job creation, execution, and state changes. [1] [2] [3] [4] [5] [6]

These changes collectively strengthen the foundation for multi-tenant SaaS automation, improve operational safety, and ensure the codebase is up-to-date with the latest dependencies and best practices.

Expanded `tenant-lifecycle-automation.md` with a detailed framework for automating tenant provisioning, activation, and health verification.

- Defined goals, scope, and non-goals for the automation process.
- Outlined personas (Platform Admin, Tenant Admin, SRE/DevOps).
- Documented high-level workflow for provisioning steps.
- Specified functional, operational, and security requirements.
- Added acceptance criteria for successful provisioning.
- Included failure/recovery criteria for error handling and retries.

This update ensures a robust, secure, and observable tenant lifecycle management process.
- Introduced a tenant provisioning workflow with support for migrations, seeding, and cache warming.
- Added `TenantProvisioningService` and related entities to manage provisioning steps and statuses.
- Updated `ITenantService` with methods for tenant migration and seeding.
- Added endpoints for retrieving and retrying tenant provisioning statuses.
- Integrated Hangfire for background job execution and improved its configuration.
- Refactored logging in `LogJobFilter` to use `Logger.DebugFormat`.
- Updated `TenantDbContext` and added migrations for multitenancy and auditing.
- Adjusted service lifetimes for audit and tenant provisioning components.
- Updated `appsettings.json` for database connection and Serilog configuration.
- Removed redundant code and improved maintainability with modern C# features.
Implemented automated tenant provisioning with persisted status
and retry support. Added background provisioning via Hangfire
with inline fallback for dev environments. Introduced startup
hosted services for tenant catalog migration/seeding and
optional auto-provision enqueue. Enhanced `TenantDbContextFactory`
to support PostgreSQL via appsettings. Fixed audit pipeline to
include tenant/user stamps and write per-tenant log batches.
@iammukeshm iammukeshm merged commit ccbfb6b into develop Dec 3, 2025
@iammukeshm iammukeshm deleted the feature/tenant-lifecycle-automation branch December 3, 2025 18:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant