- update README.md

- updating Jenkinsfile-PROD
This commit is contained in:
Szakalakamaka
2020-11-19 17:05:26 +01:00
parent 64843a2a0e
commit 024485ace0
4 changed files with 75 additions and 33 deletions

40
.idea/workspace.xml generated
View File

@@ -108,7 +108,7 @@
<recent name="com.release11.klaus.service" />
</key>
</component>
<component name="RunManager" selected="JUnit.KlausServiceImplTest">
<component name="RunManager" selected="Application.KlausApplication">
<configuration name="KlausApplication" type="Application" factoryName="Application" temporary="true" nameIsGenerated="true">
<envs>
<env name="-Dspring.profiles.active" value="test" />
@@ -259,11 +259,11 @@
</list>
<recent_temporary>
<list>
<item itemvalue="Application.KlausApplication" />
<item itemvalue="JUnit.KlausServiceImplTest" />
<item itemvalue="JUnit.EventRepositoryImplTest" />
<item itemvalue="JUnit.KlausMvcControllerTest" />
<item itemvalue="JUnit.KlausControllerTest" />
<item itemvalue="Application.KlausApplication" />
</list>
</recent_temporary>
</component>
@@ -279,13 +279,6 @@
<option name="presentableId" value="Default" />
<updated>1598862102028</updated>
</task>
<task id="LOCAL-00073" summary="testing Jenkinsfile">
<created>1601386453295</created>
<option name="number" value="00073" />
<option name="presentableId" value="LOCAL-00073" />
<option name="project" value="LOCAL" />
<updated>1601386453295</updated>
</task>
<task id="LOCAL-00074" summary="testing jenkins docker">
<created>1601452178576</created>
<option name="number" value="00074" />
@@ -622,7 +615,14 @@
<option name="project" value="LOCAL" />
<updated>1605784900573</updated>
</task>
<option name="localTasksCounter" value="122" />
<task id="LOCAL-00122" summary="MessageDto instead of String in Event history">
<created>1605785256941</created>
<option name="number" value="00122" />
<option name="presentableId" value="LOCAL-00122" />
<option name="project" value="LOCAL" />
<updated>1605785256941</updated>
</task>
<option name="localTasksCounter" value="123" />
<servers />
</component>
<component name="UnknownFeatures">
@@ -730,38 +730,38 @@
<state x="549" y="167" key="FileChooserDialogImpl/0.0.1536.824/1920.0.1920.1160@0.0.1536.824" timestamp="1602662342585" />
<state x="2606" y="235" key="FileChooserDialogImpl/0.0.1536.824/1920.0.1920.1160@1920.0.1920.1160" timestamp="1604501503902" />
<state x="549" y="167" key="FileChooserDialogImpl/0.0.1536.824@0.0.1536.824" timestamp="1602147205037" />
<state width="1493" height="55" key="GridCell.Tab.0.bottom" timestamp="1605781988395">
<state width="1493" height="114" key="GridCell.Tab.0.bottom" timestamp="1605785217750">
<screen x="0" y="0" width="1536" height="824" />
</state>
<state width="1877" height="239" key="GridCell.Tab.0.bottom/-1920.0.1536.832/0.0.1920.1040@0.0.1920.1040" timestamp="1600275797041" />
<state width="1493" height="55" key="GridCell.Tab.0.bottom/0.0.1536.824/1920.0.1920.1040@0.0.1536.824" timestamp="1605781988395" />
<state width="1493" height="114" key="GridCell.Tab.0.bottom/0.0.1536.824/1920.0.1920.1040@0.0.1536.824" timestamp="1605785217750" />
<state width="1877" height="267" key="GridCell.Tab.0.bottom/0.0.1536.824/1920.0.1920.1040@1920.0.1920.1040" timestamp="1605721684342" />
<state width="1493" height="89" key="GridCell.Tab.0.bottom/0.0.1536.824/1920.0.1920.1160@0.0.1536.824" timestamp="1604916507124" />
<state width="1877" height="315" key="GridCell.Tab.0.bottom/0.0.1536.824/1920.0.1920.1160@1920.0.1920.1160" timestamp="1604501251887" />
<state width="1493" height="185" key="GridCell.Tab.0.bottom/0.0.1536.824@0.0.1536.824" timestamp="1605634220571" />
<state width="1493" height="55" key="GridCell.Tab.0.center" timestamp="1605781988395">
<state width="1493" height="114" key="GridCell.Tab.0.center" timestamp="1605785217749">
<screen x="0" y="0" width="1536" height="824" />
</state>
<state width="1877" height="239" key="GridCell.Tab.0.center/-1920.0.1536.832/0.0.1920.1040@0.0.1920.1040" timestamp="1600275797041" />
<state width="1493" height="55" key="GridCell.Tab.0.center/0.0.1536.824/1920.0.1920.1040@0.0.1536.824" timestamp="1605781988395" />
<state width="1493" height="114" key="GridCell.Tab.0.center/0.0.1536.824/1920.0.1920.1040@0.0.1536.824" timestamp="1605785217749" />
<state width="1877" height="267" key="GridCell.Tab.0.center/0.0.1536.824/1920.0.1920.1040@1920.0.1920.1040" timestamp="1605721684342" />
<state width="1493" height="89" key="GridCell.Tab.0.center/0.0.1536.824/1920.0.1920.1160@0.0.1536.824" timestamp="1604916507123" />
<state width="1877" height="315" key="GridCell.Tab.0.center/0.0.1536.824/1920.0.1920.1160@1920.0.1920.1160" timestamp="1604501251887" />
<state width="1493" height="185" key="GridCell.Tab.0.center/0.0.1536.824@0.0.1536.824" timestamp="1605634220571" />
<state width="1493" height="55" key="GridCell.Tab.0.left" timestamp="1605781988395">
<state width="1493" height="114" key="GridCell.Tab.0.left" timestamp="1605785217749">
<screen x="0" y="0" width="1536" height="824" />
</state>
<state width="1877" height="239" key="GridCell.Tab.0.left/-1920.0.1536.832/0.0.1920.1040@0.0.1920.1040" timestamp="1600275797041" />
<state width="1493" height="55" key="GridCell.Tab.0.left/0.0.1536.824/1920.0.1920.1040@0.0.1536.824" timestamp="1605781988395" />
<state width="1493" height="114" key="GridCell.Tab.0.left/0.0.1536.824/1920.0.1920.1040@0.0.1536.824" timestamp="1605785217749" />
<state width="1877" height="267" key="GridCell.Tab.0.left/0.0.1536.824/1920.0.1920.1040@1920.0.1920.1040" timestamp="1605721684342" />
<state width="1493" height="89" key="GridCell.Tab.0.left/0.0.1536.824/1920.0.1920.1160@0.0.1536.824" timestamp="1604916507123" />
<state width="1877" height="315" key="GridCell.Tab.0.left/0.0.1536.824/1920.0.1920.1160@1920.0.1920.1160" timestamp="1604501251887" />
<state width="1493" height="185" key="GridCell.Tab.0.left/0.0.1536.824@0.0.1536.824" timestamp="1605634220570" />
<state width="1493" height="55" key="GridCell.Tab.0.right" timestamp="1605781988395">
<state width="1493" height="114" key="GridCell.Tab.0.right" timestamp="1605785217750">
<screen x="0" y="0" width="1536" height="824" />
</state>
<state width="1877" height="239" key="GridCell.Tab.0.right/-1920.0.1536.832/0.0.1920.1040@0.0.1920.1040" timestamp="1600275797041" />
<state width="1493" height="55" key="GridCell.Tab.0.right/0.0.1536.824/1920.0.1920.1040@0.0.1536.824" timestamp="1605781988395" />
<state width="1493" height="114" key="GridCell.Tab.0.right/0.0.1536.824/1920.0.1920.1040@0.0.1536.824" timestamp="1605785217750" />
<state width="1877" height="267" key="GridCell.Tab.0.right/0.0.1536.824/1920.0.1920.1040@1920.0.1920.1040" timestamp="1605721684342" />
<state width="1493" height="89" key="GridCell.Tab.0.right/0.0.1536.824/1920.0.1920.1160@0.0.1536.824" timestamp="1604916507123" />
<state width="1877" height="315" key="GridCell.Tab.0.right/0.0.1536.824/1920.0.1920.1160@1920.0.1920.1160" timestamp="1604501251887" />
@@ -812,11 +812,11 @@
</state>
<state x="277" y="57" key="SettingsEditor/0.0.1536.824/1920.0.1920.1040@0.0.1536.824" timestamp="1600935670743" />
<state x="277" y="57" key="SettingsEditor/0.0.1536.824@0.0.1536.824" timestamp="1601975962923" />
<state x="361" y="145" key="Vcs.Push.Dialog.v2" timestamp="1605784903807">
<state x="361" y="145" key="Vcs.Push.Dialog.v2" timestamp="1605785260794">
<screen x="0" y="0" width="1536" height="824" />
</state>
<state x="451" y="183" key="Vcs.Push.Dialog.v2/-1920.0.1536.832/0.0.1920.1040@0.0.1920.1040" timestamp="1600275760386" />
<state x="361" y="145" key="Vcs.Push.Dialog.v2/0.0.1536.824/1920.0.1920.1040@0.0.1536.824" timestamp="1605784903807" />
<state x="361" y="145" key="Vcs.Push.Dialog.v2/0.0.1536.824/1920.0.1920.1040@0.0.1536.824" timestamp="1605785260794" />
<state x="2371" y="183" key="Vcs.Push.Dialog.v2/0.0.1536.824/1920.0.1920.1040@1920.0.1920.1040" timestamp="1604770067322" />
<state x="361" y="145" key="Vcs.Push.Dialog.v2/0.0.1536.824/1920.0.1920.1160@0.0.1536.824" timestamp="1604494473937" />
<state x="2371" y="204" key="Vcs.Push.Dialog.v2/0.0.1536.824/1920.0.1920.1160@1920.0.1920.1160" timestamp="1604499402409" />

