Skip to content

Commit bfa4398

Browse files
committed
feat(samples): docker compose demo with the Bank service and a Studio demo console
- Bank.Api: ASP.NET Core host for the Accounts, Transfers and Notifications modules on PostgreSQL (auto-migrated), with the command endpoints (MapCommand) and opt-in, sample-only query endpoints (POST /query, /query/validate, GET /query/schema) over IQueryService. - SourceFlow.Studio.Demo: interim console (not the doc-15 workflow designer) served with a same-origin, allow-listed proxy to the service: schema browser, SFQL/SQL query console with paging and diagnostics, Bank commands with read-your-writes follow-up queries, demo data seeding and an activity log. Text-only rendering and a strict CSP. - Multi-stage Dockerfiles (SDK on the build platform), .dockerignore, docker-compose.yml (PostgreSQL 17, service, console) and the v3-images workflow publishing linux/amd64 and linux/arm64 images to ghcr.io (branch, short SHA and v3-latest tags). - samples/README.md describes the demo.
1 parent a5531c8 commit bfa4398

17 files changed

Lines changed: 1550 additions & 27 deletions

File tree

‎.dockerignore‎

Lines changed: 15 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,18 @@
1-
**/.classpath
2-
**/.dockerignore
3-
**/.env
4-
**/.git
5-
**/.gitignore
6-
**/.project
7-
**/.settings
8-
**/.toolstarget
1+
# Build context for the demo images (samples/**/Dockerfile). Keep it small: sources and build props only.
2+
**/bin
3+
**/obj
94
**/.vs
105
**/.vscode
11-
**/*.*proj.user
12-
**/*.dbmdl
13-
**/*.jfm
14-
**/azds.yaml
15-
**/bin
16-
**/charts
17-
**/docker-compose*
18-
**/Dockerfile*
6+
**/*.user
197
**/node_modules
20-
**/npm-debug.log
21-
**/obj
22-
**/secrets.dev.yaml
23-
**/values.dev.yaml
24-
LICENSE
25-
README.md
26-
!**/.gitignore
27-
!.git/HEAD
28-
!.git/config
29-
!.git/packed-refs
30-
!.git/refs/heads/**
8+
.git
9+
.github
10+
BenchmarkDotNet.Artifacts
11+
TestResults
12+
Images
13+
docs
14+
tests
15+
benchmarks
16+
tools
17+
**/Dockerfile*
18+
**/docker-compose*

‎.github/workflows/v3-images.yml‎

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
# Demo images (Bank sample service and Studio demo console) on GitHub Container Registry.
2+
# Tags: the branch name, the short commit SHA and v3-latest (the tag docker-compose.yml pulls by default).
3+
name: v3-images
4+
5+
on:
6+
push:
7+
branches: [ "v3.0.0", "v3/**" ]
8+
paths:
9+
- "src/Core/**"
10+
- "src/Hosting/**"
11+
- "src/Storage/SourceFlow.Storage.PostgreSQL/**"
12+
- "samples/**"
13+
- "Directory.Build.props"
14+
- "Directory.Build.targets"
15+
- "Directory.Packages.props"
16+
- "global.json"
17+
- ".dockerignore"
18+
- ".github/workflows/v3-images.yml"
19+
workflow_dispatch:
20+
21+
permissions:
22+
contents: read
23+
packages: write
24+
25+
concurrency:
26+
group: v3-images-${{ github.ref }}
27+
cancel-in-progress: true
28+
29+
jobs:
30+
image:
31+
name: ${{ matrix.image }}
32+
runs-on: ubuntu-latest
33+
strategy:
34+
fail-fast: false
35+
matrix:
36+
include:
37+
- image: sourceflow-bank-api
38+
dockerfile: samples/Bank/Bank.Api/Dockerfile
39+
- image: sourceflow-studio-demo
40+
dockerfile: samples/Studio/SourceFlow.Studio.Demo/Dockerfile
41+
steps:
42+
- uses: actions/checkout@v4
43+
44+
- name: Image name
45+
id: name
46+
run: echo "image=ghcr.io/${GITHUB_REPOSITORY_OWNER,,}/${{ matrix.image }}" >> "$GITHUB_OUTPUT"
47+
48+
- uses: docker/setup-qemu-action@v3
49+
- uses: docker/setup-buildx-action@v3
50+
51+
- uses: docker/login-action@v3
52+
with:
53+
registry: ghcr.io
54+
username: ${{ github.actor }}
55+
password: ${{ secrets.GITHUB_TOKEN }}
56+
57+
- id: meta
58+
uses: docker/metadata-action@v5
59+
with:
60+
images: ${{ steps.name.outputs.image }}
61+
tags: |
62+
type=ref,event=branch
63+
type=sha,format=short
64+
type=raw,value=v3-latest
65+
66+
- uses: docker/build-push-action@v6
67+
with:
68+
context: .
69+
file: ${{ matrix.dockerfile }}
70+
platforms: linux/amd64,linux/arm64
71+
push: true
72+
tags: ${{ steps.meta.outputs.tags }}
73+
labels: ${{ steps.meta.outputs.labels }}
74+
cache-from: type=gha,scope=${{ matrix.image }}
75+
cache-to: type=gha,mode=max,scope=${{ matrix.image }}

