11#! /bin/bash
22
3+ function pause(){
4+ read -p " Press [Enter] key to continue..."
5+ }
6+
37if [ $( id -u) -gt 0 ] ; then
48 echo " Use sudo $0 "
59 exit 1
@@ -14,12 +18,14 @@ HOSTIP=$(hostname -I | awk '{print $1}' )
1418
1519echo " ########################################################################"
1620echo " 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 "
1822echo " it's a docker-Feature !!"
1923echo " the \" routing \" ist out of container an back into the nginx and forward to container:-) "
2024echo " and 8.8.8.8 (Google Nameserver) does not known your internal hostname "
2125echo " ########################################################################"
2226
27+ pause
28+
2329read -e -p " Your hostname (hit return if $HOSTNAME is correct) : " -i $HOSTNAME GIVEN_HOSTNAME
2430echo " Setting HOSTNAME to $GIVEN_HOSTNAME "
2531HOSTNAME=$GIVEN_HOSTNAME
@@ -31,19 +37,32 @@ read -e -p "Your hostIP : " -i $HOSTIP GIVEN_HOSTIP
3137HOSTIP=$GIVEN_HOSTIP
3238echo " Setting HOSTIP to $GIVEN_HOSTIP "
3339echo " "
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)"
3644PLUGINS=S
3745read -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+
4562chmod a+rw jenkins-fat/active-plugins.txt
4663
64+ pause
65+
4766type openssl 2> /dev/null
4867if [ $? -eq 0 ] ; then
4968 echo " openssl installed :-)"
@@ -61,7 +80,9 @@ mkdir -p $USER_DATA_DIR/nexus
6180chown -R 200 $USER_DATA_DIR /nexus
6281# ----------------------------------
6382
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+
6586if [ -f $USER_DATA_DIR /gitlab/config/ssl/$( hostname) .key ]; then
6687 FILE_NAME=$USER_DATA_DIR /gitlab/config/ssl/$( hostname) .key-$( date +" %F-%H-%M-%S-%N" )
6788 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
83104 echo " ----------- Your certificate used by Gitlab docker-registry@${HOSTNAME} -------------------"
84105 openssl x509 -in $USER_DATA_DIR /gitlab/config/ssl/$( hostname) .crt -text | head -15
85106 echo " -------------------------------------------------------------------------------------------"
107+ pause
86108else
87109 echo " NO CERT GENERATED "
88110 exit 1
@@ -111,27 +133,32 @@ cat .env.template > .env
111133echo " DC_HOSTNAME=${HOSTNAME} " >> .env
112134echo " DC_HOSTIP=${HOSTIP} " >> .env
113135echo " DC_BASE_DATA_DIR=${USER_DATA_DIR} " >> .env
114- echo " ---------- genarated file ---------------------------- "
136+ echo " ---------- generated file ---------------------------- "
115137cat .env
116138echo " -------------------------------------------------------------------------------------------"
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."
125140
126141echo " -------------------------------------------------------------------------------------------"
127142echo " -------------------------------------------------------------------------------------------"
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 " "
132145echo " use the following URL"
133146BASE_URL=" http://" $( hostname) " /"
134147echo " Jenkins: ${BASE_URL} jenkins"
135148# # echo "Sonar : ${BASE_URL}sonar"
136149echo " Nexus : ${BASE_URL} nexus"
137150echo " 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