Add telnet check to key server
[vvp/gitlab.git] / assets / setup
1 #!/bin/bash
2 # ============LICENSE_START=======================================================
3 # org.onap.vvp/gitlab
4 # ===================================================================
5 # Copyright © 2017 AT&T Intellectual Property. All rights reserved.
6 # ===================================================================
7 #
8 # Unless otherwise specified, all software contained herein is licensed
9 # under the Apache License, Version 2.0 (the “License”);
10 # you may not use this software except in compliance with the License.
11 # You may obtain a copy of the License at
12 #
13 #             http://www.apache.org/licenses/LICENSE-2.0
14 #
15 # Unless required by applicable law or agreed to in writing, software
16 # distributed under the License is distributed on an "AS IS" BASIS,
17 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18 # See the License for the specific language governing permissions and
19 # limitations under the License.
20 #
21 #
22 #
23 # Unless otherwise specified, all documentation contained herein is licensed
24 # under the Creative Commons License, Attribution 4.0 Intl. (the “License”);
25 # you may not use this documentation except in compliance with the License.
26 # You may obtain a copy of the License at
27 #
28 #             https://creativecommons.org/licenses/by/4.0/
29 #
30 # Unless required by applicable law or agreed to in writing, documentation
31 # distributed under the License is distributed on an "AS IS" BASIS,
32 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
33 # See the License for the specific language governing permissions and
34 # limitations under the License.
35 #
36 # ============LICENSE_END============================================
37 #
38 # ECOMP is a trademark and service mark of AT&T Intellectual Property.
39
40 set -xe
41
42 source /RELEASE
43
44 # Download & Install GitLab
45 echo "deb https://packages.gitlab.com/gitlab/${PACKAGECLOUD_REPO}/ubuntu/ `lsb_release -cs` main" > /etc/apt/sources.list.d/gitlab_${RELEASE_PACKAGE}.list
46
47
48 echo "####################################################"
49 echo "[DBG] Test connection to https://packages.gitlab.com"
50 echo "####################################################"
51
52
53 echo "################  IFCONFIG  #######################"
54 sudo ifconfig
55
56 echo "################  TELNET  #######################"
57
58 telnet packages.gitlab.com 443
59
60 echo "################  CURL  #######################"
61
62 curl -v https://packages.gitlab.com/gpg.key
63
64 echo "####################################################"
65
66 wget -q -O - https://packages.gitlab.com/gpg.key | apt-key add -
67 apt-get update
68 apt-get install -yq --no-install-recommends ${RELEASE_PACKAGE}=${RELEASE_VERSION}
69
70 # Create sshd daemon
71 mkdir -p /opt/gitlab/sv/sshd/supervise /opt/gitlab/sv/sshd/log/supervise
72 mkfifo /opt/gitlab/sv/sshd/supervise/ok /opt/gitlab/sv/sshd/log/supervise/ok
73 printf "#!/bin/sh\nexec 2>&1\numask 077\nexec /usr/sbin/sshd -D -f /assets/sshd_config -e" > /opt/gitlab/sv/sshd/run
74 printf "#!/bin/sh\nexec svlogd -tt /var/log/gitlab/sshd" > /opt/gitlab/sv/sshd/log/run
75 chmod a+x /opt/gitlab/sv/sshd/run /opt/gitlab/sv/sshd/log/run
76 mkdir -p /var/run/sshd
77
78 # Remove current gitlab.rb file
79 rm -f /etc/gitlab/gitlab.rb
80
81 # Patch omnibus package
82 patch -p0 -d /opt/gitlab < /assets/gitlab-rb-location.patch
83
84 # Create groups
85 groupadd -g 998 git
86 groupadd -g 999 gitlab-www
87 groupadd -g 997 gitlab-redis
88 groupadd -g 996 gitlab-psql
89 # groupadd -g 995 gitlab-ci
90 groupadd -g 994 mattermost
91
92 # Create accounts
93 useradd -m -u 998 -g git -m -s /bin/sh -d /var/opt/gitlab git
94 useradd -m -u 999 -g gitlab-www -m -s /bin/false -d /var/opt/gitlab/nginx gitlab-www
95 useradd -m -u 997 -g gitlab-redis -m -s /bin/nologin -d /var/opt/gitlab/redis gitlab-redis
96 useradd -m -u 996 -g gitlab-psql -m -s /bin/sh -d /var/opt/gitlab/postgresql gitlab-psql
97 # useradd -m -u 995 -g gitlab-ci -m -s /bin/sh -d /var/opt/gitlab/gitlab-ci gitlab-ci
98 useradd -m -u 994 -g mattermost -m -s /bin/sh -d /var/opt/gitlab/mattermost mattermost
99
100 # Useful for intraction with api in wrapper
101 /opt/gitlab/embedded/bin/pip install requests