Add listmonk hosting integration#1457
Conversation
- Implemented `CommunityToolkit.Aspire.Hosting.Listmonk` for Listmonk container integration. - Introduced extension methods for configuring Listmonk containers, environment variables, volumes, and annotations. - Added test projects for validating Listmonk configurations and functionalities. - Created example projects under `examples/listmonk` to demonstrate integration and usage. - Updated solution and centralized package references to include the new Listmonk project.
…der `/src` and `/examples/listmonk`.
|
🚀 Dogfood this PR with:
curl -fsSL https://raw.githubusercontent.com/CommunityToolkit/Aspire/main/eng/scripts/dogfood-pr.sh | bash -s -- 1457Or
iex "& { $(irm https://raw.githubusercontent.com/CommunityToolkit/Aspire/main/eng/scripts/dogfood-pr.ps1) } 1457" |
…ons and resource relationships.
- Introduced new parameters `postgresName` and `databaseName` to simplify PostgreSQL integration. - Removed `WithPostgreSQL` method and replaced it with an internal `ConfigurePostgreSQL` implementation. - Updated XML documentation and examples to reflect the new configuration approach.
aaronpowell
left a comment
There was a problem hiding this comment.
There's a design request change on how PostgreSQL is handled, and the implications of that would also require some test updates (I didn't annotate those though).
| var postgres = builder.AddPostgres(postgresName ?? $"{name}-postgres") | ||
| .WithParentRelationship(listmonk.Resource); | ||
| var database = postgres.AddDatabase(databaseName ?? $"{name}-db"); | ||
|
|
||
| return listmonk.ConfigurePostgreSQL(database); |
There was a problem hiding this comment.
I don't think this is a good idea. While I get the desire for simplicity, just adding listmock and everything is configured, you lose the flexibility of database control. What if I have a Postgres server for other parts of my setup that I want to reuse? This design means that I can't do that.
Instead, we should expose a WithReference that takes the Postgres database and runs the ConfigurePostgreSQL stuff against it.
| using Aspire.Hosting.ApplicationModel; | ||
| using CommunityToolkit.Aspire.Hosting.Listmonk; | ||
|
|
||
| #pragma warning disable ASPIREATS001 // AspireExport is experimental |
There was a problem hiding this comment.
This isn't needed anymore (should get around to cleaning up the rest of the integrations too)
| /// <param name="groupId">The value for <c>PGID</c>.</param> | ||
| /// <returns>The <see cref="IResourceBuilder{T}"/>.</returns> | ||
| [AspireExport] | ||
| public static IResourceBuilder<ListmonkResource> WithUserAndGroupId(this IResourceBuilder<ListmonkResource> builder, int userId, int groupId) |
There was a problem hiding this comment.
Let's drop this method, it's not really providing anything that we don't have other methods for.
| /// <summary>listmonk/listmonk</summary> | ||
| public const string Image = "listmonk/listmonk"; | ||
| /// <summary>latest</summary> | ||
| public const string Tag = "latest"; |
There was a problem hiding this comment.
| public const string Tag = "latest"; | |
| public const string Tag = "v6.2.0"; |
We don't want to pin to latest but to explicit versions
| /// Initializes a new instance of the <see cref="ListmonkResource"/> class. | ||
| /// </summary> | ||
| /// <param name="name">The name of the resource.</param> | ||
| public ListmonkResource([ResourceName] string name) : base(name) |
…th `Aspire.Hosting` conventions
…uration and tests
…L database configuration.
…hReference`. Update XML docs and examples accordingly.
…ives from `ListmonkBuilderExtensions` and `ListmonkResource`.
Adds a new listmonk hosting integration for Aspire.
This PR adds:
CommunityToolkit.Aspire.Hosting.ListmonkThe integration runs the official
listmonk/listmonkcontainer, configures it to use PostgreSQL, runs install and upgrade on startup, exposes HTTP connection properties, and supports the documented listmonk environment configuration surface.PR Checklist
Other information
Validation performed:
dotnet build tests/CommunityToolkit.Aspire.Hosting.Listmonk.Tests/CommunityToolkit.Aspire.Hosting.Listmonk.Tests.csprojdotnet test tests/CommunityToolkit.Aspire.Hosting.Listmonk.Tests/CommunityToolkit.Aspire.Hosting.Listmonk.Tests.csproj --no-buildaspire restore --apphost apphost.mtsnpx.cmd tsc --noEmitbash eng/testing/generate-test-list-for-workflow.sh --plainCI has also run
Hosting.Listmonk.Testson Ubuntu and Windows.