integrating data streamer stack and clickhouse stack

This commit is contained in:
2024-11-27 10:07:30 -07:00
parent b701e239d2
commit 4caeda48c2
4 changed files with 59 additions and 194 deletions

View File

@@ -1,34 +1,46 @@
param (
[switch] $MasterNode,
[switch] $downStack,
[string] $SwarmToken,
[string] $ManagerAddr
)
$script_dir = $PSScriptRoot
# Write-Output $script_dir # ===> \Project\scripts
$scriptDir = $PSScriptRoot
# Write-Output $scriptDir # ===> \Project\scripts
if ($MasterNode) {
Write-Output "Initializing Docker Swarm..."
docker stack rm test_datastreamer_automated
$stackName = "TheWebFarm"
if ($downStack) {
Write-Output "[+] Removing stack..."
docker stack rm $stackName
docker service rm registry
# registry
Set-Location $script_dir/../preprocessing
docker service create --name registry -p 5000:5000 registry:2
docker build -t 127.0.0.1:5000/data_streamer:latest --no-cache --push -f Dockerfile.python .
docker stack deploy -d -c docker-compose.yml test_datastreamer_automated
Set-Location $script_dir
}
elseif ($MasterNode) {
Write-Output "[+] swarm master"
# cleanup
docker stack rm $stackName
docker service rm registry
# data streaming
# pip install -r "$script_dir/../final/config_update_scripts/requirements.txt"
Set-Location $scriptDir/../preprocessing
docker service create --name registry -p 5000:5000 registry:2
docker build -t 127.0.0.1:5000/data-streamer:latest --no-cache --push -f Dockerfile.python .
# execute
Set-Location $scriptDir
docker stack deploy -d `
-c ../preprocessing/docker-compose.yml `
-c ../clickhouse/docker-compose-old.yaml `
$stackName
# scripts
# pip install -r "$scriptDir/../final/config_update_scripts/requirements.txt"
# Set-Location $scriptDir/../preprocessing
# python3 update_trigger.py
}
else {
Write-Output "swarm follower"
Write-Output "joining swarm with token $SwarmToken"
Write-Output "[+] swarm follower"
Write-Output "[+] joining swarm with token $SwarmToken"
docker swarm join --token $SwarmToken $ManagerAddr
}