-
Notifications
You must be signed in to change notification settings - Fork 3
wip: pushing to talk structure with @ttd #174
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
4143456
a841e74
c2e0cb9
979ceac
1bd09f5
e5380cb
7b309d2
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| **/.classpath | ||
| **/.dockerignore | ||
| **/.env | ||
| **/.git | ||
| **/.gitignore | ||
| **/.project | ||
| **/.settings | ||
| **/.toolstarget | ||
| **/.vs | ||
| **/.vscode | ||
| **/*.*proj.user | ||
| **/*.dbmdl | ||
| **/*.jfm | ||
| **/azds.yaml | ||
| **/bin | ||
| **/charts | ||
| **/docker-compose* | ||
| **/Dockerfile* | ||
| **/node_modules | ||
| **/npm-debug.log | ||
| **/obj | ||
| **/secrets.dev.yaml | ||
| **/values.dev.yaml | ||
| LICENSE | ||
| README.md |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| #See https://aka.ms/customizecontainer to learn how to customize your debug container and how Visual Studio uses this Dockerfile to build your images for faster debugging. | ||
|
|
||
| FROM mcr.microsoft.com/dotnet/aspnet:8.0-preview AS base | ||
| WORKDIR /app | ||
| EXPOSE 80 | ||
| EXPOSE 443 | ||
|
|
||
| FROM mcr.microsoft.com/dotnet/sdk:8.0-preview AS build | ||
| WORKDIR /src | ||
| COPY ["Peer.Daemon/Peer.Daemon.Linux.csproj", "Peer.Daemon/"] | ||
| RUN dotnet restore "Peer.Daemon/Peer.Daemon.Linux.csproj" | ||
| COPY . . | ||
| WORKDIR "/src/Peer.Daemon" | ||
| RUN dotnet build "Peer.Daemon.Linux.csproj" -c Release -o /app/build | ||
|
|
||
| FROM build AS publish | ||
| RUN dotnet publish "Peer.Daemon.Linux.csproj" -c Release -o /app/publish /p:UseAppHost=false | ||
|
|
||
| FROM base AS final | ||
| WORKDIR /app | ||
| COPY --from=publish /app/publish . | ||
| ENTRYPOINT ["dotnet", "Peer.Daemon.Linux.dll"] |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,34 @@ | ||
| <Project Sdk="Microsoft.NET.Sdk.Web"> | ||
|
|
||
| <PropertyGroup> | ||
| <OutputType>Exe</OutputType> | ||
| <TargetFramework>net8.0</TargetFramework> | ||
| <ImplicitUsings>enable</ImplicitUsings> | ||
| <Nullable>enable</Nullable> | ||
| <UserSecretsId>a72c40e5-9101-4d72-a095-e1834bf03f06</UserSecretsId> | ||
| <DockerDefaultTargetOS>Linux</DockerDefaultTargetOS> | ||
| <DockerComposeProjectPath>..\docker-compose.dcproj</DockerComposeProjectPath> | ||
| </PropertyGroup> | ||
|
|
||
| <PropertyGroup Condition="'$(Configuration)'=='Release'"> | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I wonder if it would be worth using configurations more liberally so dockerfiles, workflows, etc. could just pass configurations and the meanings could be contained in a propertygroup like this. |
||
| <PublishSingleFile>true</PublishSingleFile> | ||
| <PublishTrimmed>true</PublishTrimmed> | ||
| <TrimMode>copyused</TrimMode> | ||
| <InvariantGlobalization>true</InvariantGlobalization> | ||
| <IncludeNativeLibrariesForSelfExtract>true</IncludeNativeLibrariesForSelfExtract> | ||
| <UseAppHost>True</UseAppHost> | ||
| </PropertyGroup> | ||
|
|
||
| <ItemGroup> | ||
| <PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="8.0.0-rc.1.23419.6"> | ||
| <PrivateAssets>all</PrivateAssets> | ||
| <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets> | ||
| </PackageReference> | ||
| <PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.19.5" /> | ||
| </ItemGroup> | ||
|
|
||
| <ItemGroup> | ||
| <ProjectReference Include="..\..\Server\Peer.Server\Peer.Server.csproj" /> | ||
| </ItemGroup> | ||
|
|
||
| </Project> | ||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,28 @@ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| using Microsoft.AspNetCore.Server.Kestrel.Core; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| using Peer.Server; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| namespace Peer.Daemon.Linux | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| internal class Program | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| private const string _socketPath = "/var/run/peerless/peerless.sock"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| static async Task Main() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Directory.CreateDirectory(Directory.GetParent(_socketPath)!.FullName); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| File.Delete(_socketPath); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Would this blow up an already running instance if a second one were started? I wonder if it would better to be aggressive about cleanup and fail to start if the socket is already open? I bet there's prior art about this somewhere. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| var app = ServerBuilder.CreateHost(cfg => | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| cfg.WebHost.UseKestrel(kestrel => | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| kestrel.ListenUnixSocket(_socketPath, opts => | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| opts.Protocols = HttpProtocols.Http2; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| await app.RunAsync(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+4
to
+28
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| { | ||
| "profiles": { | ||
| "Peer.Daemon.Linux": { | ||
| "commandName": "Project", | ||
| "launchBrowser": true, | ||
| "environmentVariables": { | ||
| "ASPNETCORE_ENVIRONMENT": "Development" | ||
| }, | ||
| "applicationUrl": "https://localhost:59768;http://localhost:59769" | ||
| }, | ||
| "Docker": { | ||
| "commandName": "Docker", | ||
| "launchBrowser": false, | ||
| "publishAllPorts": true, | ||
| "useSSL": false | ||
| } | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| <Project Sdk="Microsoft.NET.Sdk.Web"> | ||
| <PropertyGroup> | ||
| <TargetFramework>net8.0</TargetFramework> | ||
| <Nullable>enable</Nullable> | ||
| <ImplicitUsings>enable</ImplicitUsings> | ||
| <InvariantGlobalization>true</InvariantGlobalization> | ||
| </PropertyGroup> | ||
|
|
||
| <PropertyGroup Condition="'$(Configuration)'=='Release'"> | ||
| <PublishSingleFile>true</PublishSingleFile> | ||
| <PublishTrimmed>true</PublishTrimmed> | ||
| <TrimMode>copyused</TrimMode> | ||
| <InvariantGlobalization>true</InvariantGlobalization> | ||
| <IncludeNativeLibrariesForSelfExtract>true</IncludeNativeLibrariesForSelfExtract> | ||
| <UseAppHost>True</UseAppHost> | ||
| </PropertyGroup> | ||
|
|
||
| <ItemGroup> | ||
| <ProjectReference Include="..\..\Server\Peer.Server\Peer.Server.csproj" /> | ||
| </ItemGroup> | ||
|
|
||
| </Project> |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| using Microsoft.AspNetCore.Server.Kestrel.Core; | ||
| using Peer.Server; | ||
|
|
||
| namespace Peer.Daemon.Windows; | ||
|
|
||
| public class Program | ||
| { | ||
| public async static Task Main(string[] args) | ||
| { | ||
| var app = ServerBuilder.CreateHost(builder => | ||
| { | ||
| builder.WebHost.UseKestrel(x => | ||
| { | ||
| x.ListenNamedPipe("peerless", opts => | ||
| { | ||
| opts.Protocols = HttpProtocols.Http2; | ||
| }); | ||
| }); | ||
| }); | ||
|
|
||
| await app.RunAsync(); | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| { | ||
| "$schema": "http://json.schemastore.org/launchsettings.json", | ||
| "profiles": { | ||
| "http": { | ||
| "commandName": "Project", | ||
| "dotnetRunMessages": true, | ||
| "environmentVariables": { | ||
| "ASPNETCORE_ENVIRONMENT": "Development" | ||
| } | ||
| } | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| { | ||
| "Logging": { | ||
| "LogLevel": { | ||
| "Default": "Information", | ||
| "Microsoft.AspNetCore": "Trace" | ||
| } | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| { | ||
| "Logging": { | ||
| "LogLevel": { | ||
| "Default": "Information", | ||
| "Microsoft.AspNetCore": "Warning" | ||
| } | ||
| }, | ||
| "AllowedHosts": "*" | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| <Project Sdk="Microsoft.NET.Sdk"> | ||
|
|
||
| <PropertyGroup> | ||
| <OutputType>Exe</OutputType> | ||
| <TargetFramework>net8.0</TargetFramework> | ||
| <ImplicitUsings>enable</ImplicitUsings> | ||
| <Nullable>enable</Nullable> | ||
| <PublishAot>true</PublishAot> | ||
| <InvariantGlobalization>true</InvariantGlobalization> | ||
| </PropertyGroup> | ||
|
|
||
| <ItemGroup> | ||
| <PackageReference Include="Grpc.Net.Client" Version="2.57.0" /> | ||
| <PackageReference Include="Grpc.Tools" Version="2.58.0"> | ||
| <PrivateAssets>all</PrivateAssets> | ||
| <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets> | ||
| </PackageReference> | ||
| <PackageReference Include="Google.Protobuf" Version="3.24.3" /> | ||
| </ItemGroup> | ||
|
|
||
| <ItemGroup> | ||
| <ProjectReference Include="..\Server\Peer.Grpc\Peer.Grpc.csproj" /> | ||
| </ItemGroup> | ||
| </Project> |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,62 @@ | ||
| using System.IO.Pipes; | ||
| using System.Security.Principal; | ||
| using Grpc.Net.Client; | ||
| using Peerless; | ||
|
|
||
| namespace Geas; | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nerd |
||
|
|
||
| internal class Program | ||
| { | ||
| public string[] _commands = { "prs" }; | ||
| public string[] _modes = { "unix", "windows" }; | ||
| static async Task Main(string[] args) | ||
| { | ||
| var factory = new NamedPipeConnectionFactory("peerless"); | ||
|
|
||
| var handler = new SocketsHttpHandler() | ||
| { | ||
| ConnectCallback = factory.ConnectAsync | ||
| }; | ||
|
|
||
| var channel = GrpcChannel.ForAddress("http://pipe:/peerless", new GrpcChannelOptions | ||
| { | ||
| HttpHandler = handler | ||
| }); | ||
|
|
||
| var client = new PullRequestGrpcService.PullRequestGrpcServiceClient(channel); | ||
| var res = client.GetPullRequest(new GetPullRequestRequest { Id = 1 }); | ||
| await Console.Out.WriteLineAsync($"Found: {res.Value.Id}"); | ||
| } | ||
| } | ||
|
|
||
| public class NamedPipeConnectionFactory | ||
| { | ||
| private readonly string _pipeName; | ||
|
|
||
| public NamedPipeConnectionFactory(string pipeName) | ||
| { | ||
| _pipeName = pipeName; | ||
| } | ||
|
|
||
| public async ValueTask<Stream> ConnectAsync(SocketsHttpConnectionContext _, | ||
| CancellationToken cancellationToken = default) | ||
| { | ||
| var clientStream = new NamedPipeClientStream( | ||
| serverName: ".", | ||
| pipeName: _pipeName, | ||
| direction: PipeDirection.InOut, | ||
| options: PipeOptions.WriteThrough | PipeOptions.Asynchronous, | ||
| impersonationLevel: TokenImpersonationLevel.Anonymous); | ||
|
|
||
| try | ||
| { | ||
| await clientStream.ConnectAsync(cancellationToken).ConfigureAwait(false); | ||
| return clientStream; | ||
| } | ||
| catch | ||
| { | ||
| clientStream.Dispose(); | ||
| throw; | ||
| } | ||
| } | ||
| } | ||
This file was deleted.
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,9 +1,8 @@ | ||
| namespace Peer.Domain.Configuration | ||
| namespace Peer.Domain.Configuration; | ||
|
|
||
| public enum RegistrationError | ||
| { | ||
| public enum RegistrationError | ||
| { | ||
| Fire, | ||
| ProviderMismatch, | ||
| BadConfig, | ||
| } | ||
| Fire, | ||
| ProviderMismatch, | ||
| BadConfig, | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,14 +1,18 @@ | ||
| using System.Collections.Generic; | ||
| using System.Threading; | ||
| using System.Threading.Tasks; | ||
| using Peer.Domain.Commands; | ||
| using wimm.Secundatives; | ||
|
|
||
| namespace Peer.Domain | ||
| namespace Peer.Domain; | ||
|
|
||
| public interface IPullRequestService | ||
| { | ||
| IAsyncEnumerable<PullRequest> FetchAllPullRequests(CancellationToken token = default); | ||
| Task<Result<PullRequest, FindError>> FindSingleByPartial(PartialIdentifier partial, CancellationToken token = default); | ||
| } | ||
|
|
||
| public enum FindError | ||
| { | ||
| public interface IPullRequestService | ||
| { | ||
| IAsyncEnumerable<PullRequest> FetchAllPullRequests(CancellationToken token = default); | ||
| Task<Result<PullRequest, FindError>> FindSingleByPartial(PartialIdentifier partial, CancellationToken token = default); | ||
| } | ||
| AmbiguousMatch, | ||
| NotFound | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You like this?