mirror of
https://github.com/20kaushik02/real-time-traffic-analysis-clickhouse.git
synced 2025-12-06 09:54:07 +00:00
added deployment script for data streamer part of the stack
This commit is contained in:
parent
d07d94cc1e
commit
b701e239d2
@ -1,5 +1,3 @@
|
|||||||
version: '3.8'
|
|
||||||
|
|
||||||
services:
|
services:
|
||||||
zookeeper:
|
zookeeper:
|
||||||
image: confluentinc/cp-zookeeper:latest
|
image: confluentinc/cp-zookeeper:latest
|
||||||
@ -41,22 +39,17 @@ services:
|
|||||||
restart_policy:
|
restart_policy:
|
||||||
condition: on-failure
|
condition: on-failure
|
||||||
|
|
||||||
pcap_streamer:
|
data_streamer:
|
||||||
image: levenshtein/streamer_test3:latest
|
image: 127.0.0.1:5000/data_streamer:latest
|
||||||
depends_on:
|
depends_on:
|
||||||
- kafka
|
- kafka
|
||||||
networks:
|
networks:
|
||||||
kafka_network:
|
kafka_network:
|
||||||
aliases:
|
aliases:
|
||||||
- pcap_streamer
|
- data_streamer
|
||||||
volumes:
|
volumes:
|
||||||
# - "/host_mnt/c/Users/akash/storage/Asu/sem3/dds/project:/data/pcap"
|
- "./10k_sample_2023_10_01-2023_10_31.csv:/data/csv/main.csv:ro"
|
||||||
- "./:/data/pcap"
|
command: "sh -c 'sleep 30 && python /app/pcap_processor.py -c /data/csv/main.csv -x --stream_size 100000'"
|
||||||
- "./:/data/csv"
|
|
||||||
environment:
|
|
||||||
PCAP_FILE: /data/pcap/202310081400.pcap
|
|
||||||
# command: ["sh", "-c", "sleep 30 && python /app/pcap_processor.py -f /data/pcap/202310081400.pcap -s --stream_size 1000"]
|
|
||||||
command: ["sh", "-c", "sleep 30 && python /app/pcap_processor.py -c /data/csv/sample_output.csv -s --stream_size 1000"]
|
|
||||||
deploy:
|
deploy:
|
||||||
replicas: 1
|
replicas: 1
|
||||||
restart_policy:
|
restart_policy:
|
||||||
|
|||||||
@ -208,7 +208,7 @@ if __name__ == "__main__":
|
|||||||
producer.client.send(KAFKA_TOPIC, row_to_dict(row))
|
producer.client.send(KAFKA_TOPIC, row_to_dict(row))
|
||||||
dbg_print(row_to_dict(row))
|
dbg_print(row_to_dict(row))
|
||||||
print("streamed packet", idx)
|
print("streamed packet", idx)
|
||||||
if idx > sample_size:
|
if sample and idx > sample_size:
|
||||||
break
|
break
|
||||||
print(f"total streamed: {idx}")
|
print(f"total streamed: {idx}")
|
||||||
|
|
||||||
|
|||||||
34
scripts/deploy.ps1
Normal file
34
scripts/deploy.ps1
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
param (
|
||||||
|
[switch] $MasterNode,
|
||||||
|
[string] $SwarmToken,
|
||||||
|
[string] $ManagerAddr
|
||||||
|
)
|
||||||
|
|
||||||
|
$script_dir = $PSScriptRoot
|
||||||
|
# Write-Output $script_dir # ===> \Project\scripts
|
||||||
|
|
||||||
|
if ($MasterNode) {
|
||||||
|
Write-Output "Initializing Docker Swarm..."
|
||||||
|
|
||||||
|
docker stack rm test_datastreamer_automated
|
||||||
|
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
|
||||||
|
|
||||||
|
# data streaming
|
||||||
|
|
||||||
|
# pip install -r "$script_dir/../final/config_update_scripts/requirements.txt"
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
Write-Output "swarm follower"
|
||||||
|
Write-Output "joining swarm with token $SwarmToken"
|
||||||
|
docker swarm join --token $SwarmToken $ManagerAddr
|
||||||
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user