Skip to content

Commit e9169f6

Browse files
committed
Massive refactoring and adding portainer
1 parent 1821565 commit e9169f6

File tree

19 files changed

+98
-586
lines changed

19 files changed

+98
-586
lines changed

README.md

Lines changed: 20 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,9 @@ My personal solution is a local, docker-based CI/CD Build Environment ready in a
1414
* push with ssh avialable at port 2222
1515
* Nexus 3
1616
* Sonar
17-
* Keykloak (as Single Sign On or JWT playground)
1817
* Postgres (used by Sonar, Keycloak and YOUR applications)
19-
* Standard Docker-Registry V2 with a simple UI
20-
21-
18+
* Standard Docker-Registry V2 with a simple UI
19+
* Portainer
2220

2321
so you can be your own local "DevOp"; nearly every category of [periodic table of devoptools][4] has one tool in your local setup.
2422

@@ -46,6 +44,16 @@ so you can be your own local "DevOp"; nearly every category of [periodic table o
4644
If your change the ports in the docker-compose.yml change them also in nginx-reverse/nginx.conf (stream {...} )
4745
## Installation
4846

47+
### First use ./setupEnvironment.sh
48+
49+
The ./setupEnvironment.sh
50+
* configures your settings and generates a .env File used by docker-compose
51+
* copies some configuration File to your local directory
52+
* Donloads all the Jenkins-Plugins to jenkins-fat/Plugins directory to save time.
53+
* generates ssl-keys and certificates to use with git clone and the docker registry
54+
55+
56+
4957
Bring up your own DevOp Playground ... just do a
5058

5159
### micro setup (GitLab,GitLab-runner) takes 4GiB
@@ -68,33 +76,14 @@ starts 3 container
6876
```
6977
starts 6 container
7078

71-
### medium setup without sonar (same like above and with Docker-Registry and simple Docker-Registry-UI) takes 8GiB
79+
### standard setup (same like above with portainer, sonar, Docker-Registry and simple Docker-Registry-UI) takes 10GiB
7280
```
7381
git clone https://github.com/Springjunky/docker-local-build-environment.git
7482
cd docker-local-build-environment
7583
sudo ./setupEnvironment.sh
7684
docker-compose --build -d
7785
docker-compose logs
7886
```
79-
starts 8 container
80-
81-
### maximum setup (same like above and with Sonar and Keycloak) takes more than 10GiB
82-
```
83-
git clone https://github.com/Springjunky/docker-local-build-environment.git
84-
cd docker-local-build-environment
85-
sudo ./setupEnvironment.sh
86-
87-
# Sonar only
88-
docker-compose -f docker-compose.yml -f docker-compose-sonar.yml up --build
89-
90-
# Sonar AND Keycloak
91-
docker-compose -f docker-compose.yml -f docker-compose-sonar.yml -f docker-compose-keycloak.yml up --build
92-
93-
# Keycloak only
94-
docker-compose -f docker-compose.yml -f docker-compose-keycloak.yml up --build
95-
96-
docker-compose logs
97-
```
9887
starts 10 container
9988

10089
### The first startup takes a long time (especially gitlab), so be patient
@@ -109,12 +98,11 @@ Now you are ready to go with a little CI/CD Environment:
10998
Nexus http://<your-host-name>/nexus
11099
Gitlab http://<your-host-name>/gitlab
111100
Sonar http://<your-host-name>/sonar
112-
Keycloak http://<your-host-name>/auth
101+
Portainer http://<your-host-name>/portainer
113102
Docker-Registry-Ui: http://<your-host-name>/regweb
114103
Postgres: At standard listenport 5432 for your jdbc-connection-string
115104
stream-passthrough to postgres-container.
116105
```
117-
118106
#### Security
119107
... not really, its all http .. don't worry about it! It's only local communication
120108

@@ -128,56 +116,39 @@ See Readme in folder security-paranoia if you want to have some hints how to con
128116
|Nexus | admin | admin123 |
129117
|Gitlab | root | gitlab4me |
130118
|Sonar | admin | admin |
131-
|Keycloak|admin|admin|
132119
|Postgres|postgres|admin|
133120

134121
## The Tools
135122
There are some configurations you have to do after setup.
136123
*Remember:* At every time use your real hostname and NOT localhost (locahost inside a container is the container itself).
137-
For example: If yuo configure a GitLab-Connection in Jenkins, you will reach Gitlab at http://&lt;you host&gt;/gitlab and not http://localhost/gitlab
124+
125+
For example: If you configure a GitLab-Connection in Jenkins, you will reach Gitlab at http://&lt;your host&gt;/gitlab and not http://localhost/gitlab
138126
### Jenkins
139127
* MAVEN_HOME is /opt/maven
140128
* JAVA_HOME is /usr/lib/jvm/java-8-openjdk-amd64
141-
* Blue Ocean is installed if you choose (M)uch mor plugins and works perfect with a GitHUB Account, not GitLab ... sorry, this is Jenkins.
142-
You need to be logged as a jenkins-user to use Blue Ocean
143129

144-
### Giltab
130+
### GitLab
145131
* the docker-registry from GitLab is at port 5555 (and secured with an openssl certificate ..thats part of
146132
setupEnvironment.sh), just create a project in gitlab and click at the registry tab to show
147133
how to login to the project registry and how to tag your images and upload them.
148134
* ssh cloning and pushing is at port 2222 (ssh://git@myHOST:2222/scott/foo.git remeber to upload your public key before, should be ~/.ssh/id_rsa.pub )
135+
* http cloning and pushing is only http NOT https
149136

150137
#### gitlab-runner
151-
The runner is a gitlab-multirunner image with a docker-runner (concurrent=1) , based on [gitlab/gitlab-runner][2] at every startup any runner is removed and only ONE new runner
152-
is registrated to avoid multiple runners (the pipeline-history maybe lost.)
138+
The runner is a gitlab-multirunner image with a docker-runner (concurrent=1) , based on [gitlab/gitlab-runner][2] at every startup any runner is removed
139+
and only ONE new runner is registrated to avoid multiple runners (the pipeline-history maybe lost.)
153140
setups with a shell-runner works, docker-in-docker (docker:dind) or docker based builds should cause trouble because the
154141
default DNS-Server of a docker-container ist 8.8.8.8 (google) see this link [extra_host for servce][5] for a possible workaround
155142

156143
It takes a long time until gitlab is ready to accept a runner registration, if it fails, increase the REGISTER_TRYS in docker-compse.yml
157144

158-
159145
#### Jenkins and Gitlab
160146

161147
Gitlab is very very fast with new releases and sometimes the api has breaking changes. If something does not work take a look at the Jenkins Bugtracker.
162148

163149
### Sonar
164150
You need to install some rules (Administration - System - Update Center - Available - Search: Java)
165151

166-
### Keycloak
167-
There is a testproject in folder spring-boot-keycloak-sample, it is a standard Spring-Boot which you can start with
168-
```
169-
mv spring-boot:run
170-
```
171-
Use your browser and navigate to the "landing-page" at http://your-host:8081 the "My products" link will redirect you to Keycloak (must be setup with settings from [this tutorial][3], but use your *REAL* hostname, not _localhost_ as Valid Redirect URI's )
172-
173-
_tl;dr_
174-
* login as user:admin, password:admin
175-
* create realm "springboot"
176-
* create client "product-app" as openid-connect client with Valid Redirect URI's http://&lt;your host&gt;:8081/*
177-
* create role "user"
178-
* create user "testuser" and map the role "user" to testuser (tab Role Mappings)
179-
180-
181152
### Postgres
182153
You can use any tool to connect to the database at localhost:5432 this is a pass through to the container so any
183154
JDBC-Connection should work
@@ -212,9 +183,6 @@ every ping must work, if not, check the .env file, is there the correct DC_HOSTN
212183
##### consider low memory:
213184
with an amount lower than 8GB sonar and embedded eleastic search did not startup and no message is displayed
214185

215-
##### too many plugins to download:
216-
You can do an "pre download of the plugins", see the readme.md at jenkins-fat direcory
217-
218186

219187
## Starting from scratch
220188
To delete everything an start from scratch (own risk, you will lost all your setting projects and data)

docker-compose-keycloak.yml

Lines changed: 0 additions & 28 deletions
This file was deleted.

docker-compose-micro-ci.yml

Lines changed: 0 additions & 80 deletions
This file was deleted.

docker-compose-minimal-ci.yml

Lines changed: 0 additions & 123 deletions
This file was deleted.

0 commit comments

Comments
 (0)