<commit_before>#!/bin/bash
set -x
set -e
:
: Installing exodus web service
: ==========================
:
EXODUS=`pwd`
test -f $EXODUS/install_www_apt.sh || ( echo Must be run in exodus install dir without path && exit )
:
: If installing into /root/then allow cd into /root - but no read access of course
[ ${EXODUS:0:6} = /root/ ] && chmod o+x /root
:
: Install apache and php
: ======================
:
sudo apt install -y apache2 php php-xml
sudo a2enmod rewrite ssl
sudo systemctl restart apache2
:
: Configure an apache site - HTTP
: ===============================
:
cat > /tmp/exodus.conf <<V0G0N
<VirtualHost *:80>
        ServerAdmin webmaster@localhost

        DocumentRoot /home/ubuntu/exodus/service/www

        ErrorLog ${APACHE_LOG_DIR}/error.log
        CustomLog ${APACHE_LOG_DIR}/access.log combined

        <Directory /home/ubuntu/exodus/service/www>
            Options Indexes FollowSymLinks
            AllowOverride All
            Require all granted
            DirectoryIndex default.htm
        </Directory>

</VirtualHost>
V0G0N
sed -i "s|/home/ubuntu/exodus/|$EXODUS/|g" /tmp/exodus.conf
sudo mv /tmp/exodus.conf /etc/apache2/sites-available/
:
: Configure an apache site - HTTPS
: ================================
:
cat > /tmp/exodus-ssl.conf <<V0G0N
<VirtualHost *:443>
    ServerAdmin webmaster@localhost

    DocumentRoot /home/ubuntu/exodus/service/www

    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined

    SSLEngine on

    #SSLCertificateFile /etc/letsencrypt/live/hosts.neosys.com/cert.pem
    #SSLCertificateKeyFile /etc/letsencrypt/live/hosts.neosys.com/privkey.pem
    #SSLCACertificateFile /etc/letsencrypt/live/hosts.neosys.com/fullchain.pem
    SSLCertificateFile /etc/ssl/certs/ssl-cert-snakeoil.pem
    SSLCertificateKeyFile /etc/ssl/private/ssl-cert-snakeoil.key

    <Directory /home/ubuntu/exodus/service/www>
        Options Indexes FollowSymLinks
        AllowOverride All
        Require all granted
        DirectoryIndex default.htm
    </Directory>

</VirtualHost>
V0G0N
sed -i "s|/home/ubuntu/exodus/|$EXODUS/|g" /tmp/exodus-ssl.conf
sudo mv /tmp/exodus-ssl.conf /etc/apache2/sites-available/
:
: Enable the apache sites and disable defaults
: ============================================
:
sudo a2dissite 000-default default-ssl.conf
sudo a2ensite exodus exodus-ssl
sudo systemctl restart apache2
:
: Configure data permissions
: ==========================
:<commit_msg>copy self certified certificates for https only if exodus versions not already present - to allow rerun of install_www.sh<commit_after>#!/bin/bash
set -x
set -e
:
: Installing exodus web service
: ==========================
:
EXODUS=`pwd`
test -f $EXODUS/install_www_apt.sh || ( echo Must be run in exodus install dir without path && exit )
:
: If installing into /root/then allow cd into /root - but no read access of course
[ ${EXODUS:0:6} = /root/ ] && chmod o+x /root
:
: Install apache and php
: ======================
:
sudo apt install -y apache2 php php-xml
sudo a2enmod rewrite ssl
sudo systemctl restart apache2
:
: Configure an apache site - HTTP
: ===============================
:
cat > /tmp/exodus.conf <<V0G0N
<VirtualHost *:80>
        ServerAdmin webmaster@localhost

        DocumentRoot /home/ubuntu/exodus/service/www

        ErrorLog ${APACHE_LOG_DIR}/error.log
        CustomLog ${APACHE_LOG_DIR}/access.log combined

        <Directory /home/ubuntu/exodus/service/www>
            Options Indexes FollowSymLinks
            AllowOverride All
            Require all granted
            DirectoryIndex default.htm
        </Directory>

</VirtualHost>
V0G0N
sed -i "s|/home/ubuntu/exodus/|$EXODUS/|g" /tmp/exodus.conf
sudo mv /tmp/exodus.conf /etc/apache2/sites-available/
:
: Configure an apache site - HTTPS
: ================================
:
: Use self signed certificates if exodus cert and key not already present
:
sudo test -f /etc/ssl/certs/exodus-cert.pem  || sudo cp /etc/ssl/certs/ssl-cert-snakeoil.pem   /etc/ssl/certs/exodus-cert.pem
sudo test -f /etc/ssl/private/exodus-key.pem || sudo cp /etc/ssl/private/ssl-cert-snakeoil.key /etc/ssl/private/exodus-key.pem
:
cat > /tmp/exodus-ssl.conf <<V0G0N
<VirtualHost *:443>
    ServerAdmin webmaster@localhost

    DocumentRoot /home/ubuntu/exodus/service/www

    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined

    SSLEngine on

    #SSLCertificateFile /etc/letsencrypt/live/hosts.neosys.com/cert.pem
    #SSLCertificateKeyFile /etc/letsencrypt/live/hosts.neosys.com/privkey.pem
    #SSLCACertificateFile /etc/letsencrypt/live/hosts.neosys.com/fullchain.pem
    SSLCertificateFile /etc/ssl/certs/exodus-cert.pem
    SSLCertificateKeyFile /etc/ssl/private/exodus-key.pem

    <Directory /home/ubuntu/exodus/service/www>
        Options Indexes FollowSymLinks
        AllowOverride All
        Require all granted
        DirectoryIndex default.htm
    </Directory>

</VirtualHost>
V0G0N
sed -i "s|/home/ubuntu/exodus/|$EXODUS/|g" /tmp/exodus-ssl.conf
sudo mv /tmp/exodus-ssl.conf /etc/apache2/sites-available/
:
: Enable the apache sites and disable defaults
: ============================================
:
sudo a2dissite 000-default default-ssl.conf
sudo a2ensite exodus exodus-ssl
sudo systemctl restart apache2
:
: Configure data permissions
: ==========================
:
{'fraction_non_alphanumeric': 0.16691477484183104, 'fraction_numerical': 0.009676218831410495, 'mean_word_length': 3.520605550883095, 'pattern_counts': {'":': 0, '<': 27, '<?xml version=': 0, '>': 23, 'https://': 0, 'lorem ipsum': 0, 'www.': 7, 'xml': 2}, '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': '2596192', 'n_tokens_mistral': 1928, 'n_tokens_neox': 1744, 'n_words': 405}