Installation guide

The agent

Install the dependencies

On a redhat-based system :

# yum install boost-devel jsoncpp-devel openssl-devel

On a debian-based system :

# aptitude install libssl-dev libjsoncpp-dev libboost-date-time-dev libboost-filesystem-dev libboost-regex-dev libboost-system-dev libboost-thread-dev

Build and install the agent

if you havent already clone the repository :

$ git clone https://github.com/sebt3/watched.agent.git
$ cd watched.agent

then build using cmake :

watched.agent$ mkdir build
watched.agent$ cd build
watched.agent/build$ cmake ..
watched.agent/build$ make
watched.agent/build$ sudo make install

Alternatively, on Debian :

watched.agent$ dpkg-buildpackage
watched.agent$ sudo dpkg -i ../watched.agent_*.deb

Finally, start the agent :

watched.agent/build$ sudo systemctl start watched.agent

The backend

Install the dependencies

On a redhat-based system :

# yum install boost-devel jsoncpp-devel openssl-devel mysql++-devel

On a debian-based system :

# aptitude install libmysql++-dev libssl-dev libjsoncpp-dev libboost-date-time-dev libboost-filesystem-dev libboost-regex-dev libboost-system-dev libboost-thread-dev

Setup the database

Create a user for watched and a database in your mysql server.

# mysql -p
CREATE USER 'watched'@'localhost' IDENTIFIED BY 'watched';
create database watcheddb;
grant all privileges on watcheddb.* to watched@'%' identified by 'watched';
grant all privileges on watcheddb.* to watched@localhost identified by 'watched';

The username, password and database name provided here are an example, you're free to use anything you like instead.

if you havent already clone the repository :

$ git clone https://github.com/sebt3/watched.back.git
$ cd watched.back

Now create the datamodel as the user you just created :

watched.back$ mysql -u watched -D watcheddb -p <sql/schema.sql

Build the backend

then build using cmake :

watched.back$ mkdir build
watched.back$ cd build
watched.back/build$ cmake ..
watched.back/build$ make
watched.back/build$ sudo su
watched.back/build# make install

Alternatively, on Debian :

watched.back$ dpkg-buildpackage
watched.back$ sudo su
watched.back# dpkg -i ../watched.back_*.deb

Edit the configuration file to setup database connection :

watched.back/build# vi /etc/watched/back.config.json
{
...
        "db" : 
        {
                "connection_string" : "localhost:3306", /*	MySQL database connection string */
                "database_name" : "watcheddb", /*			MySQL database name */
                "login" : "watched", /*						MySQL login */
                "password" : "watched", /*					MySQL password */
                "pool_size" : 32 /*							Number of concurrent connections to the database */
        },
...
}

Finally, start the backend :

watched.back/build# systemctl start watched.back

The frontend

Get the initial dependency

On a redhat-based system :

# yum install php composer

On a debian-based system :

# aptitude install composer

Install the php packages

if you havent already clone the repository :

$ git clone https://github.com/sebt3/watched.front.git
$ cd watched.front
watched.front$ composer install

Configure

Edit the configuration file to setup the database :

watched.front$ vi front.config.json
{
        "db" : 
        {
                "host"   : "localhost",
                "dbname" : "watcheddb",
                "user"   : "watched",
                "pass"   : "watched"
        },
...
}

Finally, start the frontend :

watched.front$ php -S 0.0.0.0:8080 -t public/