Nexus is a web application for the Citellus framework
Switch branches/tags
Nothing to show
Clone or download
iranzo Update uris
Change-Id: I5375b59934c48ba613989d82a0f4d4bd7b2e1261
Latest commit a44bef3 Jul 8, 2018

README.md

License Build Status Coverage Status Release status

About

This web application is a frontend for the Citellus framework by rcernin

Components

Known issues

  • The first time we load a case, it takes ~30 seconds to parse and insert all the data in the DB. This might be because that we're using db.merge.
  • It's my first python webapp, and I think some of the things could be better implement, like the helpers modules.

TODO

We have a Trello Board to track TODOs.

Installation

Python libraries

We first create python's virtual environment and we souce the activate file. WSGI will be able to use this environment using the python-home variable.

$ cd /var/www/nexus
$ virtualenv-2.7 .venv
$ . .venv/bin/activate
$ pip install -r requirements.txt

User accounts

You can login using OAuth with Google as provider. There's currently no roles implemented.

Apache config

WSGIDaemonProcess nexus python-home=/var/www/nexus/.venv

WSGIProcessGroup nexus
WSGIApplicationGroup %{GLOBAL}
WSGIPythonHome /var/www/nexus/.venv
# This is necessary because it can take quite some time to scan a lot of reports
Timeout 300

WSGIScriptAlias /nexus /var/www/nexus/run.py

<Directory /var/www/nexus>
    Require all granted
</Directory>

Configuration

Make a copy and edit instance/config.py.

  • You need to create Credentials on Google API Console
  • You need to setup a MySQL DB. Here's a docker command:
docker network create --subnet=172.18.0.0/16 net-db
docker run \
--name nexus-db001 \
--net net-db --ip 172.18.0.199 \
-p 3306:3306 \
-v /root/mariadb/conf:/etc/mysql/conf.d \
-v /root/mariadb/data:/var/lib/mysql \
-e MYSQL_ROOT_PASSWORD=RandomString \
-e MYSQL_DATABASE=nexus \
-e MYSQL_USER=nexus \
-e MYSQL_PASSWORD=OtherRandomString \
-d mariadb:10.3 \
--character-set-server=utf8mb4 \
--collation-server=utf8mb4_unicode_ci

DB init

The database is initialized based on the models.py file.

$ pwd
/var/www/nexus
$ . .venv/bin/activate
$ export FLASK_CONFIG=development
$ rm -rf migrations/
$ python manage.py db init
$ python manage.py db migrate
$ python manage.py db upgrade

The script bin/resetdb.sh executes these commands.

System Activity Report (SAR)

Most of the sosreport we get have SA files generated by sysstat v10. It appears that the format has changed considerably and it looks like sysstat-11 is not backward compatible, so you can't parse sysstat-10 files with sysstat-11. If you use sysstat-11 on your environment (Fedora for example), you will need to compile sysstat-10. This is not necessary on collab-shell for now.

This is how I built sysstat-10. You do not need to do this unless you want to recompile. The file bin/sadf is based on systat-10.

 $ cd /git
 $ git clone https://github.com/sysstat/sysstat.git
 $ git checkout tags/v10.1.5
 $ git pull
 $ mv sysstat sysstat-10.1.5
 $ cd /git/sysstat-10.1.5
 $ ./configure
 $ make

I didn't want to run make install because I want to keep sysstat-11 for system wide.

SELinux

  • Give read access to the /cases folder to apache
# semanage fcontext -a -t httpd_sys_content_t '/cases(/.*)?'
  • Give write access to the sqlite database
# semanage fcontext -a -t httpd_sys_rw_content_t '/var/www/nexus/app(/.*)?'
# chown -R apache:apache /var/www/nexus/db/
  • Give execute access to the binary directory
# semanage fcontext -a -t httpd_sys_script_exec_t '/var/www/nexus/bin(/.*)?'
# semanage fcontext -a -t httpd_sys_script_exec_t '/git/citellus(/.*)?'
# chown -R apache:apache /var/www/nexus/bin/
  • Restorecon
# restorecon -R -F -v /var/www/nexus/ /cases/ /git/citellus/

Citellus Team