From c26b9fd5b8b009d474e78d9ebce3006dff2b53d2 Mon Sep 17 00:00:00 2001 From: Henrik Feldt Date: Fri, 22 Feb 2019 16:42:23 +0100 Subject: [PATCH 1/4] Correct ZMQ installation in Debian-based Dockerfile for Rutta http://zeromq.org/distro:debian --- Dockerfile | 2 +- RELEASE_NOTES.md | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 8520ffa63..7d34d9d7f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -8,7 +8,7 @@ RUN DEBIAN_FRONTEND=noninteractive apt-get update && \ DEBIAN_FRONTEND=noninteractive apt-get install -y locales && \ locale-gen C C.UTF-8 && \ DEBIAN_FRONTEND=noninteractive dpkg-reconfigure locales && \ - DEBIAN_FRONTEND=noninteractive apt-get install -y git vim libczmq4 libprotobuf-c-dev libprotobuf-dev libprotobuf10 ca-certificates + DEBIAN_FRONTEND=noninteractive apt-get install -y git vim libzmq3-dev libczmq4 libprotobuf-c-dev libprotobuf-dev libprotobuf10 ca-certificates ENV LC_ALL=C.UTF-8 diff --git a/RELEASE_NOTES.md b/RELEASE_NOTES.md index 8d745430f..22422ae77 100644 --- a/RELEASE_NOTES.md +++ b/RELEASE_NOTES.md @@ -1,3 +1,6 @@ +#### 5.0.0-rc.3 +* Correct ZMQ installation in Debian-based Dockerfile for Rutta, thanks @haf + #### 5.0.0-rc.2 * Enable project id discoverability with google metadata server in Stackdriver, thanks @haf * Create a new Google BigQuery target, thanks @haf From e31fed14476ce21cdef2c2eb20536f8580df4b32 Mon Sep 17 00:00:00 2001 From: Henrik Feldt Date: Fri, 22 Feb 2019 17:03:48 +0100 Subject: [PATCH 2/4] Run `ldconfig` after libzmq installation --- Dockerfile | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 7d34d9d7f..60ac5e085 100644 --- a/Dockerfile +++ b/Dockerfile @@ -8,7 +8,8 @@ RUN DEBIAN_FRONTEND=noninteractive apt-get update && \ DEBIAN_FRONTEND=noninteractive apt-get install -y locales && \ locale-gen C C.UTF-8 && \ DEBIAN_FRONTEND=noninteractive dpkg-reconfigure locales && \ - DEBIAN_FRONTEND=noninteractive apt-get install -y git vim libzmq3-dev libczmq4 libprotobuf-c-dev libprotobuf-dev libprotobuf10 ca-certificates + DEBIAN_FRONTEND=noninteractive apt-get install -y git vim libzmq3-dev libczmq4 libprotobuf-c-dev libprotobuf-dev libprotobuf10 ca-certificates && \ + ldconfig ENV LC_ALL=C.UTF-8 @@ -38,7 +39,8 @@ RUN DEBIAN_FRONTEND=noninteractive apt-get update && \ DEBIAN_FRONTEND=noninteractive apt-get install -y locales && \ locale-gen C C.UTF-8 && \ DEBIAN_FRONTEND=noninteractive dpkg-reconfigure locales && \ - DEBIAN_FRONTEND=noninteractive apt-get install -y libczmq4 libprotobuf-c-dev libprotobuf10 ca-certificates + DEBIAN_FRONTEND=noninteractive apt-get install -y libczmq4 libprotobuf-c-dev libprotobuf10 ca-certificates && \ + ldconfig WORKDIR /logary/ COPY --from=build /build/src/services/Logary.Services.Rutta/bin/Release/netcoreapp2.2/linux-x64/publish/* /logary/ From 6e5e41c737e419267272eb7fc80947a2532ea85f Mon Sep 17 00:00:00 2001 From: Henrik Feldt Date: Mon, 4 Mar 2019 17:16:02 +0100 Subject: [PATCH 3/4] Factor out withOrigin from CORS logic in Rutta. Fixes #397 --- src/ingestion/Logary.Ingestion.HTTP/HTTP.fs | 29 ++++++++++++++------- 1 file changed, 19 insertions(+), 10 deletions(-) diff --git a/src/ingestion/Logary.Ingestion.HTTP/HTTP.fs b/src/ingestion/Logary.Ingestion.HTTP/HTTP.fs index 73ee77a32..4e3afa731 100644 --- a/src/ingestion/Logary.Ingestion.HTTP/HTTP.fs +++ b/src/ingestion/Logary.Ingestion.HTTP/HTTP.fs @@ -130,13 +130,16 @@ module HTTP = open System open Impl open Logary.Adapters.Facade - + + let withOrigin config next = + warbler (fun ctx -> + let o = ctx.request.header "origin" |> Choice.orDefault (fun () -> "http://localhost") + let ao = config.accessControlAllowOrigin o + next ao) + let CORS (config: HTTPConfig) = if config.allowCORS then warbler (fun ctx -> - let o = ctx.request.header "origin" |> Choice.orDefault (fun () -> "http://localhost") - let ao = - config.accessControlAllowOrigin o let h = ctx.request.header "access-control-request-headers" |> Choice.map (fun h -> h.Split([|','|], StringSplitOptions.RemoveEmptyEntries) |> List.ofArray) @@ -154,7 +157,7 @@ module HTTP = |> String.concat ", " let aa = string config.accessControlMaxAge.TotalSeconds - ao.asWebPart + withOrigin config (fun ao -> ao.asWebPart) >=> setHeader "Access-Control-Allow-Methods" am >=> setHeader "Access-Control-Allow-Headers" ah >=> setHeader "Access-Control-Max-Age" aa) @@ -162,14 +165,20 @@ module HTTP = >=> OK "" else never - + let api (config: HTTPConfig) next: WebPart = setMimeType "application/json; charset=utf-8" >=> choose [ GET >=> path config.rootPath >=> printHelp config - OPTIONS >=> CORS config - POST >=> path config.rootPath >=> Impl.ingestWith (config.onSuccess, config.onError) next + + OPTIONS + >=> CORS config + + POST + >=> path config.rootPath + >=> withOrigin config (fun ao -> ao.asWebPart) + >=> Impl.ingestWith (config.onSuccess, config.onError) next ] - + let recv (started: IVar, shutdown: IVar) config next = job { //LogaryFacadeAdapter.initialise config.logary @@ -189,4 +198,4 @@ module HTTP = } let create: ServerFactory = - IngestServer.create recv \ No newline at end of file + IngestServer.create recv From e22829e69984f6fba09c5028636798422ff36ea3 Mon Sep 17 00:00:00 2001 From: Henrik Feldt Date: Mon, 4 Mar 2019 17:18:29 +0100 Subject: [PATCH 4/4] Update RELEASE_NOTES --- RELEASE_NOTES.md | 1 + 1 file changed, 1 insertion(+) diff --git a/RELEASE_NOTES.md b/RELEASE_NOTES.md index 22422ae77..cc2fa5b17 100644 --- a/RELEASE_NOTES.md +++ b/RELEASE_NOTES.md @@ -1,5 +1,6 @@ #### 5.0.0-rc.3 * Correct ZMQ installation in Debian-based Dockerfile for Rutta, thanks @haf +* Correct response headers for CORS POST requests for /i/logary, thanks @haf #### 5.0.0-rc.2 * Enable project id discoverability with google metadata server in Stackdriver, thanks @haf