SlideShare a Scribd company logo
CONTINOUS DELIVERY
WITH SBT
JENKINS, DOCKER, GATLING AND MORE
Created by Wojciech Pituła
DEPLOYMENT PIPELINE
BENEFITS
Repeatable deploys
History of deploys
No knowledge needed to deploy
Fast rollback to previous version
Continous delivery with sbt
Continous delivery with sbt
Continous delivery with sbt
RELEASE STAGE
COMMIT
> ...
> sbt test
> ...
> git push
JENKINS POLL
Continous delivery with sbt
SBT RELEASE
project/plugins.sbt
addSbtPlugin("com.github.gseitz" % "sbt­release" % "1.0.0")
shell
> sbt release
jenkins
RELEASE PROCESS
BUILD.SBT
import sbtrelease.ReleasePlugin.autoImport.ReleaseTransformations._
releaseProcess := Seq[ReleaseStep](
    checkSnapshotDependencies,
    inquireVersions,
    runTest,
    setReleaseVersion,
    commitReleaseVersion,
    tagRelease,
    ReleaseStep(releaseStepTask(publish in Docker)),
    publishArtifacts,
    setNextVersion,
    commitNextVersion,
    pushChanges
)
inquireVersions
ReleaseStep(releaseStepTask(publish in Docker))
publishArtifacts
pushChanges
RELEASE: INQUIRE VERSIONS
VERSION.SBT
version in ThisBuild := "0.1.40­SNAPSHOT"
inquireVersions
publishArtifacts
ReleaseStep(releaseStepTask(publish in Docker))
pushChanges
RELEASE: PUBLISH ARTIFACTS
optional
> sbt publish
inquireVersions
publishArtifacts
ReleaseStep(releaseStepTask(publish in Docker))
pushChanges
BUILD.SBT
publishMavenStyle := true
publishArtifact in Test := false
pomIncludeRepository := { _ => false }
publishTo := {
    val nexus = "http://nexus.int.wp­sa.pl/"
    if (isSnapshot.value)
        Some("snapshots" at nexus + "content/repositories/snapshots"
    else
        Some("releases" at nexus + "content/repositories/releases")
}
RELEASE: DOCKER
plugins.sbt
addSbtPlugin("com.typesafe.sbt" % "sbt­native­packager" % "1.0.3")
shell
> sbt docker:publish
inquireVersions
publishArtifacts
ReleaseStep(releaseStepTask(publish in Docker))
pushChanges
BUILD.SBT
enablePlugins(JavaAppPackaging)
dockerBaseImage := "java:8"
dockerRepository := Some("hub.docker.grupawp.pl/itrd")
RELEASE: PUSH
Push bumped version and tag to origin
inquireVersions
publishArtifacts
ReleaseStep(releaseStepTask(publish in Docker))
pushChanges
Continous delivery with sbt
SUCCESS
TRIGGER NEXT STEP
ADD RELEASED_VER PARAMETER
TRIGGER BUILD WITH PARAMS
DEPLOY TO DEV
DEPLOY BUILD
DEPLOY SCRIPT
#!/usr/bin/env bash
set ­xue
APP_VERSION=$1
HOST=$2
APP_NAME=ab­tests­service
DOCKER_IMAGE=hub.docker.grupawp.pl/itrd/ab­tests­service:$APP_VERSION
shift 2
RUN_OPTS=$@
ssh ­t ­o StrictHostKeyChecking=no jenkins­ci@$HOST << EOF
    docker pull $DOCKER_IMAGE
    docker stop $APP_NAME
    docker rm $APP_NAME
    docker run ­­name $APP_NAME ­d ­p 8080:8080 $DOCKER_IMAGE $RUN_OPTS
EOF
# verify if docker is running
sleep 30
ssh ­t ­o StrictHostKeyChecking=no jenkins­ci@$HOST 'RUNNING=`docker inspe
MACHINE SETUP
ANSIBLE PLAYBOOK
­­­
­ hosts: all
  sudo: yes
  tasks:
    ­ name: install docker­engine
      yum: name=docker­engine state=present
    ­ name: create jenkins user
      user: name=jenkins­ci groups=docker state=present shell=/bin/bash ho
    ­ name: Set up authorized_keys for the deploy user
      authorized_key: user=jenkins­ci
                      key="{{ item }}"
      with_file:
        ­ id_rsa.pub_noweci
        ­ id_rsa.pub
SUCCESS
TESTS
Triggered automatically after deploy
GATLING
An open-source load testing framework based on Scala,
Akka and Netty
High performance
Ready-to-present HTML reports
Scenario recorder and developer-friendly DSL
GATLING SCENARIO
Put in src/it/scala
class AddAndDeleteSingleTestSimulation extends Simulation {
                    val httpConf = http.baseURL("some.url")
  val testScenario = scenario("AddAndGetSingleTest")
    .exec(
      http("PostNewTest")
                    .post("some/endpoint")
        .header("Content­Type", "application/json")
                    .body(StringBody("{body}"))
        .check(status.is(201))
    )
    .exec(
      http("GetCreatedTest")
                    .get("some/endpoint")
        .check(status.is(200), jsonPath("$.testDef.name").is(testName))
    )
    .exec(
      http("DeleteCreatedTest")
PLUGINS.SBT
addSbtPlugin("io.gatling" % "gatling­sbt" % "2.1.5")
BUILD.SBT
enablePlugins(GatlingPlugin)
configs(IntegrationTest, GatlingIt)
Defaults.itSettings
Continous delivery with sbt
2015­09­09 12:38:33 +02:00, durationGLOBAL   DETAILS
> Global Information
Expand all groups | Collapse a
ASSERTIONS
Assertion
For all requests: count of failed requests is 0
STATISTICS
Executions Response Time (ms)
KO OK
0
1
Number of reques
Number of Requests
t < 800 ms 800 ms < t < 1200
ms
t > 1200 ms failed
0
1
2
3
4
5
Indicators
addanddeletesingletestsim
Active Users
Requests / sec
Responses / sec
SUCCESS
DEPLOY TO PRODUCTION
Exactly the same process like with DEV environment
TRIGGER MANUALLY
SUCCESS
DRAWBACKS AND PROBLEMS
binaries and config separation
smoke tests
production db password
data migration/schema updates
deployment downtime
TRICKS
build-name-setter

More Related Content

What's hot (20)

PDF
[Image Results] Java Build Tools: Part 2 - A Decision Maker's Guide Compariso...
ZeroTurnaround
 
PDF
Gradle build tool that rocks with DSL JavaOne India 4th May 2012
Rajmahendra Hegde
 
PDF
Using Kubernetes for Continuous Integration and Continuous Delivery
Carlos Sanchez
 
PDF
Gradle talk, Javarsovia 2010
Tomek Kaczanowski
 
PDF
Gdg cloud taipei ddt meetup #53 buildpack
KAI CHU CHUNG
 
PDF
Docker
Chen Chun
 
PDF
Dev fest 2020 taiwan how to debug microservices on kubernetes as a pros (ht...
KAI CHU CHUNG
 
PPTX
Docker Starter Pack
Saeed Hajizade
 
PDF
Containerizing a Web Application with Vue.js and Java
Jadson Santos
 
PDF
How to Dockerize Web Application using Docker Compose
Evoke Technologies
 
PDF
Idiomatic Gradle Plugin Writing
Schalk Cronjé
 
PDF
Idiomatic Gradle Plugin Writing
Schalk Cronjé
 
PDF
Gradle in 45min
Schalk Cronjé
 
PDF
Basic Gradle Plugin Writing
Schalk Cronjé
 
PDF
Docker d2 박승환
Seunghwan Park
 
PPTX
The world of gradle - an introduction for developers
Tricode (part of Dept)
 
PDF
Gradle in 45min - JBCN2-16 version
Schalk Cronjé
 
PPTX
ABCs of docker
Sabyrzhan Tynybayev
 
PDF
如何透過 Go-kit 快速搭建微服務架構應用程式實戰
KAI CHU CHUNG
 
PDF
Gradle Introduction
Dmitry Buzdin
 
[Image Results] Java Build Tools: Part 2 - A Decision Maker's Guide Compariso...
ZeroTurnaround
 
Gradle build tool that rocks with DSL JavaOne India 4th May 2012
Rajmahendra Hegde
 
Using Kubernetes for Continuous Integration and Continuous Delivery
Carlos Sanchez
 
Gradle talk, Javarsovia 2010
Tomek Kaczanowski
 
Gdg cloud taipei ddt meetup #53 buildpack
KAI CHU CHUNG
 
Docker
Chen Chun
 
Dev fest 2020 taiwan how to debug microservices on kubernetes as a pros (ht...
KAI CHU CHUNG
 
Docker Starter Pack
Saeed Hajizade
 
Containerizing a Web Application with Vue.js and Java
Jadson Santos
 
How to Dockerize Web Application using Docker Compose
Evoke Technologies
 
Idiomatic Gradle Plugin Writing
Schalk Cronjé
 
Idiomatic Gradle Plugin Writing
Schalk Cronjé
 
Gradle in 45min
Schalk Cronjé
 
Basic Gradle Plugin Writing
Schalk Cronjé
 
Docker d2 박승환
Seunghwan Park
 
The world of gradle - an introduction for developers
Tricode (part of Dept)
 
Gradle in 45min - JBCN2-16 version
Schalk Cronjé
 
ABCs of docker
Sabyrzhan Tynybayev
 
如何透過 Go-kit 快速搭建微服務架構應用程式實戰
KAI CHU CHUNG
 
Gradle Introduction
Dmitry Buzdin
 

Viewers also liked (20)

PPTX
Using Jenkins and Jmeter to build a scalable Load Testing solution
Ruslan Strazhnyk
 
PDF
Meet scala
Wojciech Pituła
 
PDF
Intel Business Challenge Europe 2014 Pitching Hacks
Łukasz Miądowicz
 
PDF
Doktorat, a własny startup ? Jak zacząć budować startup na uczelni w ujęciu l...
Łukasz Miądowicz
 
PDF
Konferencja Intel Business Challenge 2014 w Gdańskim Parku Naukowo-Technologi...
Łukasz Miądowicz
 
PDF
NeurOn input EEG powered touchless keyboard
Łukasz Miądowicz
 
PPTX
Load Testing using Continuous Integration tools
Rick Pitts
 
PDF
Unsucking Error Handling with Futures
GaryCoady
 
ODP
Gatling
Gaurav Shukla
 
PDF
Continous delivery - lad koden flyde 2014
BestBrains
 
PDF
Automated Performance Testing With J Meter And Maven
PerconaPerformance
 
PDF
Spark workshop
Wojciech Pituła
 
PDF
Scala, docker and testing, oh my! mario camou
J On The Beach
 
PDF
Akka Http , Routes, Streams with Scala
Jerry Kuru
 
PPT
Performance Testing With Jmeter
Adam Goucher
 
PDF
Akka http 2
Jean Detoeuf
 
ODP
An Introduction to Akka http
Knoldus Inc.
 
PDF
Practical Akka HTTP - introduction
Łukasz Sowa
 
PDF
Securing Microservices using Play and Akka HTTP
Rafal Gancarz
 
PDF
Building scalable rest service using Akka HTTP
datamantra
 
Using Jenkins and Jmeter to build a scalable Load Testing solution
Ruslan Strazhnyk
 
Meet scala
Wojciech Pituła
 
Intel Business Challenge Europe 2014 Pitching Hacks
Łukasz Miądowicz
 
Doktorat, a własny startup ? Jak zacząć budować startup na uczelni w ujęciu l...
Łukasz Miądowicz
 
Konferencja Intel Business Challenge 2014 w Gdańskim Parku Naukowo-Technologi...
Łukasz Miądowicz
 
NeurOn input EEG powered touchless keyboard
Łukasz Miądowicz
 
Load Testing using Continuous Integration tools
Rick Pitts
 
Unsucking Error Handling with Futures
GaryCoady
 
Gatling
Gaurav Shukla
 
Continous delivery - lad koden flyde 2014
BestBrains
 
Automated Performance Testing With J Meter And Maven
PerconaPerformance
 
Spark workshop
Wojciech Pituła
 
Scala, docker and testing, oh my! mario camou
J On The Beach
 
Akka Http , Routes, Streams with Scala
Jerry Kuru
 
Performance Testing With Jmeter
Adam Goucher
 
Akka http 2
Jean Detoeuf
 
An Introduction to Akka http
Knoldus Inc.
 
Practical Akka HTTP - introduction
Łukasz Sowa
 
Securing Microservices using Play and Akka HTTP
Rafal Gancarz
 
Building scalable rest service using Akka HTTP
datamantra
 
Ad

Recently uploaded (20)

PDF
MiniTool Power Data Recovery Crack New Pre Activated Version Latest 2025
imang66g
 
PPTX
ChessBase 18.02 Crack + Serial Key Free Download
cracked shares
 
PPTX
TexSender Pro 8.9.1 Crack Full Version Download
cracked shares
 
PPTX
GALILEO CRS SYSTEM | GALILEO TRAVEL SOFTWARE
philipnathen82
 
PDF
System Center 2025 vs. 2022; What’s new, what’s next_PDF.pdf
Q-Advise
 
PDF
10 posting ideas for community engagement with AI prompts
Pankaj Taneja
 
PPT
Activate_Methodology_Summary presentatio
annapureddyn
 
PDF
Why Are More Businesses Choosing Partners Over Freelancers for Salesforce.pdf
Cymetrix Software
 
PDF
Adobe Illustrator Crack Full Download (Latest Version 2025) Pre-Activated
imang66g
 
PDF
How Agentic AI Networks are Revolutionizing Collaborative AI Ecosystems in 2025
ronakdubey419
 
PPTX
Chess King 25.0.0.2500 With Crack Full Free Download
cracked shares
 
PDF
Balancing Resource Capacity and Workloads with OnePlan – Avoid Overloading Te...
OnePlan Solutions
 
PPTX
SAP Public Cloud PPT , SAP PPT, Public Cloud PPT
sonawanekundan2024
 
PDF
WatchTraderHub - Watch Dealer software with inventory management and multi-ch...
WatchDealer Pavel
 
PDF
AI Image Enhancer: Revolutionizing Visual Quality”
docmasoom
 
PDF
advancepresentationskillshdhdhhdhdhdhhfhf
jasmenrojas249
 
PDF
How to Download and Install ADT (ABAP Development Tools) for Eclipse IDE | SA...
SAP Vista, an A L T Z E N Company
 
PDF
Salesforce Implementation Services Provider.pdf
VALiNTRY360
 
PDF
Generating Union types w/ Static Analysis
K. Matthew Dupree
 
PDF
Using licensed Data Loss Prevention (DLP) as a strategic proactive data secur...
Q-Advise
 
MiniTool Power Data Recovery Crack New Pre Activated Version Latest 2025
imang66g
 
ChessBase 18.02 Crack + Serial Key Free Download
cracked shares
 
TexSender Pro 8.9.1 Crack Full Version Download
cracked shares
 
GALILEO CRS SYSTEM | GALILEO TRAVEL SOFTWARE
philipnathen82
 
System Center 2025 vs. 2022; What’s new, what’s next_PDF.pdf
Q-Advise
 
10 posting ideas for community engagement with AI prompts
Pankaj Taneja
 
Activate_Methodology_Summary presentatio
annapureddyn
 
Why Are More Businesses Choosing Partners Over Freelancers for Salesforce.pdf
Cymetrix Software
 
Adobe Illustrator Crack Full Download (Latest Version 2025) Pre-Activated
imang66g
 
How Agentic AI Networks are Revolutionizing Collaborative AI Ecosystems in 2025
ronakdubey419
 
Chess King 25.0.0.2500 With Crack Full Free Download
cracked shares
 
Balancing Resource Capacity and Workloads with OnePlan – Avoid Overloading Te...
OnePlan Solutions
 
SAP Public Cloud PPT , SAP PPT, Public Cloud PPT
sonawanekundan2024
 
WatchTraderHub - Watch Dealer software with inventory management and multi-ch...
WatchDealer Pavel
 
AI Image Enhancer: Revolutionizing Visual Quality”
docmasoom
 
advancepresentationskillshdhdhhdhdhdhhfhf
jasmenrojas249
 
How to Download and Install ADT (ABAP Development Tools) for Eclipse IDE | SA...
SAP Vista, an A L T Z E N Company
 
Salesforce Implementation Services Provider.pdf
VALiNTRY360
 
Generating Union types w/ Static Analysis
K. Matthew Dupree
 
Using licensed Data Loss Prevention (DLP) as a strategic proactive data secur...
Q-Advise
 
Ad

Continous delivery with sbt