Skip to content
Draft
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Fix sample
  • Loading branch information
Ulimo committed Apr 21, 2024
commit 2e4d09f9643a9b902d0eeebc17848a0dfb825530
29 changes: 29 additions & 0 deletions samples/PostgresDebezium/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#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:7.0 AS base
WORKDIR /app
EXPOSE 80

FROM mcr.microsoft.com/dotnet/sdk:7.0 AS build
ARG BUILD_CONFIGURATION=Release
WORKDIR /src
COPY ["samples/PostgresDebezium/PostgresDebezium.csproj", "samples/PostgresDebezium/"]
COPY ["src/FlowtideDotNet.AspNetCore/FlowtideDotNet.AspNetCore.csproj", "src/FlowtideDotNet.AspNetCore/"]
COPY ["src/FlowtideDotNet.Core/FlowtideDotNet.Core.csproj", "src/FlowtideDotNet.Core/"]
COPY ["src/FlowtideDotNet.Base/FlowtideDotNet.Base.csproj", "src/FlowtideDotNet.Base/"]
COPY ["src/FlowtideDotNet.Storage/FlowtideDotNet.Storage.csproj", "src/FlowtideDotNet.Storage/"]
COPY ["src/FlowtideDotNet.Substrait/FlowtideDotNet.Substrait.csproj", "src/FlowtideDotNet.Substrait/"]
COPY ["src/FlowtideDotNet.Connector.Kafka/FlowtideDotNet.Connector.Kafka.csproj", "src/FlowtideDotNet.Connector.Kafka/"]
RUN dotnet restore "./samples/PostgresDebezium/./PostgresDebezium.csproj"
COPY . .
WORKDIR "/src/samples/PostgresDebezium"
RUN dotnet build "./PostgresDebezium.csproj" -c $BUILD_CONFIGURATION -o /app/build

FROM build AS publish
ARG BUILD_CONFIGURATION=Release
RUN dotnet publish "./PostgresDebezium.csproj" -c $BUILD_CONFIGURATION -o /app/publish /p:UseAppHost=false

FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
ENTRYPOINT ["dotnet", "PostgresDebezium.dll"]
12 changes: 12 additions & 0 deletions samples/PostgresDebezium/PostgresDebezium.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,23 @@
<TargetFramework>net7.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
<DockerfileContext>..\..</DockerfileContext>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.19.5" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\..\src\FlowtideDotNet.AspNetCore\FlowtideDotNet.AspNetCore.csproj" />
<ProjectReference Include="..\..\src\FlowtideDotNet.Connector.Kafka\FlowtideDotNet.Connector.Kafka.csproj" />
</ItemGroup>

<ItemGroup>
<None Update="query.sql">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>

</Project>
2 changes: 1 addition & 1 deletion samples/PostgresDebezium/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
{
ConsumerConfig = new ConsumerConfig
{
BootstrapServers = "localhost:9093",
BootstrapServers = builder.Configuration.GetValue<string>("bootstrapServers"),
GroupId = "flowtide"
},
KeyDeserializer = new FlowtideDebeziumKeyDeserializer(),
Expand Down
37 changes: 23 additions & 14 deletions samples/PostgresDebezium/Properties/launchSettings.json
Original file line number Diff line number Diff line change
@@ -1,23 +1,14 @@
{
"$schema": "https://json.schemastore.org/launchsettings.json",
"iisSettings": {
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iisExpress": {
"applicationUrl": "http://localhost:63262",
"sslPort": 0
}
},
{
"profiles": {
"http": {
"commandName": "Project",
"dotnetRunMessages": true,
"launchBrowser": true,
"launchUrl": "weatherforecast",
"applicationUrl": "http://localhost:5192",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"dotnetRunMessages": true,
"applicationUrl": "http://localhost:5192"
},
"IIS Express": {
"commandName": "IISExpress",
Expand All @@ -26,6 +17,24 @@
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"Docker": {
"commandName": "Docker",
"launchBrowser": true,
"launchUrl": "{Scheme}://{ServiceHost}:{ServicePort}/weatherforecast",
"environmentVariables": {
"ASPNETCORE_URLS": "http://+:80"
},
"publishAllPorts": true
}
},
"$schema": "https://json.schemastore.org/launchsettings.json",
"iisSettings": {
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iisExpress": {
"applicationUrl": "http://localhost:63262",
"sslPort": 0
}
}
}
}
8 changes: 8 additions & 0 deletions samples/PostgresDebezium/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Postgres Debezium Sample

This sample shows how to setup Flowtide to read data from postgres with debezium.
To run the demo, start the docker compose:

```
docker compose up
```
20 changes: 11 additions & 9 deletions samples/PostgresDebezium/compose.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,15 @@
services:
stream:
depends_on:
connect.configurator:
condition: service_completed_successfully
build:
context: ../../
dockerfile: samples/PostgresDebezium/Dockerfile
environment:
bootstrapServers: "kafka:9092"
ports:
- "8000:80"
zookeeper:
image: quay.io/debezium/zookeeper:2.1
ports:
Expand All @@ -20,15 +31,6 @@
- KAFKA_CFG_INTER_BROKER_LISTENER_NAME=CLIENT
depends_on:
- zookeeper
# kafka:
# image: quay.io/debezium/kafka:2.1
# ports:
# - 9092:9092
# links:
# - zookeeper
# environment:
# - ZOOKEEPER_CONNECT=zookeeper:2181
# - KAFKA_CFG_ADVERTISED_LISTENERS=CLIENT://kafka:9092,EXTERNAL://localhost:9093
postgres:
image: quay.io/debezium/example-postgres:2.1
healthcheck:
Expand Down