2014-09-02 17:29:04 +03:00
|
|
|
#!/bin/bash
|
|
|
|
|
2014-09-02 22:07:14 +03:00
|
|
|
# Provision script created for Ubuntu 14.04
|
2014-09-09 00:05:23 +03:00
|
|
|
|
2014-09-04 06:25:48 +03:00
|
|
|
APP_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
2014-09-02 17:29:04 +03:00
|
|
|
|
2014-09-09 00:05:23 +03:00
|
|
|
if [ -d "/vagrant" ]; then
|
|
|
|
# Control will enter here if $DIRECTORY exists.
|
|
|
|
APP_DIR="/vagrant"
|
2014-09-18 18:13:33 +03:00
|
|
|
fi
|
2014-09-09 00:05:23 +03:00
|
|
|
|
2014-09-02 17:29:04 +03:00
|
|
|
echo "Provisioning..."
|
2014-11-12 01:06:28 +02:00
|
|
|
|
|
|
|
if ! type "add-apt-repository" > /dev/null; then
|
|
|
|
sudo apt-get update
|
|
|
|
sudo apt-get install -y software-properties-common python-software-properties
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Elastic Search
|
2015-10-15 01:36:22 +03:00
|
|
|
# wget -qO - http://packages.elasticsearch.org/GPG-KEY-elasticsearch | sudo apt-key add -
|
|
|
|
# echo 'deb http://packages.elasticsearch.org/elasticsearch/1.4/debian stable main' | sudo tee /etc/apt/sources.list.d/elastic.list
|
2014-11-12 01:06:28 +02:00
|
|
|
|
2014-09-09 00:05:23 +03:00
|
|
|
sudo add-apt-repository -y ppa:chris-lea/node.js
|
|
|
|
sudo apt-get update
|
2014-11-12 01:06:28 +02:00
|
|
|
|
2014-10-07 00:07:20 +03:00
|
|
|
sudo apt-get install -y python build-essential pkg-config git \
|
2015-10-15 01:36:22 +03:00
|
|
|
python-pip python-virtualenv python-dev zlib1g-dev libldap2-dev libsasl2-dev \
|
2015-11-07 06:05:02 +02:00
|
|
|
libffi-dev libyaml-dev libssl-dev libldap2-dev libsasl2-dev nodejs
|
2014-11-12 01:06:28 +02:00
|
|
|
|
|
|
|
# Create swap file because ES eats up RAM and 14.04 doesn't have swap by default
|
|
|
|
sudo fallocate -l 1G /swapfile
|
|
|
|
sudo chmod 600 /swapfile
|
|
|
|
sudo mkswap /swapfile
|
|
|
|
sudo swapon /swapfile
|
2015-07-31 17:12:33 +03:00
|
|
|
sudo su -c "echo '/swapfile none swap sw 0 0' >> /etc/fstab"
|
2014-09-02 17:29:04 +03:00
|
|
|
|
2014-10-29 22:06:54 +02:00
|
|
|
# lxml deps
|
|
|
|
# libxml2-dev libxslt1-dev
|
|
|
|
|
2014-09-02 17:29:04 +03:00
|
|
|
# Default cache is memoization
|
|
|
|
|
|
|
|
# Redis
|
|
|
|
# add-apt-repository -y chris-lea/redis-server
|
|
|
|
# add-apt-repository -y chris-lea/python-redis
|
|
|
|
# apt-get update
|
|
|
|
# apt-get install -y redis-server
|
|
|
|
|
|
|
|
# Default DB is sqlite
|
|
|
|
|
|
|
|
# Mysql
|
|
|
|
# apt-get install -y mysql-server mysql-client
|
|
|
|
|
|
|
|
# MariaDB
|
|
|
|
# apt-get install -y mariadb-server mariadb-client
|
|
|
|
|
|
|
|
# Postgres
|
|
|
|
# apt-get install -y postgresql postgresql-contrib
|
|
|
|
|
|
|
|
# Install frontend assets
|
2014-09-09 00:05:23 +03:00
|
|
|
sudo npm install -g bower
|
2014-09-02 17:29:04 +03:00
|
|
|
|
2014-11-07 00:28:19 +02:00
|
|
|
cd /home/vagrant
|
|
|
|
|
2014-10-24 06:22:30 +03:00
|
|
|
virtualenv .venv
|
|
|
|
source .venv/bin/activate
|
|
|
|
|
2014-11-07 00:28:19 +02:00
|
|
|
cd /vagrant
|
|
|
|
bower --config.interactive=false install
|
2014-10-24 06:22:30 +03:00
|
|
|
pip install -r requirements.txt
|
2014-09-02 17:29:04 +03:00
|
|
|
|
2014-09-08 20:49:37 +03:00
|
|
|
echo "Installing start scripts"
|
2014-10-24 06:22:30 +03:00
|
|
|
|
2014-11-07 00:28:19 +02:00
|
|
|
cat << EOF > /tmp/realms-wiki
|
2014-09-19 07:12:57 +03:00
|
|
|
#!/bin/bash
|
2014-11-07 00:28:19 +02:00
|
|
|
/home/vagrant/.venv/bin/realms-wiki "\$@"
|
2014-09-19 07:12:57 +03:00
|
|
|
EOF
|
|
|
|
|
2014-11-07 00:28:19 +02:00
|
|
|
sudo mv /tmp/realms-wiki /usr/local/bin
|
|
|
|
|
2014-09-09 00:05:23 +03:00
|
|
|
sudo chmod +x /usr/local/bin/realms-wiki
|
2014-09-02 22:07:14 +03:00
|
|
|
|
2014-11-12 01:06:28 +02:00
|
|
|
sudo service elasticsearch start
|
|
|
|
|
2014-10-24 06:22:30 +03:00
|
|
|
realms-wiki start
|