added bash script, integrating ui

This commit is contained in:
Kaushik Narayan R 2024-11-27 17:40:20 -07:00
parent 75bca2d704
commit 0a6f0bb6f4
3 changed files with 54 additions and 1 deletions

View File

@ -29,6 +29,7 @@ elseif ($MasterNode) {
docker stack deploy -d ` docker stack deploy -d `
-c ../preprocessing/docker-compose.yml ` -c ../preprocessing/docker-compose.yml `
-c ../clickhouse/docker-compose.yaml ` -c ../clickhouse/docker-compose.yaml `
-c ../ui/docker-compose.yaml `
$stackName $stackName
# scripts # scripts

51
scripts/deploy.sh Normal file
View File

@ -0,0 +1,51 @@
#!/bin/bash
while getopts "M:D:T:A" flag; do
case "${flag}" in
M) masterNode=true ;;
D) downStack=true ;;
T) swarmToken=$OPTARG ;;
A) managerAddr=$OPTARG ;;
esac
done
echo "masterNode: $masterNode"
echo "downStack: $downStack"
echo "swarmToken: $swarmToken"
echo "managerAddr: $managerAddr"
$scriptDir = $(readlink -f "$0")
# echo $scriptDir # ===> /Project/scripts
$stackName="TheWebFarm"
if [[ $downStack ]]; then
echo "[+] Removing stack..."
docker stack rm $stackName
docker service rm registry
elif ($MasterNode); then
echo "[+] swarm master"
# data streaming
cd $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 .
docker build -t 127.0.0.1:5000/data-streamer:latest --push -f Dockerfile.python .
# execute
cd $scriptDir
docker stack deploy -d \
-c ../preprocessing/docker-compose.yml \
-c ../clickhouse/docker-compose.yaml \
-c ../ui/docker-compose.yaml \
$stackName
# scripts
# pip install -r "$scriptDir/../final/config_update_scripts/requirements.txt"
# cd $scriptDir/../preprocessing
# python3 update_trigger.py
else
echo "[+] swarm follower"
echo "[+] joining swarm with token $swarmToken"
docker swarm join --token $swarmToken $managerAddr
fi

View File

@ -4,7 +4,7 @@ services:
container_name: grafana container_name: grafana
volumes: volumes:
- grafana-storage:/var/lib/grafana - grafana-storage:/var/lib/grafana
- ../ui/grafana_clickhouse_datasource.yaml:/etc/grafana/provisioning/datasources/clickhouse.yaml # relative to clickhouse directory - ../ui/grafana_clickhouse_datasource.yaml:/etc/grafana/provisioning/datasources/clickhouse.yaml
networks: networks:
outside_net: outside_net:
aliases: aliases:
@ -27,3 +27,4 @@ networks:
volumes: volumes:
grafana-storage: grafana-storage:
driver: local