Skip to content
52 changes: 52 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
{
"name": "Polyglot Persistence",
"image": "mcr.microsoft.com/devcontainers/dotnet:9.0",
"features": {
"ghcr.io/devcontainers/features/docker-in-docker:2": {}
},
"containerEnv": {
"DOTNET_NOLOGO": "true"
},
"onCreateCommand": "chmod +x /workspaces/developer-bootcamp/polyglot-persistence/onCreateCommand.sh && /workspaces/developer-bootcamp/polyglot-persistence/onCreateCommand.sh",
"postCreateCommand": "chmod +x /workspaces/developer-bootcamp/polyglot-persistence/postCreateCommand.sh && /workspaces/developer-bootcamp/polyglot-persistence/postCreateCommand.sh",
"forwardPorts": [27017, 5432, 6379, 2113, 1113],
"portsAttributes": {
"2113": {
"label": "EventStoreDB Admin UI",
"onAutoForward": "notify"
},
"1113": {
"label": "EventStoreDB API",
"onAutoForward": "silent"
},
"27017": {
"label": "MongoDB",
"onAutoForward": "notify"
},
"5432": {
"label": "PostgreSQL",
"onAutoForward": "notify"
},
"6379": {
"label": "Redis",
"onAutoForward": "notify"
}
},
"customizations": {
"vscode": {
"settings": {
"extensions.ignoreRecommendations": true,
"telemetry.enableTelemetry": false,
"telemetry.telemetryLevel": "off",
"redhat.telemetry.enabled": false
},
"extensions": [
"ms-dotnettools.csharp",
"ms-azuretools.vscode-docker"
]
},
"codespaces": {
"openFiles": []
}
}
}
Binary file added polyglot-persistence/data/init-data.zip
Binary file not shown.
2 changes: 0 additions & 2 deletions polyglot-persistence/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
version: '3.8'

services:
mongo:
image: mongo:7.0
Expand Down
Empty file.
24 changes: 24 additions & 0 deletions polyglot-persistence/onCreateCommand.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
docker compose -f /workspaces/developer-bootcamp/polyglot-persistence/docker-compose.yml up -d

unzip -o /workspaces/developer-bootcamp/polyglot-persistence/data/init-data.zip -d /workspaces/developer-bootcamp/polyglot-persistence/

chmod +x /workspaces/developer-bootcamp/polyglot-persistence/tools/Kurrent.Extensions.Commerce/linux-x64/edb-commerce

# Wait for EventStoreDB to be ready
echo "Waiting for EventStoreDB to be ready..."
max_attempts=30
attempt=0
while ! curl -s http://localhost:2113/ > /dev/null; do
attempt=$((attempt+1))
if [ $attempt -eq $max_attempts ]; then
echo "EventStoreDB failed to start after $max_attempts attempts. Exiting."
exit 1
fi
echo "Waiting for EventStoreDB to be ready... (attempt $attempt/$max_attempts)"
sleep 2
done
echo "EventStoreDB is ready."

/workspaces/developer-bootcamp/polyglot-persistence/tools/Kurrent.Extensions.Commerce/linux-x64/edb-commerce seed-data-set /workspaces/developer-bootcamp/polyglot-persistence/data.json

dotnet build /workspaces/developer-bootcamp/polyglot-persistence/polyglot-persistence.sln
9 changes: 9 additions & 0 deletions polyglot-persistence/postCreateCommand.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
docker compose -f /workspaces/developer-bootcamp/polyglot-persistence/docker-compose.yml up -d

dotnet run --project /workspaces/developer-bootcamp/polyglot-persistence/DemoWeb &

dotnet run --project /workspaces/developer-bootcamp/polyglot-persistence/PostgresProjection &

dotnet run --project /workspaces/developer-bootcamp/polyglot-persistence/RedisProjection &

dotnet run --project /workspaces/developer-bootcamp/polyglot-persistence/MongoProjection &