From 18b04940a85281207b9b8cb3ba7d0699c81303ca Mon Sep 17 00:00:00 2001 From: Goncalo Oliveira Date: Fri, 15 Jan 2021 17:55:57 +0100 Subject: [PATCH] moved from redpanda --- README.md | 4 ++-- src/AssemblyResolver.cs | 2 +- src/Configuration/SecretsConfigurationExtensions.cs | 2 +- src/Configuration/SecretsConfigurationProvider.cs | 3 ++- src/Configuration/SecretsConfigurationSource.cs | 3 ++- src/DockerWrapper.cs | 12 +++++++----- src/FunctionServiceExtensions.cs | 2 +- src/HttpFunctionExtensions.cs | 4 ++-- src/HttpMethodAttributeExtensions.cs | 2 +- src/HttpRequestHandlerOptions.cs | 2 +- .../Authentication/AuthenticationHandler.cs | 4 ++-- src/Middleware/AuthenticationMiddleware.cs | 2 +- src/Middleware/AuthorizationMiddleware.cs | 2 +- src/Middleware/FunctionMiddleware.cs | 2 +- src/Middleware/Routing/IRouteMatcher.cs | 2 +- src/Middleware/Routing/RouteMatcher.cs | 2 +- src/Middleware/RoutingMiddleware.cs | 2 +- src/Program.cs | 2 +- src/Startup.cs | 2 +- src/faas-run.csproj | 8 +++----- 20 files changed, 33 insertions(+), 31 deletions(-) diff --git a/README.md b/README.md index 2b314b9..21feba5 100644 --- a/README.md +++ b/README.md @@ -1,10 +1,10 @@ # FaaS Runner for ASPNET Functions -FaaS Runner (or just `faas-run`) is one of the components of ASPNET Functions for OpenFaaS. It uses a plugin architecture to dynamically load a function assembly and host the function execution. It is used by the [OpenFaaS ASPNET Template](https://github.com/redpandaltd/faas-aspnet-template), but it can also be used separately. +FaaS Runner (or just `faas-run`) is one of the components of ASPNET Functions for OpenFaaS. It uses a plugin architecture to dynamically load a function assembly and host the function execution. It is used by the [OpenFaaS ASPNET Template](https://github.com/goncalo-oliveira/faas-aspnet-template), but it can also be used separately. ## Installing -Go to the [Releases](https://github.com/redpandaltd/faas-run/releases) page and download the appropriate binary for your platform. You can also pull the Docker image from [Docker Hub](https://hub.docker.com/r/redpandaltd/faas-run). +Go to the [Releases](https://github.com/goncalo-oliveira/faas-run/releases) page and download the appropriate binary for your platform. You can also pull the Docker image from [Docker Hub](https://hub.docker.com/r/goncalo-oliveira/faas-run). ## Usage diff --git a/src/AssemblyResolver.cs b/src/AssemblyResolver.cs index c990152..02aef3e 100644 --- a/src/AssemblyResolver.cs +++ b/src/AssemblyResolver.cs @@ -7,7 +7,7 @@ using Microsoft.Extensions.DependencyModel; using Microsoft.Extensions.DependencyModel.Resolution; -namespace Redpanda.OpenFaaS +namespace OpenFaaS { internal sealed class AssemblyResolver : IDisposable { diff --git a/src/Configuration/SecretsConfigurationExtensions.cs b/src/Configuration/SecretsConfigurationExtensions.cs index 8f84884..450b9f7 100644 --- a/src/Configuration/SecretsConfigurationExtensions.cs +++ b/src/Configuration/SecretsConfigurationExtensions.cs @@ -1,5 +1,5 @@ using Microsoft.Extensions.Configuration.EnvironmentVariables; -using Microsoft.Extensions.Configuration.OpenFaaSSecrets; +using OpenFaaS.Configuration; using System; using System.Collections.Generic; using System.Linq; diff --git a/src/Configuration/SecretsConfigurationProvider.cs b/src/Configuration/SecretsConfigurationProvider.cs index 2a99946..99ecae1 100644 --- a/src/Configuration/SecretsConfigurationProvider.cs +++ b/src/Configuration/SecretsConfigurationProvider.cs @@ -1,7 +1,8 @@ using System; using System.IO; +using Microsoft.Extensions.Configuration; -namespace Microsoft.Extensions.Configuration.OpenFaaSSecrets +namespace OpenFaaS.Configuration { internal class SecretsConfigurationProvider : ConfigurationProvider { diff --git a/src/Configuration/SecretsConfigurationSource.cs b/src/Configuration/SecretsConfigurationSource.cs index c55ee60..b1bfe2f 100644 --- a/src/Configuration/SecretsConfigurationSource.cs +++ b/src/Configuration/SecretsConfigurationSource.cs @@ -2,8 +2,9 @@ using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; +using Microsoft.Extensions.Configuration; -namespace Microsoft.Extensions.Configuration.OpenFaaSSecrets +namespace OpenFaaS.Configuration { internal class SecretsConfigurationSource : IConfigurationSource { diff --git a/src/DockerWrapper.cs b/src/DockerWrapper.cs index 988df06..bf7f7c9 100644 --- a/src/DockerWrapper.cs +++ b/src/DockerWrapper.cs @@ -2,10 +2,12 @@ using System.Diagnostics; using System.Linq; -namespace Redpanda.OpenFaaS +namespace OpenFaaS { internal class DockerWrapper { + private readonly string dockerImage = "goncalo-oliveira/faas-run"; + private string GetImageTag() { // image tag should match the assembly version @@ -46,7 +48,7 @@ public void RunDetached( Options options ) !string.IsNullOrEmpty( configPath ) ? $"-v {configPath}:/home/app/config.json:ro" : string.Empty, - $"redpandaltd/faas-run:{imageTag}", + $"{dockerImage}:{imageTag}", "faas-run", $"/home/app/{assemblyFile}", "-p 80", @@ -60,11 +62,11 @@ public void RunDetached( Options options ) var dockerArgs = string.Join( (char)0x20, args ); - // Console.WriteLine( $"docker pull redpandaltd/faas-run:{imageTag}" ); + // Console.WriteLine( $"docker pull {dockerImage}:{imageTag}" ); // Console.WriteLine( "docker " + dockerArgs ); // pull faas-run image - var pullExitCode = Exec( "docker", $"pull redpandaltd/faas-run:{imageTag}" ); + var pullExitCode = Exec( "docker", $"pull {dockerImage}:{imageTag}" ); if ( pullExitCode > 0 ) { @@ -81,7 +83,7 @@ public void RunDetached( Options options ) } // display container info - Exec( "docker", $"ps --filter ancestor=redpandaltd/faas-run:{imageTag}" ); + Exec( "docker", $"ps --filter ancestor={dockerImage}:{imageTag}" ); } private int Exec( string fileName, string args = null ) diff --git a/src/FunctionServiceExtensions.cs b/src/FunctionServiceExtensions.cs index 8bba530..fcce0f1 100644 --- a/src/FunctionServiceExtensions.cs +++ b/src/FunctionServiceExtensions.cs @@ -3,7 +3,7 @@ using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; -namespace Redpanda.OpenFaaS +namespace OpenFaaS { internal static class FunctionServiceExtensions { diff --git a/src/HttpFunctionExtensions.cs b/src/HttpFunctionExtensions.cs index b184d64..72f3907 100644 --- a/src/HttpFunctionExtensions.cs +++ b/src/HttpFunctionExtensions.cs @@ -1,9 +1,9 @@ using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc.Routing; -using Redpanda.OpenFaaS; +using OpenFaaS; using System.Linq; -namespace Redpanda.OpenFaaS +namespace OpenFaaS { internal static class HttpFunctionExtensions { diff --git a/src/HttpMethodAttributeExtensions.cs b/src/HttpMethodAttributeExtensions.cs index 17fb9d2..2447889 100644 --- a/src/HttpMethodAttributeExtensions.cs +++ b/src/HttpMethodAttributeExtensions.cs @@ -6,7 +6,7 @@ using System.Linq; using System.Threading.Tasks; -namespace Redpanda.OpenFaaS +namespace OpenFaaS { internal static class HttpMethodAttributeExtensions { diff --git a/src/HttpRequestHandlerOptions.cs b/src/HttpRequestHandlerOptions.cs index cd30174..d6c87d0 100644 --- a/src/HttpRequestHandlerOptions.cs +++ b/src/HttpRequestHandlerOptions.cs @@ -1,6 +1,6 @@ using System; -namespace Redpanda.OpenFaaS +namespace OpenFaaS { internal class HttpRequestHandlerOptions { diff --git a/src/Middleware/Authentication/AuthenticationHandler.cs b/src/Middleware/Authentication/AuthenticationHandler.cs index d453635..8a7144f 100644 --- a/src/Middleware/Authentication/AuthenticationHandler.cs +++ b/src/Middleware/Authentication/AuthenticationHandler.cs @@ -1,13 +1,13 @@ using Microsoft.AspNetCore.Authentication; using Microsoft.AspNetCore.Http; using Microsoft.Extensions.Logging; -using Redpanda.OpenFaaS; +using OpenFaaS; using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; -namespace Redpanda.OpenFaaS +namespace OpenFaaS { internal class HttpAuthenticationHandler { diff --git a/src/Middleware/AuthenticationMiddleware.cs b/src/Middleware/AuthenticationMiddleware.cs index 0537031..67ce117 100644 --- a/src/Middleware/AuthenticationMiddleware.cs +++ b/src/Middleware/AuthenticationMiddleware.cs @@ -5,7 +5,7 @@ using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Options; -namespace Redpanda.OpenFaaS +namespace OpenFaaS { /// /// Deals with authentication diff --git a/src/Middleware/AuthorizationMiddleware.cs b/src/Middleware/AuthorizationMiddleware.cs index 2128aff..d7d3bbd 100644 --- a/src/Middleware/AuthorizationMiddleware.cs +++ b/src/Middleware/AuthorizationMiddleware.cs @@ -5,7 +5,7 @@ using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Options; -namespace Redpanda.OpenFaaS +namespace OpenFaaS { /// /// Deals with authorization diff --git a/src/Middleware/FunctionMiddleware.cs b/src/Middleware/FunctionMiddleware.cs index 67cd480..9a904b3 100644 --- a/src/Middleware/FunctionMiddleware.cs +++ b/src/Middleware/FunctionMiddleware.cs @@ -6,7 +6,7 @@ using Microsoft.AspNetCore.Mvc.Abstractions; using Microsoft.AspNetCore.Routing; -namespace Redpanda.OpenFaaS +namespace OpenFaaS { /// /// Deals with function execution and response handling diff --git a/src/Middleware/Routing/IRouteMatcher.cs b/src/Middleware/Routing/IRouteMatcher.cs index 4826ec7..29d14f7 100644 --- a/src/Middleware/Routing/IRouteMatcher.cs +++ b/src/Middleware/Routing/IRouteMatcher.cs @@ -1,6 +1,6 @@ using Microsoft.AspNetCore.Routing; -namespace Redpanda.OpenFaaS +namespace OpenFaaS { internal interface IRouteMatcher { diff --git a/src/Middleware/Routing/RouteMatcher.cs b/src/Middleware/Routing/RouteMatcher.cs index 2de216f..5629ba7 100644 --- a/src/Middleware/Routing/RouteMatcher.cs +++ b/src/Middleware/Routing/RouteMatcher.cs @@ -5,7 +5,7 @@ using System.Linq; using System.Threading.Tasks; -namespace Redpanda.OpenFaaS +namespace OpenFaaS { internal class RouteMatcher : IRouteMatcher { diff --git a/src/Middleware/RoutingMiddleware.cs b/src/Middleware/RoutingMiddleware.cs index d1518e8..26be51a 100644 --- a/src/Middleware/RoutingMiddleware.cs +++ b/src/Middleware/RoutingMiddleware.cs @@ -5,7 +5,7 @@ using Microsoft.Extensions.Logging; using Microsoft.Extensions.Options; -namespace Redpanda.OpenFaaS +namespace OpenFaaS { /// /// Deals with routing and routing templates diff --git a/src/Program.cs b/src/Program.cs index f15cce3..a46c89b 100644 --- a/src/Program.cs +++ b/src/Program.cs @@ -6,7 +6,7 @@ using Microsoft.Extensions.Hosting; using Microsoft.Extensions.Logging; -namespace Redpanda.OpenFaaS +namespace OpenFaaS { class Options { diff --git a/src/Startup.cs b/src/Startup.cs index d9f30c1..f367e5f 100644 --- a/src/Startup.cs +++ b/src/Startup.cs @@ -7,7 +7,7 @@ using Microsoft.Extensions.DependencyInjection.Extensions; using Newtonsoft.Json.Serialization; -namespace Redpanda.OpenFaaS +namespace OpenFaaS { public class Startup { diff --git a/src/faas-run.csproj b/src/faas-run.csproj index 8df20b9..79214ba 100644 --- a/src/faas-run.csproj +++ b/src/faas-run.csproj @@ -3,12 +3,10 @@ Exe net5.0 - 1.4 + 1.5 Goncalo Oliveira - RedPanda Ltd FaaS runner for ASPNET functions - - Redpanda Ltd + https://github.com/goncalo-oliveira/faas-run @@ -17,7 +15,7 @@ - +