MethodContainerizer 1.0.0
dotnet add package MethodContainerizer --version 1.0.0
NuGet\Install-Package MethodContainerizer -Version 1.0.0
<PackageReference Include="MethodContainerizer" Version="1.0.0" />
paket add MethodContainerizer --version 1.0.0
#r "nuget: MethodContainerizer, 1.0.0"
// Install MethodContainerizer as a Cake Addin #addin nuget:?package=MethodContainerizer&version=1.0.0 // Install MethodContainerizer as a Cake Tool #tool nuget:?package=MethodContainerizer&version=1.0.0
Method Containerizer
A library for automatically scaling a codebase by dynamically replacing class methods with containerized APIs during runtime.
Prerequisites
Currently requires Docker to be running on the machine running your application. In the future, I plan to support remote docker instances and Kubernetes clusters.
Usage
Add MethodContainerizer and MethodContainerizer.Docker to your project.
Example Startup.cs:
services
.AddSingleton<SomeComplexJob>()
.ContainerizeMethod<SomeComplexJob>(x => x.Start(default), 1)
.UseDockerOrchestration()
.BuildContainers();
If you would like to make sure all containers are terminated when the host closes, add the following:
app.TerminateMethodContainersOnExit();
How it works
When you mark a method to be containerized, a lot happens behind the scenes.
- A new "shallow assembly" is dynamically generated containing the marked method and only the direct dependencies needed for that method to function properly. This means, while this library does work by creating assemblies based off of the master application, these assemblies are small, build quickly, and run fast. There is no bloat from other actions happening within the application.
- A dynamic ASP.NET Core project is generated containing Program.cs with a main method, and a single HTTP Post controller endpoint
- A docker image is built with the aforementioned API project and shallow assembly inside
- A container is built and started containing the isolated method environment
- The original method is replaced with a proxy method which calls the respective API
Future Plans
- Add support for building of Dockerfiles remotely
- Docker Swarm
- Kubernetes
- Load monitoring / Multiple instances
- Analytics / Monitoring
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 is compatible. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
-
net5.0
- Castle.Core (>= 4.4.1)
- Docker.DotNet (>= 3.125.5)
- Lokad.ILPack (>= 0.1.7)
- Microsoft.AspNetCore.Hosting.Abstractions (>= 2.2.0)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 5.0.0)
- SharpCompress (>= 0.30.0)
- System.Reflection (>= 4.3.0)
- System.Reflection.Emit (>= 4.7.0)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on MethodContainerizer:
Package | Downloads |
---|---|
MethodContainerizer.Docker
Package Description |
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
1.0.0 | 384 | 10/27/2021 |