MethodContainerizer.Docker
1.0.0
dotnet add package MethodContainerizer.Docker --version 1.0.0
NuGet\Install-Package MethodContainerizer.Docker -Version 1.0.0
<PackageReference Include="MethodContainerizer.Docker" Version="1.0.0" />
paket add MethodContainerizer.Docker --version 1.0.0
#r "nuget: MethodContainerizer.Docker, 1.0.0"
// Install MethodContainerizer.Docker as a Cake Addin #addin nuget:?package=MethodContainerizer.Docker&version=1.0.0 // Install MethodContainerizer.Docker as a Cake Tool #tool nuget:?package=MethodContainerizer.Docker&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
- MethodContainerizer (>= 1.0.0)
- Microsoft.Extensions.DependencyInjection (>= 5.0.2)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
1.0.0 | 367 | 10/27/2021 |