Skip to content

Setup Watcher environment

Use a Linux server, we recommend the use of a Virtual Machine (Ubuntu 20.04 and Ubuntu 21.10 LTS in our case).

Then, follow the steps below:

  • Update and upgrade your machine:

sudo apt update && sudo apt upgrade -y
- Install Python and Node.js:

sudo apt install python3 python3-pip -y 
sudo apt install nodejs -y
Watcher is built with Node.js 22 (the version of the Docker image): install it from NodeSource or nvm if your distribution ships an older one. - Create and activate a Python virtual environment:

python3 -m venv .venv |source .venv/bin/activate
- Pull Watcher code:

git clone <your_forked_repository.git>
- Move to the following directory:

cd Watcher/Watcher
- Install python-ldap dependencies:

sudo apt install -y libsasl2-dev python-dev-is-python3 libldap2-dev libssl-dev
- Install mysqlclient dependency:

sudo apt install default-libmysqlclient-dev
- Install Rust (for tokenizers, etc)

curl https://sh.rustup.rs -sSf | sh -s -- -y |source $HOME/.cargo/env 
- Install Python dependencies:

pip3 install -r requirements.txt
- Install Torch and Torchvision dependencies:

pip install --extra-index-url https://download.pytorch.org/whl/cpu torch==2.13.0 torchvision==0.28.0 torchaudio==2.11.0
- Install Node.js dependencies:
sudo apt install npm -y
npm install
- Install MySQL:

sudo apt install mysql-server -y
sudo mysql_secure_installation
- Enter root password. - You may now enter Y and ENTER. Accept all fields. This will remove some anonymous users and the test database,
disable remote root logins, and load these new rules so that MySQL immediately respects any changes made.

Create & Configure Watcher database:

  sudo mysql 
  CREATE USER 'watcher'@'localhost' IDENTIFIED BY 'Ee5kZm4fWWAmE9hs!';
  GRANT ALL PRIVILEGES ON *.* TO 'watcher'@'localhost' WITH GRANT OPTION;
  CREATE DATABASE db_watcher;
  use db_watcher;
  exit

systemctl status mysql.service

bash cd Watcher/Watcher

In settings.py change HOST variable to localhost:

python DATABASES = { 'default': { 'ENGINE': 'django.db.backends.mysql', 'CONN_MAX_AGE': 3600, 'NAME': 'db_watcher', 'USER': 'watcher', 'PASSWORD': 'Ee5kZm4fWWAmE9hs!', 'HOST': 'localhost', 'PORT': '3306', 'OPTIONS': { 'init_command': "SET sql_mode='STRICT_TRANS_TABLES'", }, } }

  • [IMPORTANT] When commit put HOST variable back to db_watcher bash cd ..
  • Migrate the database:

bash python3 manage.py migrate - Run Watcher:

bash python3 manage.py runserver