<commit_before>#!/bin/sh -e

set -x

export AUTH_REQUIRED=False

yum -y install gcc python-pip python-devel python-setuptools python-virtualenv libffi-devel openssl-devel
yum -y install httpd mod_wsgi mongodb-server
pip install --upgrade pip setuptools wheel virtualenv

grep -q ^smallfiles /etc/mongod.conf || echo "smallfiles = true" | tee -a /etc/mongod.conf
systemctl start mongod
systemctl enable mongod

id alerta || (groupadd alerta && useradd -g alerta alerta)
cd /opt
virtualenv alerta
alerta/bin/pip install alerta-server
echo "PATH=$PATH:/opt/alerta/bin" >/etc/profile.d/alerta.sh

cat >/etc/httpd/conf.d/default.conf << EOF
Listen 8080
<VirtualHost *:8080>
  ServerName localhost
  WSGIDaemonProcess alerta processes=5 threads=5
  WSGIProcessGroup alerta
  WSGIScriptAlias / /var/www/api.wsgi
  WSGIPassAuthorization On
  <Directory /opt/alerta>
    WSGIApplicationGroup %{GLOBAL}
    Require all granted
  </Directory>
</VirtualHost>
<VirtualHost *:80>
  ProxyPass /api http://localhost:8080
  ProxyPassReverse /api http://localhost:8080
  DocumentRoot /var/www/html
  <Directory /var/www/html>
    Require all granted<commit_msg>change SELinux bool value to allow connections to databases<commit_after>#!/bin/sh -e

set -x

export AUTH_REQUIRED=False

yum -y install gcc python-pip python-devel python-setuptools python-virtualenv libffi-devel openssl-devel
yum -y install httpd mod_wsgi mongodb-server
pip install --upgrade pip setuptools wheel virtualenv

grep -q ^smallfiles /etc/mongod.conf || echo "smallfiles = true" | tee -a /etc/mongod.conf
/usr/sbin/setsebool -P httpd_can_network_connect 1  # change SELinux policy to allow httpd modules to connect to databases over the network
systemctl start mongod
systemctl enable mongod

id alerta || (groupadd alerta && useradd -g alerta alerta)
cd /opt
virtualenv alerta
alerta/bin/pip install alerta-server
echo "PATH=$PATH:/opt/alerta/bin" >/etc/profile.d/alerta.sh

cat >/etc/httpd/conf.d/default.conf << EOF
Listen 8080
<VirtualHost *:8080>
  ServerName localhost
  WSGIDaemonProcess alerta processes=5 threads=5
  WSGIProcessGroup alerta
  WSGIScriptAlias / /var/www/api.wsgi
  WSGIPassAuthorization On
  <Directory /opt/alerta>
    WSGIApplicationGroup %{GLOBAL}
    Require all granted
  </Directory>
</VirtualHost>
<VirtualHost *:80>
  ProxyPass /api http://localhost:8080
  ProxyPassReverse /api http://localhost:8080
  DocumentRoot /var/www/html
  <Directory /var/www/html>
    Require all granted
{'fraction_non_alphanumeric': 0.09587378640776699, 'fraction_numerical': 0.016585760517799353, 'mean_word_length': 4.341252699784017, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 19, 'https://': 0, 'lorem ipsum': 0, 'www.': 6, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '323470', 'n_tokens_mistral': 892, 'n_tokens_neox': 818, 'n_words': 237}