Skip to content

tobusiek/PracaMagisterska

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

81 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Instructions for freshly installed Ubuntu 22.04 LTS

Start with updating packages

$ sudo apt update && sudo apt upgrade -y
$ sudo apt-get install ffmpeg

Python setup

Installation

$ sudo apt install python3.10
$ python3.10 --version  # verify python version

Venv setup

$ cd src/
$ python3.10 -m pip install virtualenv
$ python3.10 -m venv <your_venv_name>

If this doesn't work - try:

$ sudo apt install python3-pip
$ sudo apt install python3-venv

Activate your venv

$ source <your_venv_name>/bin/activate

Install requirements

$ pip install -r requirements.txt

Kafka setup

Installation

$ cd /opt/
$ sudo apt install default-jdk
$ sudo wget https://dlcdn.apache.org/kafka/3.4.0/kafka_2.12-3.4.0.tgz
$ sudo tar -xvzf kafka_2.12-3.4.0.tgz

Configuration

$ cd kafka_2.12-3.4.0/config
$ sudo nano server.properties
  1. Find advertised.listeners
  2. Uncomment line
  3. Change to advertised.listeners=PLAINTEXT://localhost:9092
  4. ctrl+x -> y -> enter
$ sudo nano producer.properties
  1. Find max.request.size
  2. Uncomment line
  3. Change to max.request.size=2097152
  4. ctrl+x -> y -> enter

Make Kafka startup quicker

$ cd <project-root>/kafka-commands/
$ chmod a+x chmod-kafka.sh
$ sudo ./chmod-kafka.sh

Start Zookeeper

$ sudo ./start-zookeeper.sh

Start Kafka

$ sudo ./start-kafka.sh

Stop Kafka Server and Zookeeper if needed

$ sudo ./stop-kafka-and-zookeeper.sh

Create topics for requests and results

$ sudo ./create-topics.sh

Run the application

Start the consumer

(venv) $ cd <project-root>/predictions_server/
(venv) $ python main.py

Start the producer

(venv) $ cd  <project-root>/api_server/
(venv) $ python main.py