View File

@@ -14,11 +14,5 @@ pipeline {
sh "docker-compose -f docker-compose-PROD --context PROD up -d"
}
}
stage('Logs') {
steps {
sleep time: 1, unit: 'MINUTES'
sh 'docker -f docker-compose-PROD --context PROD logs klaus'
}
}
}
}

View File

@@ -1,15 +1,32 @@
# R11-Klaus
Mockup service for middleware testing
Mockup service for middleware testing.
[![Build Status](https://travis-ci.com/Szakalakamaka/Klaus.svg?token=Tt3QbF7q4wiFNnCGkuew&branch=master)](https://travis-ci.com/Szakalakamaka/Klaus)
Available scripts:
#### docker-compose up -d --build
Builds and launches Redis service and the application. Performs unit testing on the code and run the application.
### Running the application on a local machine
For Intellij:
Plugins:
settings -> plugins -> install lombok plugin
settings -> annotation processors -> enable annotation processing
A connection to a Redis database is expected to run the application successfully. You need to download and run Redis DB on
your local machine with default values localhost 6379.
You can also run the application via Docker.
#### docker-compose up --build -d
However, you need either to run it with Spring Cloud Config application or override property value
from redis.host = localhost to redis.host = redis. Where value "redis" will be treated as a DB service address and used
for connection between docker images.
### Operations on Redis DB
Use Redis CLI or attach to Redis docker image in order to manually operate on DB.
#### docker exec -it mockedservices_redis-server redis-cli
Attach to the running local redis server and open a redis client.
Attach to redis server image and open a redis client.
Useful redis-cli commands:
###### KEYS *
@@ -24,8 +41,39 @@ Display list length.
Display elements from hashSet.
Logs can be found in lists with names logstash_yyyy-mm-dd.
Plugins:
### Deployment and building with docker and jenkins
For creating docker context (feature available from docker version 19.03):
docker context create DEV \
--description "context for DEV environment" \
--docker "host=ssh://jenkins@s5000xvn:22"
docker context create PROD \
--description "connection to PROD environment" \
--docker "host=ssh://jenkins@server361209.nazwa.pl:22"
docker context create PROD \
--description "context for PROD environment" \
--docker "host=ssh://jenkins@server361209:22"
#### docker-compose up -d --build
Builds and launches Redis service and the application. Performs unit testing on the code and run the application.
#### docker-compose --context DEV up --build -d
The same as above, but the application will be deployed on the server defined via docker context as DEV.
#### docker-compose --context PROD up --build -d
The same as above, but the application will be deployed on the server defined via docker context as PROD.
The application can be started on a local machine without environment support. However, for application supervising and
updating configuration on deployment spring cloud applications should be deployed before. In order:
- Spring Cloud Eureka
- Spring Cloud Configuration
- MockedServices
Once a docker image repository will be availabe, the proper deployment order should be under control by docker-compose script
which should check if the applications are present and if not deploy stable images of Spring Cloud applications from
docker image repo.
settings -> plugins -> install lombok plugin
settings -> annotation processors -> enable annotation processing