From bfe7e0b87fdc71de9f6ef4478b796f25091c50c9 Mon Sep 17 00:00:00 2001 From: Emanuele Curati Date: Wed, 25 Sep 2019 12:00:02 +0200 Subject: [PATCH 01/13] Add .net core 3 support --- .../EventFlowJsonOptionsMvcConfiguration.cs | 16 +++++++++++++++- .../EventFlow.AspNetCore.csproj | 15 ++++++++++++--- .../Extensions/AspNetCoreEventFlowOptions.cs | 10 ++++++++++ Source/EventFlow/EventFlow.csproj | 2 +- 4 files changed, 38 insertions(+), 5 deletions(-) diff --git a/Source/EventFlow.AspNetCore/Configuration/EventFlowJsonOptionsMvcConfiguration.cs b/Source/EventFlow.AspNetCore/Configuration/EventFlowJsonOptionsMvcConfiguration.cs index 208d30579..b14b73a85 100644 --- a/Source/EventFlow.AspNetCore/Configuration/EventFlowJsonOptionsMvcConfiguration.cs +++ b/Source/EventFlow.AspNetCore/Configuration/EventFlowJsonOptionsMvcConfiguration.cs @@ -27,7 +27,13 @@ namespace EventFlow.AspNetCore.Configuration { - public class EventFlowJsonOptionsMvcConfiguration : IConfigureOptions + public class EventFlowJsonOptionsMvcConfiguration : +#if NETSTANDARD2_0 + IConfigureOptions +#endif +#if NETCOREAPP3_0 + IConfigureOptions +#endif { private readonly IJsonOptions _jsonOptions; @@ -36,9 +42,17 @@ public EventFlowJsonOptionsMvcConfiguration(IJsonOptions jsonOptions) _jsonOptions = jsonOptions; } +#if NETSTANDARD2_0 public void Configure(MvcJsonOptions options) { _jsonOptions.Apply(options.SerializerSettings); } +#endif +#if NETCOREAPP3_0 + public void Configure(MvcNewtonsoftJsonOptions options) + { + _jsonOptions.Apply(options.SerializerSettings); + } +#endif } } diff --git a/Source/EventFlow.AspNetCore/EventFlow.AspNetCore.csproj b/Source/EventFlow.AspNetCore/EventFlow.AspNetCore.csproj index 48e6891f4..0e66aed88 100644 --- a/Source/EventFlow.AspNetCore/EventFlow.AspNetCore.csproj +++ b/Source/EventFlow.AspNetCore/EventFlow.AspNetCore.csproj @@ -1,7 +1,7 @@ - + - netstandard2.0 + netstandard2.0;netcoreapp3.0 True True False @@ -21,9 +21,18 @@ UPDATED BY BUILD - + + + + + + + + + + diff --git a/Source/EventFlow.AspNetCore/Extensions/AspNetCoreEventFlowOptions.cs b/Source/EventFlow.AspNetCore/Extensions/AspNetCoreEventFlowOptions.cs index f8a05992a..751e440d9 100644 --- a/Source/EventFlow.AspNetCore/Extensions/AspNetCoreEventFlowOptions.cs +++ b/Source/EventFlow.AspNetCore/Extensions/AspNetCoreEventFlowOptions.cs @@ -93,12 +93,22 @@ public AspNetCoreEventFlowOptions AddDefaultMetadataProviders() return this; } +#if NETSTANDARD2_0 public AspNetCoreEventFlowOptions UseMvcJsonOptions() { _options.RegisterServices(s => s.Register, EventFlowJsonOptionsMvcConfiguration>()); return this; } +#endif +#if NETCOREAPP3_0 + public AspNetCoreEventFlowOptions UseMvcJsonOptions() + { + _options.RegisterServices(s => + s.Register, EventFlowJsonOptionsMvcConfiguration>()); + return this; + } +#endif public AspNetCoreEventFlowOptions UseModelBinding( Action configureModelBinding = null) diff --git a/Source/EventFlow/EventFlow.csproj b/Source/EventFlow/EventFlow.csproj index 4611babe8..aec72b24a 100644 --- a/Source/EventFlow/EventFlow.csproj +++ b/Source/EventFlow/EventFlow.csproj @@ -1,7 +1,7 @@  - net452;netstandard1.6;netstandard2.0 + net452;netstandard1.6;netstandard2.0;netcoreapp3.0 True True False From 11a8cc382ed50a3a85708f746ae171713a0b46e2 Mon Sep 17 00:00:00 2001 From: Emanuele Curati Date: Wed, 25 Sep 2019 12:23:25 +0200 Subject: [PATCH 02/13] Update appveyor image to Visual Studio 2019 (which include .net core 3 sdk) --- appveyor.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/appveyor.yml b/appveyor.yml index a77a15425..2d3416199 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -8,7 +8,7 @@ skip_tags: true build_script: - cmd: powershell -NoProfile -ExecutionPolicy unrestricted -Command ".\up_integration-test-env.ps1; .\build.ps1 --bootstrap; .\build.ps1 -Target All;" -image: Visual Studio 2017 +image: Visual Studio 2019 environment: HELPZ_POSTGRESQL_PASS: Password12! From 5ad08db3fee74df1c16003f69383caace886490c Mon Sep 17 00:00:00 2001 From: Emanuele Curati Date: Thu, 10 Oct 2019 11:27:40 +0200 Subject: [PATCH 03/13] Update sql server version to 2017 for appveyor build --- appveyor.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/appveyor.yml b/appveyor.yml index 07867186b..ab966d50c 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -19,7 +19,7 @@ artifacts: - path: Build\Packages\*nupkg services: - - mssql2014 + - mssql2017 - postgresql101 on_success: From 6b5ccd3b8a6dc3719d378e2501171f4d70fdb6a4 Mon Sep 17 00:00:00 2001 From: Emanuele Curati Date: Thu, 10 Oct 2019 13:01:42 +0200 Subject: [PATCH 04/13] Switch docker to linux containers --- docker-compose.ci.yml | 23 ++++++++++++++--------- up_integration-test-env.ps1 | 6 +++++- 2 files changed, 19 insertions(+), 10 deletions(-) diff --git a/docker-compose.ci.yml b/docker-compose.ci.yml index 5ef7aeaef..c3e0193e9 100644 --- a/docker-compose.ci.yml +++ b/docker-compose.ci.yml @@ -1,19 +1,24 @@ -version: '3' +version: '3.4' services: rabbitmq: - image: idubnori/rabbitmq-windows:3.6.9 + image: rabbitmq:3-management-alpine container_name: rabbitmq-ef + ports: + - "5672:5672" + - "15672:15672" elasticsearch: - image: sixeyed/elasticsearch:5.6.0-nanoserver-sac2016 + image: docker.elastic.co/elasticsearch/elasticsearch:7.3.1 container_name: elasticsearch-ef + environment: + - discovery.type=single-node + ports: + - "9200:9200" eventstore: - image: idubnori/eventstore:4.1.1-hotfix1-windowsservercore + image: eventstore/eventstore container_name: eventstore-ef - -networks: - default: - external: - name: nat \ No newline at end of file + ports: + - "1113:1113" + - "2113:2113" \ No newline at end of file diff --git a/up_integration-test-env.ps1 b/up_integration-test-env.ps1 index f2bb2bebf..523139134 100644 --- a/up_integration-test-env.ps1 +++ b/up_integration-test-env.ps1 @@ -5,8 +5,12 @@ Function Get-Container-Ip($containername) } # end functions +# Switch to linux containers +[Environment]::SetEnvironmentVariable("LCOW_SUPPORTED", "1", "Machine") +Restart-Service docker + # Up containers -docker-compose -f docker-compose.ci.yml pull --parallel +docker-compose -f docker-compose.ci.yml pull docker-compose -f docker-compose.ci.yml up -d # Install curl From c9569a8e52d1e07a83800964cc736cfa8e5bb161 Mon Sep 17 00:00:00 2001 From: Emanuele Curati Date: Thu, 10 Oct 2019 14:34:51 +0200 Subject: [PATCH 05/13] Services reachable with localhost --- up_integration-test-env.ps1 | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/up_integration-test-env.ps1 b/up_integration-test-env.ps1 index 523139134..53084a627 100644 --- a/up_integration-test-env.ps1 +++ b/up_integration-test-env.ps1 @@ -1,10 +1,3 @@ -# functions -Function Get-Container-Ip($containername) -{ - docker inspect -f "{{ .NetworkSettings.Networks.nat.IPAddress }}" $containername -} -# end functions - # Switch to linux containers [Environment]::SetEnvironmentVariable("LCOW_SUPPORTED", "1", "Machine") Restart-Service docker @@ -20,13 +13,13 @@ sal curl (Join-Path $env:ChocolateyInstall "bin\curl.exe") -O AllScope # Set connection url to environment variable # RabbitMQ $rabbitmq_ip = Get-Container-Ip rabbitmq-ef -$env:RABBITMQ_URL = "amqp://guest:guest@${rabbitmq_ip}:5672" +$env:RABBITMQ_URL = "amqp://guest:guest@$localhost:5672" # Elasticsearch $elasticsearch_ip = Get-Container-Ip elasticsearch-ef -$env:ELASTICSEARCH_URL = "http://${elasticsearch_ip}:9200" +$env:ELASTICSEARCH_URL = "http://localhost:9200" # Event Store $eventstore_ip = Get-Container-Ip eventstore-ef -$env:EVENTSTORE_URL = "tcp://admin:changeit@${eventstore_ip}:1113" +$env:EVENTSTORE_URL = "tcp://admin:changeit@$localhost:1113" # Helth check # Event Store From f0d462f12188247fcbaedbecd9fa45e7660d0a5c Mon Sep 17 00:00:00 2001 From: Emanuele Curati Date: Thu, 10 Oct 2019 15:16:59 +0200 Subject: [PATCH 06/13] Fix typo --- up_integration-test-env.ps1 | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/up_integration-test-env.ps1 b/up_integration-test-env.ps1 index 53084a627..492e9f397 100644 --- a/up_integration-test-env.ps1 +++ b/up_integration-test-env.ps1 @@ -12,19 +12,16 @@ sal curl (Join-Path $env:ChocolateyInstall "bin\curl.exe") -O AllScope # Set connection url to environment variable # RabbitMQ -$rabbitmq_ip = Get-Container-Ip rabbitmq-ef $env:RABBITMQ_URL = "amqp://guest:guest@$localhost:5672" # Elasticsearch -$elasticsearch_ip = Get-Container-Ip elasticsearch-ef $env:ELASTICSEARCH_URL = "http://localhost:9200" # Event Store -$eventstore_ip = Get-Container-Ip eventstore-ef $env:EVENTSTORE_URL = "tcp://admin:changeit@$localhost:1113" # Helth check # Event Store -curl --connect-timeout 60 --retry 5 -sL "http://${eventstore_ip}:2113" +curl --connect-timeout 60 --retry 5 -sL "http://localhost:2113" # Elasticsearch -curl --connect-timeout 60 --retry 5 -sL "http://${elasticsearch_ip}:9200" +curl --connect-timeout 60 --retry 5 -sL "http://localhost:9200" # RabbitMQ -curl --connect-timeout 60 --retry 5 -sL "http://${rabbitmq_ip}:15672" \ No newline at end of file +curl --connect-timeout 60 --retry 5 -sL "http://localhost:15672" \ No newline at end of file From b5ec6b1107737801f2ece949d4aff5bcc44a0837 Mon Sep 17 00:00:00 2001 From: Emanuele Curati Date: Thu, 10 Oct 2019 15:19:33 +0200 Subject: [PATCH 07/13] Add sql server 2017 connection params in appveyor.yml --- appveyor.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/appveyor.yml b/appveyor.yml index ab966d50c..2265dbb2c 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -12,6 +12,9 @@ image: Visual Studio 2019 environment: HELPZ_POSTGRESQL_PASS: Password12! + HELPZ_MSSQL_SERVER: (local)\SQL2017 + HELPZ_MSSQL_USER: sa + HELPZ_MSSQL_PASS: Password12! test: off From 4f09fa8115cc4c8b69bc454727336af2eebdcf5a Mon Sep 17 00:00:00 2001 From: Emanuele Curati Date: Thu, 10 Oct 2019 16:02:19 +0200 Subject: [PATCH 08/13] Move sql server to docker --- appveyor.yml | 3 +-- docker-compose.ci.yml | 11 ++++++++++- up_integration-test-env.ps1 | 4 ++-- 3 files changed, 13 insertions(+), 5 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index 2265dbb2c..a2db6db4b 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -12,7 +12,7 @@ image: Visual Studio 2019 environment: HELPZ_POSTGRESQL_PASS: Password12! - HELPZ_MSSQL_SERVER: (local)\SQL2017 + HELPZ_MSSQL_SERVER: localhost HELPZ_MSSQL_USER: sa HELPZ_MSSQL_PASS: Password12! @@ -22,7 +22,6 @@ artifacts: - path: Build\Packages\*nupkg services: - - mssql2017 - postgresql101 on_success: diff --git a/docker-compose.ci.yml b/docker-compose.ci.yml index c3e0193e9..c64a7a6c5 100644 --- a/docker-compose.ci.yml +++ b/docker-compose.ci.yml @@ -21,4 +21,13 @@ services: container_name: eventstore-ef ports: - "1113:1113" - - "2113:2113" \ No newline at end of file + - "2113:2113" + + sqlserver: + image: mcr.microsoft.com/mssql/server:2017-latest + container_name: sqlserver-ef + environment: + - SA_PASSWORD=Password12! + - ACCEPT_EULA=Y + ports: + - "1433:1433" \ No newline at end of file diff --git a/up_integration-test-env.ps1 b/up_integration-test-env.ps1 index 492e9f397..08fcbf569 100644 --- a/up_integration-test-env.ps1 +++ b/up_integration-test-env.ps1 @@ -12,11 +12,11 @@ sal curl (Join-Path $env:ChocolateyInstall "bin\curl.exe") -O AllScope # Set connection url to environment variable # RabbitMQ -$env:RABBITMQ_URL = "amqp://guest:guest@$localhost:5672" +$env:RABBITMQ_URL = "amqp://guest:guest@localhost:5672" # Elasticsearch $env:ELASTICSEARCH_URL = "http://localhost:9200" # Event Store -$env:EVENTSTORE_URL = "tcp://admin:changeit@$localhost:1113" +$env:EVENTSTORE_URL = "tcp://admin:changeit@localhost:1113" # Helth check # Event Store From fd20a6d1c7cb4cbd98d674435729f1501652a62d Mon Sep 17 00:00:00 2001 From: Emanuele Curati Date: Thu, 10 Oct 2019 17:11:03 +0200 Subject: [PATCH 09/13] Open elastic search port 9300 --- docker-compose.ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/docker-compose.ci.yml b/docker-compose.ci.yml index c64a7a6c5..a4cc5b319 100644 --- a/docker-compose.ci.yml +++ b/docker-compose.ci.yml @@ -15,6 +15,7 @@ services: - discovery.type=single-node ports: - "9200:9200" + - "9300:9300" eventstore: image: eventstore/eventstore From 0363d6738cdef96bb2cd5cc7cafafbce21f2bee9 Mon Sep 17 00:00:00 2001 From: Emanuele Curati Date: Fri, 11 Oct 2019 11:08:08 +0200 Subject: [PATCH 10/13] Fix appveyor ci build --- appveyor.yml | 10 +++++++--- docker-compose.ci.yml | 15 ++++----------- up_integration-test-env.ps1 | 8 ++------ 3 files changed, 13 insertions(+), 20 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index a2db6db4b..c8990aa45 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -1,6 +1,9 @@ init: - - git config --global core.autocrlf input - + - ps: iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1')) + - ps: git config --global core.autocrlf input + - ps: '[Environment]::SetEnvironmentVariable("LCOW_SUPPORTED", "1", "Machine")' + - ps: Restart-Service docker + version: 0.76.{build} skip_tags: true @@ -12,7 +15,7 @@ image: Visual Studio 2019 environment: HELPZ_POSTGRESQL_PASS: Password12! - HELPZ_MSSQL_SERVER: localhost + HELPZ_MSSQL_SERVER: (local)\SQL2017 HELPZ_MSSQL_USER: sa HELPZ_MSSQL_PASS: Password12! @@ -23,6 +26,7 @@ artifacts: services: - postgresql101 + - mssql2017 on_success: - choco install codecov diff --git a/docker-compose.ci.yml b/docker-compose.ci.yml index a4cc5b319..bf5bec57c 100644 --- a/docker-compose.ci.yml +++ b/docker-compose.ci.yml @@ -1,4 +1,4 @@ -version: '3.4' +version: '2.4' services: rabbitmq: @@ -9,13 +9,15 @@ services: - "15672:15672" elasticsearch: - image: docker.elastic.co/elasticsearch/elasticsearch:7.3.1 + image: docker.elastic.co/elasticsearch/elasticsearch:5.6.16 container_name: elasticsearch-ef environment: - discovery.type=single-node + - ES_JAVA_OPTS=-Xms1g -Xmx1g ports: - "9200:9200" - "9300:9300" + mem_limit: 4g eventstore: image: eventstore/eventstore @@ -23,12 +25,3 @@ services: ports: - "1113:1113" - "2113:2113" - - sqlserver: - image: mcr.microsoft.com/mssql/server:2017-latest - container_name: sqlserver-ef - environment: - - SA_PASSWORD=Password12! - - ACCEPT_EULA=Y - ports: - - "1433:1433" \ No newline at end of file diff --git a/up_integration-test-env.ps1 b/up_integration-test-env.ps1 index 08fcbf569..05fc9ba30 100644 --- a/up_integration-test-env.ps1 +++ b/up_integration-test-env.ps1 @@ -1,10 +1,6 @@ -# Switch to linux containers -[Environment]::SetEnvironmentVariable("LCOW_SUPPORTED", "1", "Machine") -Restart-Service docker - # Up containers -docker-compose -f docker-compose.ci.yml pull -docker-compose -f docker-compose.ci.yml up -d +docker-compose --compatibility -f docker-compose.ci.yml pull +docker-compose --compatibility -f docker-compose.ci.yml up -d # Install curl cinst curl -y --no-progress From cb5aa715db7d14b5a4175acd596529957b161c76 Mon Sep 17 00:00:00 2001 From: Emanuele Curati Date: Fri, 11 Oct 2019 11:09:48 +0200 Subject: [PATCH 11/13] Remove appveyor rdp debug --- appveyor.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/appveyor.yml b/appveyor.yml index c8990aa45..1211597d2 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -1,5 +1,4 @@ init: - - ps: iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1')) - ps: git config --global core.autocrlf input - ps: '[Environment]::SetEnvironmentVariable("LCOW_SUPPORTED", "1", "Machine")' - ps: Restart-Service docker From daabbe865b6d0de6cb541606f6c59fa610c5ce35 Mon Sep 17 00:00:00 2001 From: Emanuele Curati Date: Fri, 11 Oct 2019 11:21:58 +0200 Subject: [PATCH 12/13] Fix elasticsearch container version --- docker-compose.ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker-compose.ci.yml b/docker-compose.ci.yml index bf5bec57c..ff6bb87bd 100644 --- a/docker-compose.ci.yml +++ b/docker-compose.ci.yml @@ -9,7 +9,7 @@ services: - "15672:15672" elasticsearch: - image: docker.elastic.co/elasticsearch/elasticsearch:5.6.16 + image: docker.elastic.co/elasticsearch/elasticsearch:6.8.3 container_name: elasticsearch-ef environment: - discovery.type=single-node From 256395f3fabb34e844234c7a2bb98c86a77e0d0b Mon Sep 17 00:00:00 2001 From: Emanuele Curati Date: Fri, 11 Oct 2019 12:26:03 +0200 Subject: [PATCH 13/13] Fix/appveyor build (#1)