1
1
#! /bin/bash
2
2
3
+ function pause(){
4
+ read -p " Press [Enter] key to continue..."
5
+ }
6
+
3
7
if [ $( id -u) -gt 0 ] ; then
4
8
echo " Use sudo $0 "
5
9
exit 1
@@ -14,12 +18,14 @@ HOSTIP=$(hostname -I | awk '{print $1}' )
14
18
15
19
echo " ########################################################################"
16
20
echo " Verify your hostname and the ip is correct, if this is wrong the "
17
- echo " container network ist not able to lookup the host $( hostname) by name "
21
+ echo " container network ist not able to lookup the host \" $( hostname) \" by name "
18
22
echo " it's a docker-Feature !!"
19
23
echo " the \" routing \" ist out of container an back into the nginx and forward to container:-) "
20
24
echo " and 8.8.8.8 (Google Nameserver) does not known your internal hostname "
21
25
echo " ########################################################################"
22
26
27
+ pause
28
+
23
29
read -e -p " Your hostname (hit return if $HOSTNAME is correct) : " -i $HOSTNAME GIVEN_HOSTNAME
24
30
echo " Setting HOSTNAME to $GIVEN_HOSTNAME "
25
31
HOSTNAME=$GIVEN_HOSTNAME
@@ -31,19 +37,32 @@ read -e -p "Your hostIP : " -i $HOSTIP GIVEN_HOSTIP
31
37
HOSTIP=$GIVEN_HOSTIP
32
38
echo " Setting HOSTIP to $GIVEN_HOSTIP "
33
39
echo " "
34
- echo " Number of plugins to download for Jenkins (S)uggessted (72 Plugin)"
35
- echo " (M)uch more (146 Plugins)"
40
+ echo " Choose your weapons: Number of plugins to download for Jenkins "
41
+ echo " (L)et _ME_ choose (0 Plugins)"
42
+ echo " (S)uggested (72 Plugins)"
43
+ echo " (M)uch more (146 Plugins)"
36
44
PLUGINS=S
37
45
read -e -p " Choose S or M : " -i $PLUGINS GIVEN_PLUGINS
38
- if [ " $GIVEN_PLUGINS " == " S" ] ; then
39
- echo " using suggested plugins"
40
- cp jenkins-fat/suggested-plugins.txt jenkins-fat/active-plugins.txt
41
- else
42
- echo " using a lot lot lot of more plugins"
43
- cp jenkins-fat/max-plugins.txt jenkins-fat/active-plugins.txt
44
- fi
46
+
47
+ case $GIVEN_PLUGINS in
48
+ " L" )
49
+ echo " Choose your own weapons (Jenkins will ask...you choose)"
50
+ > jenkins-fat/active-plugins.txt
51
+ ;;
52
+ " S" )
53
+ echo " Jenkins will ask you, just say OK to use suggested plugins"
54
+ cp jenkins-fat/suggested-plugins.txt jenkins-fat/active-plugins.txt
55
+ ;;
56
+ " M" )
57
+ echo " Jenkins will ask you, just say OK to use tons of plugins"
58
+ cp jenkins-fat/max-plugins.txt jenkins-fat/active-plugins.txt
59
+ ;;
60
+ esac
61
+
45
62
chmod a+rw jenkins-fat/active-plugins.txt
46
63
64
+ pause
65
+
47
66
type openssl 2> /dev/null
48
67
if [ $? -eq 0 ] ; then
49
68
echo " openssl installed :-)"
@@ -61,7 +80,9 @@ mkdir -p $USER_DATA_DIR/nexus
61
80
chown -R 200 $USER_DATA_DIR /nexus
62
81
# ----------------------------------
63
82
64
- echo " Create a self-signed certificate for your host: $HOSTNAME to "
83
+ echo " Create a self-signed certificate for your host: $HOSTNAME to prevent docker complaining unsecure (gitlab) registry "
84
+ pause
85
+
65
86
if [ -f $USER_DATA_DIR /gitlab/config/ssl/$( hostname) .key ]; then
66
87
FILE_NAME=$USER_DATA_DIR /gitlab/config/ssl/$( hostname) .key-$( date +" %F-%H-%M-%S-%N" )
67
88
cp $USER_DATA_DIR /gitlab/config/ssl/$( hostname) .key $USER_DATA_DIR /gitlab/config/ssl/$( hostname) .key-$( date +" %F-%H-%M-%S-%N" )
@@ -83,6 +104,7 @@ if [ $? -eq 0 ] ;then
83
104
echo " ----------- Your certificate used by Gitlab docker-registry@${HOSTNAME} -------------------"
84
105
openssl x509 -in $USER_DATA_DIR /gitlab/config/ssl/$( hostname) .crt -text | head -15
85
106
echo " -------------------------------------------------------------------------------------------"
107
+ pause
86
108
else
87
109
echo " NO CERT GENERATED "
88
110
exit 1
@@ -111,27 +133,32 @@ cat .env.template > .env
111
133
echo " DC_HOSTNAME=${HOSTNAME} " >> .env
112
134
echo " DC_HOSTIP=${HOSTIP} " >> .env
113
135
echo " DC_BASE_DATA_DIR=${USER_DATA_DIR} " >> .env
114
- echo " ---------- genarated file ---------------------------- "
136
+ echo " ---------- generated file ---------------------------- "
115
137
cat .env
116
138
echo " -------------------------------------------------------------------------------------------"
117
-
118
- # sed s#BASE_DATA_DIR#${USER_DATA_DIR}#g docker-compose.yml.template > docker-compose.yml
119
- # sed -i s#HOSTIP#${HOSTIP}#g docker-compose.yml
120
- # sed -i s#HOSTNAME#${HOSTNAME}#g docker-compose.yml
121
-
122
- # Gitlabrunner needs extra_hosts to clone stuff via (outside) hostname
123
- # sed -i s#HOSTNAME#${HOSTNAME}#g gitlabrunner/entrypointAutoregister
124
- # sed -i s#HOSTIP#${HOSTIP}#g gitlabrunner/entrypointAutoregister
139
+ echo " If something changed (your IP / hostname ... ) just edit the .env or rerun the script."
125
140
126
141
echo " -------------------------------------------------------------------------------------------"
127
142
echo " -------------------------------------------------------------------------------------------"
128
- echo " Evironment for docker-compose.yml created"
129
- echo " run "
130
- echo " docker-compose up --build -d "
131
- echo " docker-compose logs -f"
143
+ echo " Environment for docker-compose.yml created"
144
+ echo " "
132
145
echo " use the following URL"
133
146
BASE_URL=" http://" $( hostname) " /"
134
147
echo " Jenkins: ${BASE_URL} jenkins"
135
148
# # echo "Sonar : ${BASE_URL}sonar"
136
149
echo " Nexus : ${BASE_URL} nexus"
137
150
echo " Gitlab : ${BASE_URL} gitlab"
151
+ echo " Feel free to provide push-requests :-)"
152
+ pause
153
+ echo " "
154
+
155
+ echo " Setup finished, just type the following commands to start and see the logs of your environment"
156
+ echo " docker-compose up --build -d "
157
+ echo " docker-compose logs -f"
158
+
159
+
160
+
161
+
162
+
163
+
164
+
0 commit comments