<commit_before>#!/bin/sh

# exit on any error
set -e
set -x 

OPTS='--no-color'

echo "==============================================="
echo "configuring leap"
echo "==============================================="
mkdir /home/leap/configuration
cd /home/leap/configuration
leap $OPTS new --contacts <EMAIL> --domain try.pixelated-project.org --name LEAP_Example --platform=/home/leap/leap_platform .
echo '@log = "/var/log/leap/deploy.log"' >> Leapfile
ssh-keygen -f /root/.ssh/id_rsa -P ""
cat /root/.ssh/id_rsa.pub >> /root/.ssh/authorized_keys
mkdir -p /home/leap/configuration/files/nodes/pixelated
sh -c 'cat /etc/ssh/ssh_host_rsa_key.pub | cut -d" " -f1,2 >> /home/leap/configuration/files/nodes/pixelated/pixelated_ssh.pub'
leap $OPTS add-user --self
leap $OPTS cert ca
leap $OPTS cert csr
leap $OPTS node add pixelated ip_address:"$(facter ipaddress)"  services:webapp,mx,couchdb,soledad,monitor tags:production
echo '{ "webapp": { "admins": ["testadmin"] } }' > services/webapp.json

leap $OPTS compile

git init
git add .
git commit -m"configured provider"

git submodule add https://github.com/pixelated-project/pixelated-platform.git files/puppet
git add files/puppet
git commit -m 'added pixelated submodule'

leap $OPTS node init pixelated 
if [ $? -eq 1 ]; then
  echo "node init failed"
  exit 1
fi

leap $OPTS -v 2 deploy
if [ $? -eq 1 ]; then
  echo "deploy failed"
  exit 1
fi

set +e
git add .
git commit -m"initialized and deployed provider"
set -e

echo "==============================================="
echo "setting node to demo-mode"
echo "==============================================="
postconf -e default_transport="error: in demo mode"
sed -i 's/PasswordAuthentication no/PasswordAuthentication yes/g' /etc/ssh/sshd_config

# add users: testadmin and testuser with passwords "<PASSWORD>"
curl -s -k https://localhost/1/users.json -d "user%5Blogin%5D=testuser&user%5Bpassword_salt%5D=<PASSWORD>&user%5Bpassword_verifier%5D=<PASSWORD>"
curl -s -k https://localhost/1/users.json -d "user%5Blogin%5D=testadmin&user%5Bpassword_salt%5D=<PASSWORD>&user%5Bpassword_verifier%5D=<PASSWORD>a76eed330a0e8fd2a5c477ed2693694efc1cc23ae83c2ae351a21139701983dd595b6c3225a1bebd2a4e6122f83df87606f1a41152d9890e5a11ac3749b3bfcf4407fc83ef60b4ced68"

echo "==============================================="
echo "cleaning up"
echo "==============================================="
sync
sleep 10<commit_msg>Added platform testing after deploying<commit_after>#!/bin/sh

# exit on any error
set -e
set -x 

OPTS='--no-color'

echo "==============================================="
echo "configuring leap"
echo "==============================================="
mkdir /home/leap/configuration
cd /home/leap/configuration
leap $OPTS new --contacts <EMAIL> --domain try.pixelated-project.org --name LEAP_Example --platform=/home/leap/leap_platform .
echo '@log = "/var/log/leap/deploy.log"' >> Leapfile
ssh-keygen -f /root/.ssh/id_rsa -P ""
cat /root/.ssh/id_rsa.pub >> /root/.ssh/authorized_keys
mkdir -p /home/leap/configuration/files/nodes/pixelated
sh -c 'cat /etc/ssh/ssh_host_rsa_key.pub | cut -d" " -f1,2 >> /home/leap/configuration/files/nodes/pixelated/pixelated_ssh.pub'
leap $OPTS add-user --self
leap $OPTS cert ca
leap $OPTS cert csr
leap $OPTS node add pixelated ip_address:"$(facter ipaddress)"  services:webapp,mx,couchdb,soledad,monitor tags:production
echo '{ "webapp": { "admins": ["testadmin"] } }' > services/webapp.json

leap $OPTS compile

git init
git add .
git commit -m"configured provider"

git submodule add https://github.com/pixelated-project/pixelated-platform.git files/puppet
git add files/puppet
git commit -m 'added pixelated submodule'

leap $OPTS node init pixelated 
if [ $? -eq 1 ]; then
  echo "node init failed"
  exit 1
fi

leap $OPTS -v 2 deploy
if [ $? -eq 1 ]; then
  echo "deploy failed"
  exit 1
fi

set +e
git add .
git commit -m"initialized and deployed provider"
set -e

echo "==============================================="
echo "testing the platform"
echo "==============================================="

leap $OPTS -v 2 test --continue

echo "==============================================="
echo "setting node to demo-mode"
echo "==============================================="
postconf -e default_transport="error: in demo mode"
sed -i 's/PasswordAuthentication no/PasswordAuthentication yes/g' /etc/ssh/sshd_config

# add users: testadmin and testuser with passwords "<PASSWORD>"
curl -s -k https://localhost/1/users.json -d "user%5Blogin%5D=testuser&user%5Bpassword_salt%5D=<PASSWORD>&user%5Bpassword_verifier%5D=<PASSWORD>"
curl -s -k https://localhost/1/users.json -d "user%5Blogin%5D=testadmin&user%5Bpassword_salt%5D=<PASSWORD>&user%5Bpassword_verifier%5D=<PASSWORD>a1bebd2a4e6122f83<PASSWORD>7606f1a41152d<PASSWORD>0e5a11ac3749b3bfcf4407fc83ef60b4<PASSWORD>"

echo "==============================================="
echo "cleaning up"
echo "==============================================="
sync
sleep 10
{'fraction_non_alphanumeric': 0.2470824949698189, 'fraction_numerical': 0.03501006036217304, 'mean_word_length': 5.628, 'pattern_counts': {'":': 4, '<': 18, '<?xml version=': 0, '>': 32, 'https://': 6, 'lorem ipsum': 0, 'www.': 0, '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': '6862521', 'n_tokens_mistral': 1812, 'n_tokens_neox': 1665, 'n_words': 399}