‎SourceFlow.slnx‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,10 @@
6262
<Project Path="samples/Bank/Bank.Accounts/Bank.Accounts.csproj" />
6363
<Project Path="samples/Bank/Bank.Transfers/Bank.Transfers.csproj" />
6464
<Project Path="samples/Bank/Bank.Notifications/Bank.Notifications.csproj" />
65+
<Project Path="samples/Bank/Bank.Api/Bank.Api.csproj" />
66+
</Folder>
67+
<Folder Name="/samples/Studio/">
68+
<Project Path="samples/Studio/SourceFlow.Studio.Demo/SourceFlow.Studio.Demo.csproj" />
6569
</Folder>
6670
<Folder Name="/benchmarks/">
6771
<Project Path="benchmarks/SourceFlow.Benchmarks/SourceFlow.Benchmarks.csproj" />

‎docker-compose.yml‎

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
# SourceFlow.Net v3 demo: PostgreSQL, the Bank sample service and the Studio demo console.
2+
#
3+
# docker compose up -d # pull the published images (ghcr.io), or build them if not available
4+
# docker compose up -d --build # build the images from this checkout
5+
#
6+
# Studio demo console: http://localhost:5080 Bank service: http://localhost:8080 PostgreSQL: localhost:55432
7+
# SOURCEFLOW_TAG selects the image tag (default v3-latest).
8+
name: sourceflow-demo
9+
10+
services:
11+
postgres:
12+
image: postgres:17-alpine
13+
environment:
14+
POSTGRES_USER: sourceflow
15+
POSTGRES_PASSWORD: sourceflow
16+
POSTGRES_DB: bank
17+
ports:
18+
- "55432:5432"
19+
volumes:
20+
- postgres-data:/var/lib/postgresql/data
21+
healthcheck:
22+
test: ["CMD-SHELL", "pg_isready -U sourceflow -d bank"]
23+
interval: 2s
24+
timeout: 3s
25+
retries: 30
26+
27+
bank-api:
28+
image: ghcr.io/codeshayk/sourceflow-bank-api:${SOURCEFLOW_TAG:-v3-latest}
29+
build:
30+
context: .
31+
dockerfile: samples/Bank/Bank.Api/Dockerfile
32+
environment:
33+
ConnectionStrings__SourceFlow: "Host=postgres;Database=bank;Username=sourceflow;Password=sourceflow;GSS Encryption Mode=Disable"
34+
SourceFlow__AutoMigrate: "true"
35+
# Sample-only query endpoint used by the console (no authentication): never expose it publicly.
36+
Demo__QueryApi: "true"
37+
Demo__PersonalData: "false"
38+
ports:
39+
- "8080:8080"
40+
depends_on:
41+
postgres:
42+
condition: service_healthy
43+
restart: unless-stopped
44+
45+
studio:
46+
image: ghcr.io/codeshayk/sourceflow-studio-demo:${SOURCEFLOW_TAG:-v3-latest}
47+
build:
48+
context: .
49+
dockerfile: samples/Studio/SourceFlow.Studio.Demo/Dockerfile
50+
environment:
51+
Studio__ServiceUrl: "http://bank-api:8080/"
52+
ports:
53+
- "5080:8080"
54+
depends_on:
55+
- bank-api
56+
restart: unless-stopped
57+
58+
volumes:
59+
postgres-data:
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<Project Sdk="Microsoft.NET.Sdk.Web">
2+
<!-- Bank sample host: the Accounts, Transfers and Notifications modules in one service on PostgreSQL (demo image). -->
3+
<PropertyGroup>
4+
<UseSourceFlowGenerator>false</UseSourceFlowGenerator>
5+
<InvariantGlobalization>true</InvariantGlobalization>
6+
<UserSecretsId>sourceflow-bank-api</UserSecretsId>
7+
</PropertyGroup>
8+
<ItemGroup>
9+
<ProjectReference Include="..\..\..\src\Hosting\SourceFlow.AspNetCore\SourceFlow.AspNetCore.csproj" />
10+
<ProjectReference Include="..\..\..\src\Storage\SourceFlow.Storage.PostgreSQL\SourceFlow.Storage.PostgreSQL.csproj" />
11+
<ProjectReference Include="..\Bank.Contracts\Bank.Contracts.csproj" />
12+
<ProjectReference Include="..\Bank.Accounts\Bank.Accounts.csproj" />
13+
<ProjectReference Include="..\Bank.Transfers\Bank.Transfers.csproj" />
14+
<ProjectReference Include="..\Bank.Notifications\Bank.Notifications.csproj" />
15+
</ItemGroup>
16+
</Project>

0 commit comments

Comments
 (0)