Skip to content
This repository has been archived by the owner on Nov 26, 2021. It is now read-only.

Commit

Permalink
moved from redpanda
Browse files Browse the repository at this point in the history
  • Loading branch information
Goncalo Oliveira committed Jan 15, 2021
1 parent 5801adb commit 18b0494
Show file tree
Hide file tree
Showing 20 changed files with 33 additions and 31 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -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

Expand Down
2 changes: 1 addition & 1 deletion src/AssemblyResolver.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
using Microsoft.Extensions.DependencyModel;
using Microsoft.Extensions.DependencyModel.Resolution;

namespace Redpanda.OpenFaaS
namespace OpenFaaS
{
internal sealed class AssemblyResolver : IDisposable
{
Expand Down
2 changes: 1 addition & 1 deletion src/Configuration/SecretsConfigurationExtensions.cs
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
3 changes: 2 additions & 1 deletion src/Configuration/SecretsConfigurationProvider.cs
Original file line number Diff line number Diff line change
@@ -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
{
Expand Down
3 changes: 2 additions & 1 deletion src/Configuration/SecretsConfigurationSource.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down
12 changes: 7 additions & 5 deletions src/DockerWrapper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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",
Expand All @@ -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 )
{
Expand All @@ -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 )
Expand Down
2 changes: 1 addition & 1 deletion src/FunctionServiceExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;

namespace Redpanda.OpenFaaS
namespace OpenFaaS
{
internal static class FunctionServiceExtensions
{
Expand Down
4 changes: 2 additions & 2 deletions src/HttpFunctionExtensions.cs
Original file line number Diff line number Diff line change
@@ -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
{
Expand Down
2 changes: 1 addition & 1 deletion src/HttpMethodAttributeExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
using System.Linq;
using System.Threading.Tasks;

namespace Redpanda.OpenFaaS
namespace OpenFaaS
{
internal static class HttpMethodAttributeExtensions
{
Expand Down
2 changes: 1 addition & 1 deletion src/HttpRequestHandlerOptions.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using System;

namespace Redpanda.OpenFaaS
namespace OpenFaaS
{
internal class HttpRequestHandlerOptions
{
Expand Down
4 changes: 2 additions & 2 deletions src/Middleware/Authentication/AuthenticationHandler.cs
Original file line number Diff line number Diff line change
@@ -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
{
Expand Down
2 changes: 1 addition & 1 deletion src/Middleware/AuthenticationMiddleware.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Options;

namespace Redpanda.OpenFaaS
namespace OpenFaaS
{
/// <summary>
/// Deals with authentication
Expand Down
2 changes: 1 addition & 1 deletion src/Middleware/AuthorizationMiddleware.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Options;

namespace Redpanda.OpenFaaS
namespace OpenFaaS
{
/// <summary>
/// Deals with authorization
Expand Down
2 changes: 1 addition & 1 deletion src/Middleware/FunctionMiddleware.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
using Microsoft.AspNetCore.Mvc.Abstractions;
using Microsoft.AspNetCore.Routing;

namespace Redpanda.OpenFaaS
namespace OpenFaaS
{
/// <summary>
/// Deals with function execution and response handling
Expand Down
2 changes: 1 addition & 1 deletion src/Middleware/Routing/IRouteMatcher.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using Microsoft.AspNetCore.Routing;

namespace Redpanda.OpenFaaS
namespace OpenFaaS
{
internal interface IRouteMatcher
{
Expand Down
2 changes: 1 addition & 1 deletion src/Middleware/Routing/RouteMatcher.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
using System.Linq;
using System.Threading.Tasks;

namespace Redpanda.OpenFaaS
namespace OpenFaaS
{
internal class RouteMatcher : IRouteMatcher
{
Expand Down
2 changes: 1 addition & 1 deletion src/Middleware/RoutingMiddleware.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options;

namespace Redpanda.OpenFaaS
namespace OpenFaaS
{
/// <summary>
/// Deals with routing and routing templates
Expand Down
2 changes: 1 addition & 1 deletion src/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging;

namespace Redpanda.OpenFaaS
namespace OpenFaaS
{
class Options
{
Expand Down
2 changes: 1 addition & 1 deletion src/Startup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
using Microsoft.Extensions.DependencyInjection.Extensions;
using Newtonsoft.Json.Serialization;

namespace Redpanda.OpenFaaS
namespace OpenFaaS
{
public class Startup
{
Expand Down
8 changes: 3 additions & 5 deletions src/faas-run.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,10 @@
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net5.0</TargetFramework>
<Version>1.4</Version>
<Version>1.5</Version>
<Authors>Goncalo Oliveira</Authors>
<Company>RedPanda Ltd</Company>
<Description>FaaS runner for ASPNET functions</Description>
<RepositoryUrl></RepositoryUrl>
<Copyright>Redpanda Ltd</Copyright>
<RepositoryUrl>https://github.com/goncalo-oliveira/faas-run</RepositoryUrl>
</PropertyGroup>

<ItemGroup>
Expand All @@ -17,7 +15,7 @@
<PackageReference Include="Microsoft.Extensions.Configuration" Version="5.0.0" />
<PackageReference Include="Microsoft.Extensions.DependencyModel" Version="5.0.0" />
<PackageReference Include="Microsoft.Extensions.Options" Version="5.0.0" />
<PackageReference Include="Redpanda.OpenFaaS.Functions" Version="1.2.0" />
<PackageReference Include="OpenFaaS.Functions" Version="1.3.0" />
</ItemGroup>

</Project>

0 comments on commit 18b0494

Please sign in to comment.