Skip to content

Commit

Permalink
Merge pull request #91 from datalust/dev
Browse files Browse the repository at this point in the history
5.0 Maintenance Release
  • Loading branch information
nblumhardt authored Jan 8, 2019
2 parents 9ca066b + 28ef7c5 commit adce8fb
Show file tree
Hide file tree
Showing 13 changed files with 110 additions and 8 deletions.
2 changes: 1 addition & 1 deletion Build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ function Publish-Archives($version)
{
$rids = @("linux-x64", "osx-x64", "win-x64")
foreach ($rid in $rids) {
& dotnet publish src/SeqCli/SeqCli.csproj -c Release -f $framework -r $rid /p:VersionPrefix=$version /p:ShowLinkerSizeComparison=true
& dotnet publish src/SeqCli/SeqCli.csproj -c Release -f $framework -r $rid /p:VersionPrefix=$version /p:SeqCliRid=$rid /p:ShowLinkerSizeComparison=true
if($LASTEXITCODE -ne 0) { exit 4 }

# Make sure the archive contains a reasonable root filename
Expand Down
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,14 @@ seqcli config -k connection.serverUrl -v https://your-seq-server

The API key will be stored in your `SeqCli.json` configuration file; on Windows, this is encrypted using DPAPI; on Mac/Linux the key is currently stored in plain text. As an alternative to storing the API key in configuration, it can be passed to each command via the `--apikey=` argument.

`seqcli` is also available as a Docker container under [`datalust/seqcli`](https://store.docker.com/community/images/datalust/seqcli):

```
docker run --rm datalust/seqcli:latest <command> [<args>]
```

Use Docker networks and volumes to make local files and other containers accessible to `seqcli` within its container.

## Commands

Usage:
Expand Down
20 changes: 20 additions & 0 deletions SeqCli.Runtime.targets
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?xml version="1.0" encoding="utf-8"?>
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<SeqRuntimeTargetsImported>true</SeqRuntimeTargetsImported>
</PropertyGroup>
<PropertyGroup Condition=" '$(SeqCliRid)' == 'win-x64' Or ('$(SeqCliRid)' == '' And '$([MSBuild]::IsOsPlatform(`WINDOWS`))' == 'true')">
<IsWindows>true</IsWindows>
<DefineConstants>$(DefineConstants);WINDOWS</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition=" '$(SeqCliRid)' == 'linux-x64' Or '$(SeqCliRid)' == 'linux-x64' Or ('$(SeqCliRid)' == '' And '$([MSBuild]::IsOsPlatform(`LINUX`))' == 'true')">
<IsLinux>true</IsLinux>
<IsUnix>true</IsUnix>
<DefineConstants>$(DefineConstants);LINUX;UNIX</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition=" '$(SeqCliRid)' == 'osx-x64' Or ('$(SeqCliRid)' == '' And '$([MSBuild]::IsOsPlatform(`OSX`))' == 'true')">
<IsMacOS>true</IsMacOS>
<IsUnix>true</IsUnix>
<DefineConstants>$(DefineConstants);MACOS;UNIX</DefineConstants>
</PropertyGroup>
</Project>
1 change: 1 addition & 0 deletions dockerfiles/seqcli/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
seqcli.tar.gz
25 changes: 25 additions & 0 deletions dockerfiles/seqcli/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# based on: https://github.com/dotnet/dotnet-docker/blob/master/2.0/runtime-deps/jessie/amd64/Dockerfile

FROM ubuntu:18.04

RUN apt-get update \
&& apt-get install -y --no-install-recommends \
ca-certificates \
liblmdb-dev \
libc6 \
libgcc1 \
libgssapi-krb5-2 \
libicu60 \
liblttng-ust0 \
libssl1.0.0 \
libstdc++6 \
zlib1g \
&& rm -rf /var/lib/apt/lists/*

COPY run.sh /run.sh
ADD seqcli.tar.gz /tmp/
RUN mv /tmp/seqcli-* /bin/seqcli

ENTRYPOINT ["/run.sh"]

LABEL Description="Seq" Vendor="Datalust Pty Ltd"
6 changes: 6 additions & 0 deletions dockerfiles/seqcli/run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/bash

# Default arguments to those passed to the container
args=$@

exec /bin/seqcli/seqcli $args
1 change: 1 addition & 0 deletions seqcli.sln
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "sln", "sln", "{2EA56595-519
Build.ps1 = Build.ps1
LICENSE = LICENSE
README.md = README.md
SeqCli.Runtime.targets = SeqCli.Runtime.targets
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "test", "test", "{3587B633-0C03-4235-8903-6226900328F1}"
Expand Down
11 changes: 10 additions & 1 deletion src/SeqCli/Cli/Features/OutputFormatFeature.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@

using System;
using Destructurama;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using Newtonsoft.Json.Linq;
using Seq.Api.Model;
using SeqCli.Config;
Expand Down Expand Up @@ -88,7 +90,14 @@ public void WriteEntity(Entity entity)
{
if (entity == null) throw new ArgumentNullException(nameof(entity));

var jo = JObject.FromObject(entity);
var jo = JObject.FromObject(
entity,
JsonSerializer.CreateDefault(new JsonSerializerSettings {
DateParseHandling = DateParseHandling.None,
Converters = {
new StringEnumConverter()
}
}));

if (_json)
{
Expand Down
8 changes: 7 additions & 1 deletion src/SeqCli/Program.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2018 Datalust Pty Ltd
// Copyright 2018-2019 Datalust Pty Ltd
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -27,6 +27,12 @@ class Program
{
static async Task<int> Main(string[] args)
{
#if WINDOWS
// This reverts to using the WinHTTP stack instead of managed sockets, so that
// Windows proxy settings are respected
AppContext.SetSwitch("System.Net.Http.UseSocketsHttpHandler", false);
#endif

Log.Logger = new LoggerConfiguration()
.MinimumLevel.Error()
.WriteTo.Console(
Expand Down
7 changes: 4 additions & 3 deletions src/SeqCli/SeqCli.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
<Platforms>x64</Platforms>
<LangVersion>7.2</LangVersion>
</PropertyGroup>
<Import Project="..\..\SeqCli.Runtime.targets" />
<ItemGroup>
<Content Include="..\..\asset\SeqCli.ico" Link="SeqCli.ico" />
<Content Include="Attribution\*.txt;..\..\LICENSE">
Expand All @@ -20,8 +21,8 @@
<ItemGroup>
<PackageReference Include="Destructurama.JsonNet" Version="1.2.0" />
<PackageReference Include="newtonsoft.json" Version="10.0.3" />
<PackageReference Include="Serilog" Version="2.6.0" />
<PackageReference Include="serilog.filters.expressions" Version="1.1.0" />
<PackageReference Include="Serilog" Version="2.7.1" />
<PackageReference Include="serilog.filters.expressions" Version="2.0.0" />
<PackageReference Include="Serilog.Formatting.Compact" Version="1.0.0" />
<PackageReference Include="Serilog.Formatting.Compact.Reader" Version="1.0.3" />
<PackageReference Include="Serilog.Sinks.Console" Version="3.0.1" />
Expand All @@ -31,4 +32,4 @@
<PackageReference Include="System.Security.Cryptography.ProtectedData" Version="4.4.0" />
<PackageReference Include="Seq.Api" Version="5.0.0" />
</ItemGroup>
</Project>
</Project>
25 changes: 25 additions & 0 deletions test/SeqCli.EndToEnd/ApiKey/ApiKeyCreateTestCase.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
using System.Threading.Tasks;
using Seq.Api;
using SeqCli.EndToEnd.Support;
using Serilog;
using Xunit;

namespace SeqCli.EndToEnd.ApiKey
{
public class ApiKeyCreateTestCase : ICliTestCase
{
public Task ExecuteAsync(SeqConnection connection, ILogger logger, CliCommandRunner runner)
{
var exit = runner.Exec("apikey create", "-t Test");
Assert.Equal(0, exit);

exit = runner.Exec("apikey list", "-t Test --no-color");
Assert.Equal(0, exit);

var output = runner.LastRunProcess.Output;
Assert.Contains("\"AssignedPermissions\":[\"Ingest\"]", output);

return Task.CompletedTask;
}
}
}
2 changes: 1 addition & 1 deletion test/SeqCli.EndToEnd/Dashboard/RenderTestCase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

namespace SeqCli.EndToEnd.Dashboard
{
public class RenderTestcase : ICliTestCase
public class RenderTestCase : ICliTestCase
{
public Task ExecuteAsync(
SeqConnection connection,
Expand Down
2 changes: 1 addition & 1 deletion test/SeqCli.EndToEnd/Signal/SignalBasicsTestCase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

namespace SeqCli.EndToEnd.Signal
{
public class SignalBasicsTestcase : ICliTestCase
public class SignalBasicsTestCase : ICliTestCase
{
public Task ExecuteAsync(
SeqConnection connection,
Expand Down

0 comments on commit adce8fb

Please sign in to comment.