Skip to content
This repository was archived by the owner on Sep 3, 2024. It is now read-only.

Various Improvements #90

Merged
merged 9 commits into from
Aug 23, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 15 additions & 10 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,36 +12,41 @@ jobs:
fail-fast: false
matrix:
env:
- library-version: 1.2.0-beta.4
- library-version: 1.2.0-beta.5
container-runtime-version: 2.2.5
container-runtime: alpine3.9
runtime: alpine-x64
- library-version: 1.2.0-beta.4
- library-version: 1.2.0-beta.5
container-runtime-version: 2.2.5
container-runtime: alpine3.8
runtime: alpine-x64
- library-version: 1.2.0-beta.4
- library-version: 1.2.0-beta.5
container-runtime-version: 2.2.5
container-runtime: stretch-slim
runtime: debian.9-x64
- library-version: 1.2.0-beta.4
- library-version: 1.2.0-beta.5
container-runtime-version: 2.2.5
container-runtime: bionic
runtime: ubuntu.18.04-x64
runs-on: ubuntu-latest
name: continuous-integration/github/${{ matrix.env.container-runtime }}
steps:
- name: filter
if: github.event_name == 'pull_request'
uses: actions/bin/filter@master
with:
action: "opened|synchronize|reopened"
- name: checkout
uses: actions/checkout@master
- name: build
run: "./build.sh"
env:
REMOTE_IMAGE: sqlstreamstore/server
LIBRARY_VERSION: ${{ matrix.env.library-version }}
CONTAINER_RUNTIME_VERSION: ${{ matrix.env.container-runtime-version }}
CONTAINER_RUNTIME: ${{ matrix.env.container-runtime }}
RUNTIME: ${{ matrix.env.runtime }}
RUNTIME: ${{ matrix.env.runtime }}
- name: Docker Login
uses: actions/docker/login@master
if: github.event_name == 'push'
env:
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
- name: Docker Push
if: github.event_name == 'push'
run: docker push sqlstreamstore/server
8 changes: 4 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ env:
- secure: fKxyki9JzY95G17hNHSy4dgDmH+zXIk50BR6honAz7LmsA9jGv2gg+l1AIUERH3eckdJwxze4K0e5hX88Xfn4j5nN8TnEw7Wwn7c1vjR9FxvRr5cjaJC0SVsOTZj4VC1R9Sqjzrkqv3jJDtDdz9B8aZMdEzJ+BkHwUMFxmuko2p2qabKnAonaGk5VDSTtDyvDMa0aFjKDYuB6MrnrxhfCzLk1ciyGL61SNfz0/u7Hj3xC6v4U0f0BQ9n65l5dIVn+mpuCdQ7GO0HGj0ySo7ffif3qqXXTx7ZWIl3wvf5RCp0PouA8q2dRHYYyGqhhCwuRNU7dfhS/eFtUtcITclZ/DJE86NBQGJ9tpUUhL7BJ3sNJZzbajh1F28paJgi595SKpScp4VGx3iBuDSKH4eb3cRj5TJqCUoscue8/uIZGgR4PGkGF4lbad3b7xexIk1YY/2Rwun1J0N7tqS0rej3ZRZBtipMF64NrVnt9dZzgsIlssZ0W2NvG0vcLX6DUdeZaR0diz8bUl1DXrMFxAUQ/QYxilvaESmCslRElzlb+5eaqQTG5lSP5l6f3ZcKAhvcUGggu9t3vjzpEq3zFa5dorCyK+es1ASNlwZtZr8in9oYkvam9aiDkZD8cEc+9u+qxvnX9w3MsA0P047YCMQGgwRl5dpizoySC3wr52voK7I=
- secure: HvSSWjsLR6qFi9/iHMKKoVUT4BDN7h4QjKHLvcrznwpfojrA1+nIlIwgcaIkxi5WClsoPmwW8YInPlyIyV+37+SaNK4sxB2puzwaC3iHBi6Ql38q+olsLdCE8u+DcfEcnzQo8pinNoyBLRjBgHjTAbrwIkLETNOZchss4A4UVhvPSznuNz5imlZxp4LqZ2pW/YcaLeCMQzuJHt5iRM6O4CMu7O4kMP/SPQXIXcqqYWI+o4um1JFO5juXBXtrhcTkOHfvGjqZghwma1F3v7zLHtqrbGBxaTLGNj0EIWPQhQEE5wDpvAqLEZcySl0ZjsPQUJd2Uxi9b8mWM1x6WaZTu9uqIy5t9lkCwUkEAwc/LUXZxwL0oi8HncgJvu7Q5KwVn375sJ0CER0Vn1FO8jphnMbpfkqUmbZmkwoIAUENNNYyGEp6zoNnRvaFQTjEW4bL2huPS0g3BgC2xyh8d5ZsPykIgQXlM8EEA2BZkd+ep2rKjOPT94rs5V5IPuVi9FYzFIsc2kpEkKZO/38j6pEAdCVIZp1m0+KRlLNQ9FeaI+xtil95V5ALIEXpc44o5OuUSoxt5ZirYaGSJtUtxo8E+HqpNL5WrTUeE8+aZos6Tu7jF63U2ehwg5xR6EubvrBjWvSHsQKcwDfdeHK2m15S/mVlahpwyyoCASAJtV7mRJI=
matrix:
- LIBRARY_VERSION=1.2.0-beta.4 CONTAINER_RUNTIME_VERSION=2.2.5 CONTAINER_RUNTIME=alpine3.9 RUNTIME=alpine-x64
- LIBRARY_VERSION=1.2.0-beta.4 CONTAINER_RUNTIME_VERSION=2.2.5 CONTAINER_RUNTIME=alpine3.8 RUNTIME=alpine-x64
- LIBRARY_VERSION=1.2.0-beta.4 CONTAINER_RUNTIME_VERSION=2.2.5 CONTAINER_RUNTIME=bionic RUNTIME=ubuntu.18.04-x64
- LIBRARY_VERSION=1.2.0-beta.4 CONTAINER_RUNTIME_VERSION=2.2.5 CONTAINER_RUNTIME=stretch-slim RUNTIME=debian.9-x64
- LIBRARY_VERSION=1.2.0-beta.5 CONTAINER_RUNTIME_VERSION=2.2.5 CONTAINER_RUNTIME=alpine3.9 RUNTIME=alpine-x64
- LIBRARY_VERSION=1.2.0-beta.5 CONTAINER_RUNTIME_VERSION=2.2.5 CONTAINER_RUNTIME=alpine3.8 RUNTIME=alpine-x64
- LIBRARY_VERSION=1.2.0-beta.5 CONTAINER_RUNTIME_VERSION=2.2.5 CONTAINER_RUNTIME=bionic RUNTIME=ubuntu.18.04-x64
- LIBRARY_VERSION=1.2.0-beta.5 CONTAINER_RUNTIME_VERSION=2.2.5 CONTAINER_RUNTIME=stretch-slim RUNTIME=debian.9-x64
git:
depth: false
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
ARG CONTAINER_RUNTIME_VERSION=2.2.5
ARG CONTAINER_RUNTIME_VERSION=2.2.6
ARG CONTAINER_RUNTIME=alpine3.9

