<commit_before>#!/bin/bash

# exit on any error
set -e
set -x 

usage() { echo "Usage: $0 [-p to use try.pixelated-project.org defaults]" 1>&2; exit 1; }

USE_PIXELATED_DEFAULTS=
while getopts "hp" OPT; do
	case $OPT in
		p)
			USE_PIXELATED_DEFAULTS=1
			;;
		*)
			usage
			;;
	esac
done
shift $((OPTIND-1))

LEAP_OPTS=''
LEAP_CONFIG='/home/leap/configuration/'

echo "==============================================="
echo "configuring leap"
echo "==============================================="
sudo mkdir -p $LEAP_CONFIG
ME=$USER
sudo chown $ME $LEAP_CONFIG
cd $LEAP_CONFIG

if [ -n "$USE_PIXELATED_DEFAULTS" ] ; then
	leap $LEAP_OPTS new --contacts <EMAIL> --domain try.pixelated-project.org --name LEAP_Example --platform=/home/leap/leap_platform .
else
	leap $LEAP_OPTS new --platform=/home/leap/leap_platform .
fi
echo -e '\n@log = "/var/log/leap/deploy.log"' >> Leapfile
sudo mkdir -p /var/log/leap
ssh-keygen -f ~/.ssh/id_rsa -P ""
sudo mkdir -p /root/.ssh
sudo sh -e -c "cat $HOME/.ssh/id_rsa.pub >> /root/.ssh/authorized_keys"
mkdir -p $LEAP_CONFIG/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 $LEAP_OPTS add-user --self
leap $LEAP_OPTS cert ca
leap $LEAP_OPTS cert csr
leap $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 $LEAP_OPTS compile

git config --global user.email "<EMAIL>"
git config --global user.name "Pixelated CI"
git init
git add .
git commit -m"configured provider"

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

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

leap $LEAP_OPTS -v 2 deploy
if [ $? -eq 1 ]; then
  echo "deploy failed"
  exit 1<commit_msg>use plain couchdb 1.6 instead of bigcouch<commit_after>#!/bin/bash

# exit on any error
set -e
set -x 

usage() { echo "Usage: $0 [-p to use try.pixelated-project.org defaults]" 1>&2; exit 1; }

USE_PIXELATED_DEFAULTS=
while getopts "hp" OPT; do
	case $OPT in
		p)
			USE_PIXELATED_DEFAULTS=1
			;;
		*)
			usage
			;;
	esac
done
shift $((OPTIND-1))

LEAP_OPTS=''
LEAP_CONFIG='/home/leap/configuration/'

echo "==============================================="
echo "configuring leap"
echo "==============================================="
sudo mkdir -p $LEAP_CONFIG
ME=$USER
sudo chown $ME $LEAP_CONFIG
cd $LEAP_CONFIG

if [ -n "$USE_PIXELATED_DEFAULTS" ] ; then
	leap $LEAP_OPTS new --contacts <EMAIL> --domain try.pixelated-project.org --name LEAP_Example --platform=/home/leap/leap_platform .
else
	leap $LEAP_OPTS new --platform=/home/leap/leap_platform .
fi
echo -e '\n@log = "/var/log/leap/deploy.log"' >> Leapfile
sudo mkdir -p /var/log/leap
ssh-keygen -f ~/.ssh/id_rsa -P ""
sudo mkdir -p /root/.ssh
sudo sh -e -c "cat $HOME/.ssh/id_rsa.pub >> /root/.ssh/authorized_keys"
mkdir -p $LEAP_CONFIG/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 $LEAP_OPTS add-user --self
leap $LEAP_OPTS cert ca
leap $LEAP_OPTS cert csr
leap $LEAP_OPTS node add pixelated ip_address:"$(facter ipaddress)"  services:webapp,mx,couchdb,soledad,monitor couch.master:true couch.pwhash_alg:pbkdf2 tags:production

echo '{ "webapp": { "admins": ["testadmin"] } }' > services/webapp.json

leap $LEAP_OPTS compile

git config --global user.email "<EMAIL>"
git config --global user.name "<NAME>"
git init
git add .
git commit -m"configured provider"

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

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

leap $LEAP_OPTS -v 2 deploy
if [ $? -eq 1 ]; then
  echo "deploy failed"
  exit 1
{'fraction_non_alphanumeric': 0.1791081547179108, 'fraction_numerical': 0.007144616900714462, 'mean_word_length': 4.178571428571429, 'pattern_counts': {'":': 4, '<': 8, '<?xml version=': 0, '>': 24, 'https://': 2, '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': '7195817', 'n_tokens_mistral': 1620, 'n_tokens_neox': 1533, 'n_words': 410}