<commit_before>#!/bin/bash

set -e

username=${1:?"Expected web app username as first parameter."}
password=${2:?"Expected web app password as second parameter."}
host_repository=${3:?"Expected host repository as third parameter."}
host_repository_commit=${4:?"Expected host repository commit id as fourth parameter."}

sudo useradd -m -c "Web Applications Account" -p $(openssl passwd -1 "$password") "$username"
sudo mkdir /cumulonimbus
git clone -b $host_repository_commit $host_repository /cumulonimbus
sudo chown --recursive "$username:$username" /cumulonimbus

#  It might be preferable to write to /etc/cron.d/<filename>, but I couldnt' get that to work.
(sudo crontab -l -u $username ; echo '@reboot PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin bash -c "cd /cumulonimbus && ./run.sh >>~/cronrun_cumulonimbus 2>&1"') | sudo crontab -u "$username" -

echo "To deploy an individual site, do something like:"
echo "    su $username"
echo "    git clone <project_repository> /cumulonimbus/sites/sample"
echo "    mkdir /cumulonimbus/sites/sample.config"
echo "    cp <config file> /cumulonimbus/sites/sample.config/config.json"
echo "    ln --symbolic /cumulonimbus/sites/sample.config /cumulonimbus/configs/sample"
echo "    cd /cumulonimbus"
echo "    ./deploy.sh sample"
<commit_msg>fix crontab to run /cumulonimbus/run.sh on reboot<commit_after>#!/bin/bash

set -e

username=${1:?"Expected web app username as first parameter."}
password=${2:?"Expected web app password as second parameter."}
host_repository=${3:?"Expected host repository as third parameter."}
host_repository_commit=${4:?"Expected host repository commit id as fourth parameter."}

sudo useradd -m -c "Web Applications Account" -p $(openssl passwd -1 "$password") "$username"
sudo mkdir /cumulonimbus
git clone -b $host_repository_commit $host_repository /cumulonimbus
sudo chown --recursive "$username:$username" /cumulonimbus

echo '@reboot wwwuser PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin bash -c "cd /cumulonimbus; ./run.sh >>~/cronrun_cumulonimbus 2>&1"' | sudo tee /etc/cron.d/cumulonimbus > /dev/null

echo "To deploy an individual site, do something like:"
echo "    su $username"
echo "    git clone <project_repository> /cumulonimbus/sites/sample"
echo "    mkdir /cumulonimbus/sites/sample.config"
echo "    cp <config file> /cumulonimbus/sites/sample.config/config.json"
echo "    ln --symbolic /cumulonimbus/sites/sample.config /cumulonimbus/configs/sample"
echo "    cd /cumulonimbus"
echo "    ./deploy.sh sample"

{'fraction_non_alphanumeric': 0.13312812620238554, 'fraction_numerical': 0.005386687187379761, 'mean_word_length': 4.128205128205129, 'pattern_counts': {'":': 0, '<': 8, '<?xml version=': 0, '>': 15, 'https://': 0, 'lorem ipsum': 0, 'www.': 1, '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': '1503109', 'n_tokens_mistral': 943, 'n_tokens_neox': 865, 'n_words': 243}