-
Notifications
You must be signed in to change notification settings - Fork 62
/
Copy pathVagrantfile
59 lines (52 loc) · 1.28 KB
/
Vagrantfile
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
V_NAME="kimsufi-crawler"
Vagrant.configure(2) do |config|
config.vm.box = "ubuntu/trusty64"
config.ssh.forward_agent = true
config.vm.network "public_network"
config.vm.provision "shell", inline: $provision
config.vm.hostname = V_NAME
config.vm.provider "virtualbox" do |v|
v.name = V_NAME
v.memory = 2048
end
end
$provision = <<SCRIPT
# variables
HTML_PATH="/home/vagrant/html/"
HTML_FILE_NAME="kimsufi-crawler.html"
# install required packages
apt-get update
apt-get upgrade -y
apt-get install -y nginx git python python-pip
# nginx
mkdir -p $HTML_PATH
echo 'NOT AVAILABLE' > "$HTML_PATH/$HTML_FILE_NAME"
rm -f /etc/nginx/sites-enabled/default
cat << EOF > /etc/nginx/sites-enabled/kimsufi-crawler.conf
server {
listen 80;
server_name localhost;
root $HTML_PATH;
}
EOF
service nginx reload
# python
cd /vagrant
pip install --pre -r requirements.txt
chown -R vagrant:vagrant /home/vagrant/*
# conf
if [ ! -f config.json ]; then
cat << EOF > /vagrant/config.json
{
"servers": ["KS-2E"],
"region": "europe",
"notifier": "file",
"file_path": "$HTML_PATH/$HTML_FILE_NAME",
"crawler_interval": 8,
"request_timeout": 15
}
EOF
fi
echo '*************************************************************************'
ifconfig
SCRIPT