forked from tuminoid/gitlab-installer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
install-gitlab.sh
executable file
·82 lines (63 loc) · 2.14 KB
/
install-gitlab.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
#!/usr/bin/env bash
# Copyright 2013-2014 Tuomo Tanskanen <[email protected]>
set -e
# Gitlab version to install
DEB="gitlab_7.6.2-omnibus.5.3.0.ci-1_amd64.deb"
DEB_MD5="50a10fa70cd1903b5390fd62767ff10b"
DEB_URL="https://downloads-packages.s3.amazonaws.com/ubuntu-14.04"
# This is for postfix
GITLAB_HOSTNAME="gitlab.invalid"
#
# Use provided gitlab.rb.example as base
#
[ ! -e /vagrant/gitlab.rb ] && { echo "error: gitlab.rb missing"; exit 1; }
#
# --------------------------------
# Installation - no need to touch!
# --------------------------------
#
export DEBIAN_FRONTEND=noninteractive
CACHE=/var/cache/generic
DOWNLOAD="$DEB_URL/$DEB"
check_for_root()
{
[[ $EUID = 0 ]] || { echo "error: need to be root" && exit 1; }
}
download_package()
{
mkdir -p "$CACHE" && cd "$CACHE"
if [[ -e "$DEB" ]] && [[ $(md5sum "$DEB" | cut -f1 -d " ") = $DEB_MD5 ]]; then
echo "Package has been downloaded previously, using cached binary."
else
[[ -e "$DEB" ]] && rm -f "$DEB" && echo "Package hash does not match, re-downloading."
echo "Executing: wget -nc -q $DOWNLOAD"
fi
wget -nc -q $DOWNLOAD
if [[ $(md5sum $DEB | cut -f1 -d " ") != $DEB_MD5 ]]; then
echo "error: Package hash is still not valid, exiting ..."
exit 1
fi
}
# All commands expect root access.
check_for_root
# install tools to automate this install
apt-get -y update
apt-get -y install debconf-utils wget
# install the few dependencies we have
echo "postfix postfix/main_mailer_type select Internet Site" | debconf-set-selections
echo "postfix postfix/mailname string $GITLAB_HOSTNAME" | debconf-set-selections
apt-get -y install openssh-server postfix
# generate ssl keys
apt-get -y install ssl-cert
make-ssl-cert generate-default-snakeoil --force-overwrite
# download omnibus-gitlab package (250M) and cache it
echo "Downloading Gitlab package. This may take a while ..."
download_package
dpkg -i $CACHE/$DEB
# fix the config and reconfigure
cp /vagrant/gitlab.rb /etc/gitlab/gitlab.rb
gitlab-ctl reconfigure
# done
echo "Done!"
echo " Login at your host:port with 'root' + '5iveL!fe'"
echo " Config found at /etc/gitlab/gitlab.rb and updated by 'gitlab-ctl reconfigure'"