This repository has been archived by the owner on Dec 11, 2017. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
VagrantfilePublic
104 lines (86 loc) · 3.84 KB
/
VagrantfilePublic
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
# psi-turkey vm
# poldracklab
VAGRANTFILE_API_VERSION = "2"
$script = <<SCRIPT
if [ ! -d $HOME/miniconda2 ]
then
# install anaconda
wget http://repo.continuum.io/miniconda/Miniconda-latest-Linux-x86_64.sh -O miniconda.sh
chmod +x miniconda.sh
./miniconda.sh -b
echo "export PATH=$HOME/miniconda2/bin:\\$PATH" >> .bashrc
echo "export PATH=$HOME/miniconda2/bin:\\$PATH" >> .env
fi
# install python packages
$HOME/miniconda2/bin/conda update --yes conda
$HOME/miniconda2/bin/pip install setuptools
$HOME/miniconda2/bin/conda install --yes pip numpy scipy nose traits networkx
$HOME/miniconda2/bin/conda install --yes pandas
sudo apt-get update -y > /dev/null
sudo apt-get install -y --force-yes git-core
sudo apt-get install -y --force-yes build-essential libssl-dev libcurl4-gnutls-dev libexpat1-dev gettext unzip
sudo apt-get install -y --force-yes nginx
# Install expfactory
sudo apt-get install -y --force-yes libreadline6 libreadline6-dev
sudo apt-get install -y --force-yes libncurses-dev
$HOME/miniconda2/bin/pip install python-Levenshtein
$HOME/miniconda2/bin/pip install expfactory
# Psiturk
$HOME/miniconda2/bin/pip install psiturk
sudo pip install --upgrade requests
psiturk-setup-example
# Install postgresql (not tested)
sudo apt-get install -y --force-yes postgresql postgresql-contrib
sudo apt-get install -y --force-yes pgadmin3
sudo apt-get install -y --force-yes libpq-dev
sudo -u postgres psql -c "CREATE USER expfactory WITH PASSWORD 'expfactory';"
sudo -u postgres psql -c "CREATE DATABASE expfactory;"
$HOME/miniconda2/bin/pip install psycopg2
# Install MySQL
sudo debconf-set-selections <<< 'mysql-server mysql-server/root_password password expfactory'
sudo debconf-set-selections <<< 'mysql-server mysql-server/root_password_again password expfactory'
sudo apt-get install -y --force-yes libmysqlclient-dev
sudo apt-get install -y --force-yes mysql-server
$HOME/miniconda2/bin/pip install MySQL-python
sudo apt-get install -y --force-yes vim
sudo /etc/init.d/nginx start
# Install expfactory to generate everything else
mkdir -p $HOME/expfactory-build
if [ ! -d $HOME/expfactory-build/expfactory-python ]
then
git clone https://github.com/expfactory/expfactory-python.git $HOME/expfactory-build/expfactory-python
cd $HOME/expfactory-build/expfactory-python
$HOME/miniconda2/bin/pip install -r requirements.txt
$HOME/miniconda2/bin/python setup.py install
fi
# Download experiments, battery, vm, doc repos
sudo chmod u+x $HOME/expfactory-build/expfactory-python/script/download_repos.py
$HOME/miniconda2/bin/python $HOME/expfactory-build/expfactory-python/script/download_repos.py $HOME/expfactory-build
sudo mysql -uroot -pexpfactory < $HOME/expfactory-build/vm/script/createdb.sql
# Replace standard index.html with link to expfactory docs
sudo mv $HOME/expfactory-build/vm/static/index.html /var/www/nginx-default/index.html
#SUB_PSITURKBATTERY_SUB
SCRIPT
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.ssh.forward_x11 = true
config.vm.define :engine do |engine_config|
#engine_config.vm.box = "aws"
engine_config.vm.box_url = "https://github.com/mitchellh/vagrant-aws/raw/master/dummy.box"
engine_config.vm.hostname = 'expfactory-vm'
engine_config.vm.provider :aws do |aws, override|
aws.access_key_id = "AWS_ACCESS_KEY_ID"
aws.secret_access_key = "AWS_SECRET_ACCESS_KEY"
aws.keypair_name = "AWS_KEYPAIR_NAME"
aws.region = "us-west-2"
aws.ami = "ami-5189a661"
aws.instance_type = "t2.small"
aws.security_groups = "AWS_SECURITY_GROUP"
aws.iam_instance_profile_name = "IAM_INSTANCE_PROFILE_NAME"
aws.elastic_ip = ""
override.ssh.username = "ubuntu"
override.ssh.private_key_path = "AWS_PRIVATE_KEY_PATH"
override.nfs.functional = false
end
engine_config.vm.provision "shell", :privileged => false, inline: $script
end
end