-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathrun-demo.ps1
61 lines (59 loc) · 1.83 KB
/
run-demo.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
Write-Host "Setup infrastructure"
$env:BASE_PATH="."
$network="demo"
Write-Host "Create network $network"
docker network create $network
Write-Host "Create containers"
docker-compose `
-f .\rabbitmq.docker-compose.yml `
-f .\cassandra.docker-compose.yml `
-f .\daemon.docker-compose.yml `
-f .\datagenerator.docker-compose.yml `
down
Write-Host "Waiting for container readiness"
start powershell {
docker-compose `
-f .\rabbitmq.docker-compose.yml `
-f .\cassandra.docker-compose.yml `
up
pause
}
do
{
Start-Sleep -s 5
$state=$(docker inspect cassandra-sidecar|ConvertFrom-Json).State
$status=$state.Status
$exitCode=$state.ExitCode
$restart=$state.Restarting
}Until(($status -eq "exited") -and ($exitCode -eq 0) -and ($restart -eq $false))
Write-Host "Running consumer"
start powershell {
docker-compose -f .\daemon.docker-compose.yml --compatibility up --scale daemon=2
pause
}
Read-Host -Prompt "Enter to run publisher - wait for consumer to start"
echo "http://localhost:15674/#/queues for RabbitMQ management"
start powershell {
$env:MESSAGES=100;
docker-compose -f .\datagenerator.docker-compose.yml up
pause
}
Read-Host -Prompt "Enter to verify data on cassandra"
$queries = @( `
"select json * from fulfillment.orders limit 100;" `
)
foreach ($query in $queries) {
echo $query
docker exec -t cassandra cqlsh -e $query
}
Read-Host -Prompt "Enter to tear infrastructure down"
Write-Host "TearDown containers"
docker-compose `
-f .\rabbitmq.docker-compose.yml `
-f .\cassandra.docker-compose.yml `
-f .\daemon.docker-compose.yml `
-f .\datagenerator.docker-compose.yml `
down `
--rmi local
Write-Host "TearDown network $network"
docker network rm $network