-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdeploy.sh
108 lines (75 loc) · 2.16 KB
/
deploy.sh
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
105
106
107
108
#!/bin/bash
PACKAGES_REQ="python-pip python-dev git"
## 111
#### update 1111 2222
show() {
echo -e "\n\e[1;32m>>> $1\e[00m"
}
gpuf () {
# git pull -f $1
remote=${1:?"need remote to force pull from"}
current_branch=$(git symbolic-ref -q HEAD)
current_branch=${current_branch##refs/heads/}
current_branch=${current_branch:-HEAD}
if [ $current_branch = 'HEAD' ] ; then
echo
echo "On a detached head. Exiting..."
exit 1
fi
git fetch $remote $current_branch
git reset --hard FETCH_HEAD
git clean -df
}
app_start() {
a2enmod rewrite #enable mod rewrite for pnp4nagios
/etc/init.d/cron start
/etc/init.d/mysql start
/etc/init.d/apache2 start
/etc/init.d/openbsd-inetd start
/etc/init.d/ssh start
chmod -v -R a+rwx /var/www/bartlby-ui
chmod a+rwx /opt/bartlby/etc/bartlby.cfg
rm /var/www/bartlby-ui/setup.php
/opt/bartlby/bin/bartlby /opt/bartlby/etc/bartlby.cfg
mkdir /opt/bartlby/patches/
while ( true ) do
sleep 10
done
}
system_version() {
echo "FIXME";
#cd /usr/local/src/
#cd bartlby-core
#LOCAL_SHA=$(git rev-parse HEAD);
#CUR_SHA=$(wget -q -O /dev/stdout https://api.github.com/repos/Bartlby/bartlby-core/git/refs/heads/development/stage|grep sha|awk '{ gsub(/[,"]/, "", $2); print $2 }');
#if [ "$LOCAL_SHA" != "$CUR_SHA" ];
}
system_upgrade() {
apt-get clean && apt-get update
DEBIAN_FRONTEND=noninteractive apt-get install -y $PACKAGES_REQ
pip install ansible
if [ ! -d /usr/local/src/bartlby-ansible ];
then
cd /usr/local/src
git clone https://github.com/Bartlby/bartlby-ansible
fi
show "updating ansible roles/playbooks"
cd /usr/local/src/bartlby-ansible/
git stash
git checkout master
git stash
gpuf origin
echo "[local]" > local
echo "localhost" >> local
ansible-galaxy install geerlingguy.apache
ansible-galaxy install geerlingguy.php-pecl
ansible-galaxy install geerlingguy.mysql
ansible-playbook -i local -c local playbooks/bartlby-devbox.yml
}
system_setup() {
show "Setting root password to 'bartlby'"
echo "root:bartlby" | chpasswd
system_upgrade
show "Congratulations your bartlby instance is up and running you have a core with all extensions"
}
$1