-
Notifications
You must be signed in to change notification settings - Fork 8
/
install.sh
executable file
·49 lines (43 loc) · 1.49 KB
/
install.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
#!/bin/sh -e
##
# This script makes certain assumptions about your deployment of SimpleStatus
# 1) You are deploying to at least Ubuntu 12.04 LTS
# 2) the user running the script has nopasswd access to sudo
# 3) using upstart to manage the daemonizing
# This script should be viewed as a template for your own deployment and should
# not be run blindly
##
# Set up build directory
BLDIR=build
chdir $HOME
mkdir $BLDIR
git clone https://github.com/cdarwin/simple_status.git $BLDIR
chdir $BLDIR
export DIR=$(pwd)
##
# We know where generate_cert.go lives when installed from ppa
# but, if you want to find it yourself, uncomment the line below
# and use the $CRT variable in the build stage
#export CRT=$(sudo find / -name generate_cert.go)
##
# Install Go if it isn't already
if [ ! $(go version) ]; then
sudo /bin/sh -c 'echo "y" | add-apt-repository ppa:gophers/go'
sudo apt-get -yf update
sudo apt-get -yf install golang-stable
fi
##
# Build package, generate certs, and modify permissions
go build simple_status
#go build $CRT
go build /usr/lib/go/src/pkg/crypto/tls/generate_cert.go
./generate_cert
sudo chown :www-data key.pem
sudo chmod g+r key.pem
##
# This is just one way to deal changing the default configuration of the package
# we're using upstart here and setting some runtime flags
sed -i -e 's,TLS=,&"-ssl",' -e 's,PORT=,&"-p :9090",' -e 's,TOKEN=,&"-t foobarbaz",' \
-e "s,\(DIR=\).*,\1\"$DIR\"," simple_status
sudo cp simple_status.conf /etc/init/simple_status.conf
sudo start simple_status