Skip to content

Commit

Permalink
rename project to tdc-pipeline
Browse files Browse the repository at this point in the history
  • Loading branch information
rmpestano committed Oct 24, 2017
1 parent 08716b9 commit 9d8644b
Show file tree
Hide file tree
Showing 11 changed files with 41 additions and 24 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@ FROM jboss/wildfly:10.1.0.Final

COPY ./docker/standalone.conf ${JBOSS_HOME}/bin/

COPY ./target/tdc-cars.war ${JBOSS_HOME}/standalone/deployments
COPY ./target/tdc-pipeline.war ${JBOSS_HOME}/standalone/deployments

VOLUME ["~/db"]
18 changes: 9 additions & 9 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ pipeline {
stages {
/* stage('Checkout') {
steps {
git 'https://github.com/rmpestano/tdc-cars.
git 'https://github.com/rmpestano/tdc-pipeline.
}
}*/
stage('build') {
Expand Down Expand Up @@ -83,10 +83,10 @@ pipeline {
dir("QA") {
unstash 'src'
sh "ls -la ${pwd()}"
sh 'docker stop tdc-cars-qa || true && docker rm tdc-cars-qa || true'
sh 'docker stop tdc-pipeline-qa || true && docker rm tdc-pipeline-qa || true'
sh 'mvn clean package -DskipTests flyway:clean flyway:migrate -P migrations -Ddb.name=cars-qa'
sh 'docker build -t tdc-cars-qa .'
sh 'docker run --name tdc-cars-qa -p 8282:8080 -v ~/db:/opt/jboss/db tdc-cars-qa &'
sh 'docker build -t tdc-pipeline-qa .'
sh 'docker run --name tdc-pipeline-qa -p 8282:8080 -v ~/db:/opt/jboss/db tdc-pipeline-qa &'
}
}
}
Expand All @@ -104,29 +104,29 @@ pipeline {

stage('migrations') {
steps {
sh 'docker stop tdc-cars || true && docker rm tdc-cars || true'
sh 'docker stop tdc-pipeline || true && docker rm tdc-pipeline || true'
sh 'mvn flyway:repair flyway:migrate -P migrations'
}
}

stage('deploy to production') {
steps {
sh 'docker build -t rmpestano/tdc-cars .'
sh 'docker run --name tdc-cars -p 8181:8080 -v ~/db:/opt/jboss/db tdc-cars &'
sh 'docker build -t tdc-pipeline .'
sh 'docker run --name tdc-pipeline -p 8181:8080 -v ~/db:/opt/jboss/db tdc-pipeline &'
}
}

stage('smoke-tests') {
steps {
sh 'mvn test -Psmoke -DAPP_CONTEXT=http://localhost:8181/tdc-cars/rest/health'
sh 'mvn test -Psmoke -DAPP_CONTEXT=http://localhost:8181/tdc-pipeline/rest/health'
}
}

stage('perf-tests') {
steps {
script {
try {
sh 'mvn gatling:execute -Pperf -DAPP_CONTEXT=http://localhost:8181/tdc-cars/'
sh 'mvn gatling:execute -Pperf -DAPP_CONTEXT=http://localhost:8181/tdc-pipeline/'
} finally {
gatlingArchive()
}
Expand Down
26 changes: 21 additions & 5 deletions README.adoc
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
= TDC Cars

image:https://travis-ci.org/rmpestano/tdc-cars.svg[Build Status (Travis CI), link=https://travis-ci.org/rmpestano/tdc-cars]
image:https://coveralls.io/repos/rmpestano/tdc-cars/badge.png[Coverage, link=https://coveralls.io/r/rmpestano/tdc-cars]
image:https://travis-ci.org/rmpestano/tdc-pipeline.svg[Build Status (Travis CI), link=https://travis-ci.org/rmpestano/tdc-pipeline]
image:https://coveralls.io/repos/rmpestano/tdc-pipeline/badge.png[Coverage, link=https://coveralls.io/r/rmpestano/tdc-pipeline]


Sample application for JavaEE Pipeline as code presentation.
Expand Down Expand Up @@ -40,20 +40,20 @@ mvn clean package -D db.path=C:/db
. Now create a docker image using:
+
----
docker build -t tdc-cars .
docker build -t tdc-pipeline .
----

. And finally run the application:
+
----
docker run -it --name tdc-cars -p 8080:8080 -v ~/db:/opt/jboss/db tdc-cars
docker run -it --name tdc-pipeline -p 8080:8080 -v ~/db:/opt/jboss/db tdc-pipeline
----
+
NOTE: `-v ~/db:/opt/jboss/db` maps our host filesystem database (the one we created with Flyway) to docker container home dir so we can exit the container without losing data.
+
NOTE: `/opt/jboss/` is the home dir (`~/`) in wildfly docker container.
+
. Access the application at http://localhost:8080/tdc-cars
. Access the application at http://localhost:8080/tdc-pipeline

== Running tests

Expand Down Expand Up @@ -128,6 +128,19 @@ First thing that is needed is a Jenkins instance, http://mirrors.jenkins.io/war-
java -jar jenkins.war
----

[NOTE]
====
It was tested with `jenkins 2.73.2` with following plugins installed:
* Last Changes (http://updates.jenkins-ci.org/latest/last-changes.hpi[link to download^])
* Cucumber living documentation (http://updates.jenkins-ci.org/latest/cucumber-living-documentation.hpi[link to download^])
* Gatling (http://updates.jenkins-ci.org/latest/gatling.hpi[link to download^])
* Slack (http://updates.jenkins-ci.org/latest/slack.hpi[link to download^])
* Sonar (http://updates.jenkins-ci.org/latest/sonar.hpi[link to download^])
* Quality gates (http://updates.jenkins-ci.org/latest/quality-gates.hpi[link to download^])
====


=== Docker

Expand All @@ -154,3 +167,6 @@ This pipeline is integrated with https://slack.com/[slack^]. You'll need to conf
. Install slack plugin on your Jenkins: https://wiki.jenkins.io/display/JENKINS/Slack+Plugin
. Create a Slack channel

=== Demo

Following is a demo video showing this pipeline:
2 changes: 1 addition & 1 deletion docker/build.sh
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
#!/bin/sh
docker build -t rmpestano/tdc-cars ../
docker build -t tdc-pipeline ../
2 changes: 1 addition & 1 deletion docker/run.sh
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
#!/bin/sh
docker run -it --name tdc-cars -p 8080:8080 -v ~/db:/opt/jboss/db tdc-cars
docker run -it --name tdc-pipeline -p 8080:8080 -v ~/db:/opt/jboss/db tdc-pipeline
6 changes: 3 additions & 3 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<groupId>com.github.rmpestano</groupId>
<artifactId>tdc-cars</artifactId>
<artifactId>tdc-pipeline</artifactId>
<version>0.1-SNAPSHOT</version>
<packaging>war</packaging>
<name>tdc-cars</name>
<name>tdc-pipeline</name>

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
Expand Down Expand Up @@ -283,7 +283,7 @@
</configuration>
</plugin>
</plugins>
<finalName>tdc-cars</finalName>
<finalName>tdc-pipeline</finalName>
</build>

<profiles>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ public void findCarById(Integer id) {
throw new BusinessException("Provide Car ID to load");
}
selectionList.add(crudService.findById(id));
getFilter().addParam("id",id);//show only the found car in table list
}

public void delete() {
Expand Down
2 changes: 1 addition & 1 deletion src/main/webapp/WEB-INF/templates/template.xhtml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@

<ui:define name="footer">
<a target="_blank"
href="https://github.com/rmpestano/tdc-cars">
href="https://github.com/rmpestano/tdc-pipeline">
Copyright (C) 2017 - TDC Cars
</a>

Expand Down
2 changes: 1 addition & 1 deletion src/main/webapp/index.xhtml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

<ui:define name="title">
<h2 class="align-center">
Welcome to the <span class="text-aqua"> <i><a href="https://github.com/rmpestano/tdc-cars"
Welcome to the <span class="text-aqua"> <i><a href="https://github.com/rmpestano/tdc-pipeline"
target="_blank"
style="text-transform: none;text-decoration: none"> TDC Cars</a></i></span> Project!
<br/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public class CarsSmoke {
public static void initContext() {
HEALTH_CHECK_CONTEXT = System.getProperty("APP_CONTEXT");
if(HEALTH_CHECK_CONTEXT == null) {
HEALTH_CHECK_CONTEXT = "http://localhost:8080/tdc-cars/rest/health";
HEALTH_CHECK_CONTEXT = "http://localhost:8080/tdc-pipeline/rest/health";
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class CarRestSimulation extends Simulation {
var baseUrl = System.getProperty("APP_CONTEXT")

if (baseUrl == null) {
baseUrl = "http://localhost:8080/tdc-cars/";
baseUrl = "http://localhost:8080/tdc-pipeline/";
}


Expand Down

0 comments on commit 9d8644b

Please sign in to comment.