Skip to content

Commit 2f1e09f

Browse files
authored
Test codespaces (#5)
* Added devcontainer to root * Updated devcontainer to perform setup automatically * Fixed docker compose path * Updated paths in devcontainer * Try set service to null * Removed version property * Run docker compose as a post create command instead * Added setup.sh * Force unzip replace * Wait for ESDB to run first * Updated on create and post create commands * start all programs at the post create. reduced size of initial data * Few updates to scripts and dataset
1 parent ce63b0a commit 2f1e09f

6 files changed

Lines changed: 85 additions & 2 deletions

File tree

.devcontainer/devcontainer.json

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
{
2+
"name": "Polyglot Persistence",
3+
"image": "mcr.microsoft.com/devcontainers/dotnet:9.0",
4+
"features": {
5+
"ghcr.io/devcontainers/features/docker-in-docker:2": {}
6+
},
7+
"containerEnv": {
8+
"DOTNET_NOLOGO": "true"
9+
},
10+
"onCreateCommand": "chmod +x /workspaces/developer-bootcamp/polyglot-persistence/onCreateCommand.sh && /workspaces/developer-bootcamp/polyglot-persistence/onCreateCommand.sh",
11+
"postCreateCommand": "chmod +x /workspaces/developer-bootcamp/polyglot-persistence/postCreateCommand.sh && /workspaces/developer-bootcamp/polyglot-persistence/postCreateCommand.sh",
12+
"forwardPorts": [27017, 5432, 6379, 2113, 1113],
13+
"portsAttributes": {
14+
"2113": {
15+
"label": "EventStoreDB Admin UI",
16+
"onAutoForward": "notify"
17+
},
18+
"1113": {
19+
"label": "EventStoreDB API",
20+
"onAutoForward": "silent"
21+
},
22+
"27017": {
23+
"label": "MongoDB",
24+
"onAutoForward": "notify"
25+
},
26+
"5432": {
27+
"label": "PostgreSQL",
28+
"onAutoForward": "notify"
29+
},
30+
"6379": {
31+
"label": "Redis",
32+
"onAutoForward": "notify"
33+
}
34+
},
35+
"customizations": {
36+
"vscode": {
37+
"settings": {
38+
"extensions.ignoreRecommendations": true,
39+
"telemetry.enableTelemetry": false,
40+
"telemetry.telemetryLevel": "off",
41+
"redhat.telemetry.enabled": false
42+
},
43+
"extensions": [
44+
"ms-dotnettools.csharp",
45+
"ms-azuretools.vscode-docker"
46+
]
47+
},
48+
"codespaces": {
49+
"openFiles": []
50+
}
51+
}
52+
}
3.41 KB
Binary file not shown.

polyglot-persistence/docker-compose.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
version: '3.8'
2-
31
services:
42
mongo:
53
image: mongo:7.0

polyglot-persistence/generate-data.sh

Whitespace-only changes.
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
docker compose -f /workspaces/developer-bootcamp/polyglot-persistence/docker-compose.yml up -d
2+
3+
unzip -o /workspaces/developer-bootcamp/polyglot-persistence/data/init-data.zip -d /workspaces/developer-bootcamp/polyglot-persistence/
4+
5+
chmod +x /workspaces/developer-bootcamp/polyglot-persistence/tools/Kurrent.Extensions.Commerce/linux-x64/edb-commerce
6+
7+
# Wait for EventStoreDB to be ready
8+
echo "Waiting for EventStoreDB to be ready..."
9+
max_attempts=30
10+
attempt=0
11+
while ! curl -s http://localhost:2113/ > /dev/null; do
12+
attempt=$((attempt+1))
13+
if [ $attempt -eq $max_attempts ]; then
14+
echo "EventStoreDB failed to start after $max_attempts attempts. Exiting."
15+
exit 1
16+
fi
17+
echo "Waiting for EventStoreDB to be ready... (attempt $attempt/$max_attempts)"
18+
sleep 2
19+
done
20+
echo "EventStoreDB is ready."
21+
22+
/workspaces/developer-bootcamp/polyglot-persistence/tools/Kurrent.Extensions.Commerce/linux-x64/edb-commerce seed-data-set /workspaces/developer-bootcamp/polyglot-persistence/data.json
23+
24+
dotnet build /workspaces/developer-bootcamp/polyglot-persistence/polyglot-persistence.sln
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
docker compose -f /workspaces/developer-bootcamp/polyglot-persistence/docker-compose.yml up -d
2+
3+
dotnet run --project /workspaces/developer-bootcamp/polyglot-persistence/DemoWeb &
4+
5+
dotnet run --project /workspaces/developer-bootcamp/polyglot-persistence/PostgresProjection &
6+
7+
dotnet run --project /workspaces/developer-bootcamp/polyglot-persistence/RedisProjection &
8+
9+
dotnet run --project /workspaces/developer-bootcamp/polyglot-persistence/MongoProjection &

0 commit comments

Comments
 (0)