FROM node:10.12.0-alpine AS build-javascript
Expand All @@ -20,7 +20,7 @@ RUN yarn && \
yarn react-scripts-ts build && \
echo ${CLIENT_VERSION} > /app/.clientversion

FROM mcr.microsoft.com/dotnet/core/sdk:2.2.300-stretch AS build-dotnet
FROM mcr.microsoft.com/dotnet/core/sdk:2.2.401-stretch AS build-dotnet
ARG CLIENT_PACKAGE=@sqlstreamstore/browser
ARG RUNTIME=alpine-x64
ARG LIBRARY_VERSION=1.2.0
Expand Down
4 changes: 1 addition & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
# SQL Stream Store HTTP Server [![Build Status](https://travis-ci.org/SQLStreamStore/SQLStreamStore.HAL.svg?branch=master)](https://travis-ci.org/SQLStreamStore/SQLStreamStore.HAL)
# SQL Stream Store HTTP Server [![Build Status](https://github.com/SQLStreamStore/SQLStreamStore.Docker/workflows/Build/badge.svg)](https://github.com/SQLStreamStore/SQLStreamStore.Docker/actions?workflowID=Build)

Fully RESTful HTTP Server for [SQL Stream Store](https://github.com/SQLStreamStore/SQLStreamStore). Uses [application/hal+json](https://tools.ietf.org/html/draft-kelly-json-hal-08) for resource navigation, with [JSON Hyper-Schema](https://json-schema.org/latest/json-schema-hypermedia.html) as [embedded resources](https://tools.ietf.org/html/draft-kelly-json-hal-08#section-4.1.2).

The solution includes example of use LittleHalHost.Example project. The url structure and parameters are described in LittleHalHost.Example/readme.md

# Development

- `./build.sh` or `./build.cmd` to run the complete dockerized build.
Expand Down
11 changes: 2 additions & 9 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
set -e

CONTAINER_RUNTIME=${CONTAINER_RUNTIME:-alpine3.9}
LIBRARY_VERSION=${LIBRARY_VERSION:-1.2.0-beta.3.28}
LIBRARY_VERSION=${LIBRARY_VERSION:-1.2.0-beta.5.5}
CLIENT_VERSION=${CLIENT_VERSION:-0.9.3}

LOCAL_IMAGE="sql-stream-store-server"
Expand All @@ -12,16 +12,14 @@ LOCAL="${LOCAL_IMAGE}:latest"
REMOTE_IMAGE="sqlstreamstore/server"

docker build \
--build-arg MYGET_API_KEY=$MYGET_API_KEY \
--build-arg CONTAINER_RUNTIME_VERSION=${CONTAINER_RUNTIME_VERSION:-2.2.5} \
--build-arg CONTAINER_RUNTIME_VERSION=${CONTAINER_RUNTIME_VERSION:-2.2.6} \
--build-arg CONTAINER_RUNTIME=${CONTAINER_RUNTIME} \
--build-arg RUNTIME=${RUNTIME:-alpine-x64} \
--build-arg LIBRARY_VERSION=${LIBRARY_VERSION} \
--build-arg CLIENT_VERSION=${CLIENT_VERSION} \
--tag ${LOCAL} \
.


SEMVER_REGEX="^(0|[1-9][0-9]*)\\.(0|[1-9][0-9]*)\\.(0|[1-9][0-9]*)(\\-[0-9A-Za-z-]+(\\.[0-9A-Za-z-]+)*)?(\\+[0-9A-Za-z-]+(\\.[0-9A-Za-z-]+)*)?$"

[[ $LIBRARY_VERSION =~ $SEMVER_REGEX ]]
Expand All @@ -39,9 +37,4 @@ else
docker tag $LOCAL $MAJOR_MINOR_PATCH_PRE
fi

if [[ -n $DOCKER_USER ]]; then
echo "${DOCKER_PASS}" | docker login --username "${DOCKER_USER}" --password-stdin
docker push $REMOTE_IMAGE
fi

docker images --filter=reference="${REMOTE_IMAGE}"
23 changes: 20 additions & 3 deletions src/SqlStreamStore.Server/HealthProbeMiddleware.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,11 @@ internal static class HealthProbeMiddleware
{
public static IApplicationBuilder UseHealthProbe(
this IApplicationBuilder builder, IReadonlyStreamStore streamStore)
=> builder.UseRouter(router => router
.MapMiddlewareGet("ready", inner => inner.Use(Ready(streamStore)))
.MapMiddlewareGet("live", inner => inner.Use(Live)));
=> builder
.Use(GetAndHeadOnly)
.UseRouter(router => router
.MapMiddlewareGet("ready", inner => inner.Use(Ready(streamStore)))
.MapMiddlewareGet("live", inner => inner.Use(Live)));

private static MidFunc Live => (context, next) =>
{
Expand All @@ -37,5 +39,20 @@ private static MidFunc Ready(IReadonlyStreamStore streamStore) => async (context

context.Response.StatusCode = 204;
};

private static MidFunc GetAndHeadOnly => (context, next) =>
{
switch (context.Request.Method)
{
case "HEAD":
context.Request.Method = "GET";
return next();
case "GET":
return next();
default:
context.Response.StatusCode = 405;
return Task.CompletedTask;
}
};
}
}
2 changes: 1 addition & 1 deletion src/SqlStreamStore.Server/SqlStreamStore.Server.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<TargetLatestRuntimePatch>true</TargetLatestRuntimePatch>
<LangVersion>latest</LangVersion>
<CrossGenDuringPublish>false</CrossGenDuringPublish>
<LibraryVersion Condition="$(LibraryVersion) == ''">1.2.0-beta.3.28</LibraryVersion>
<LibraryVersion Condition="$(LibraryVersion) == ''">1.2.0-beta.5.5</LibraryVersion>
<StartupObject></StartupObject>
</PropertyGroup>
<ItemGroup>
Expand Down