blob: e94ebe9e96814bbd48bf6e3e0f94aef79a577792 (
plain)
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
|
#!/bin/bash
cd /vagrant
grunt sync less requirejs
update-rc.d openidm defaults
service varnish restart
if [ -e "/vagrant/vagrant_scripts/awsconfig" ]
then
apt-get --yes --force-yes install awscli
mkdir -p ~/.aws
cp -R /vagrant/vagrant_scripts/awsconfig ~/.aws/config
chmod 600 ~/.aws/config
aws elb register-instances-with-load-balancer --load-balancer-name sqlfiddle-web --instances `ec2metadata --instance-id`
#########################################
cat << REBOOTCLEAN > ~/reboot-clean.sh
#!/bin/sh
# 1) Note that I've named the load-balancer sqlfiddle-web in my AWS config
# 2) This command de-registers this instance from the load balancer
aws elb deregister-instances-from-load-balancer --load-balancer-name sqlfiddle-web --instances `ec2metadata --instance-id`
service openidm stop
reboot
REBOOTCLEAN
#########################################
chmod +x ~/reboot-clean.sh
#########################################
cat << DELAYEDSTARTUP > /etc/rc.local
#!/bin/sh
# five minutes should be enough time for the system to be ready to start processing requests
sleep 300
aws elb register-instances-with-load-balancer --load-balancer-name sqlfiddle-web --instances `ec2metadata --instance-id`
exit 0
DELAYEDSTARTUP
#########################################
fi
if [ -d "/vagrant/vagrant_scripts/openvpn" ]
then
apt-get --yes --force-yes install openvpn
cp /vagrant/vagrant_scripts/openvpn/* /etc/openvpn
echo "192.168.199.2 POSTGRESQL84_HOST" >> /etc/hosts
echo "192.168.199.3 POSTGRESQL92_HOST" >> /etc/hosts
echo "192.168.199.4 MYSQL51_HOST" >> /etc/hosts
echo "192.168.199.5 POSTGRESQL94_HOST" >> /etc/hosts
echo "192.168.199.6 MYSQL57_HOST" >> /etc/hosts
echo "192.168.199.7 POSTGRESQL91_HOST" >> /etc/hosts
service openvpn restart
fi
service openidm start
|