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

PDF
Ship your Scala code often and easy with Docker
PDF
Custom deployments with sbt-native-packager
PDF
Simple Build Tool
PPT
An introduction to maven gradle and sbt
PDF
SBT Crash Course
PPTX
SBT Concepts, part 2
PDF
Sbt Concepts - Tips, Tricks, Sandbox, ... 02/2013
PPTX
Getting started with sbt
Ship your Scala code often and easy with Docker
Custom deployments with sbt-native-packager
Simple Build Tool
An introduction to maven gradle and sbt
SBT Crash Course
SBT Concepts, part 2
Sbt Concepts - Tips, Tricks, Sandbox, ... 02/2013
Getting started with sbt

What's hot (20)

PDF
[Image Results] Java Build Tools: Part 2 - A Decision Maker's Guide Compariso...
PDF
Gradle build tool that rocks with DSL JavaOne India 4th May 2012
PDF
Using Kubernetes for Continuous Integration and Continuous Delivery
PDF
Gradle talk, Javarsovia 2010
PDF
Gdg cloud taipei ddt meetup #53 buildpack
PDF
Docker
PDF
Dev fest 2020 taiwan how to debug microservices on kubernetes as a pros (ht...
PPTX
Docker Starter Pack
PDF
Containerizing a Web Application with Vue.js and Java
PDF
How to Dockerize Web Application using Docker Compose
PDF
Idiomatic Gradle Plugin Writing
PDF
Idiomatic Gradle Plugin Writing
PDF
Gradle in 45min
PDF
Basic Gradle Plugin Writing
PDF
Docker d2 박승환
PPTX
The world of gradle - an introduction for developers
PDF
Gradle in 45min - JBCN2-16 version
PPTX
ABCs of docker
PDF
如何透過 Go-kit 快速搭建微服務架構應用程式實戰
PDF
Gradle Introduction
[Image Results] Java Build Tools: Part 2 - A Decision Maker's Guide Compariso...
Gradle build tool that rocks with DSL JavaOne India 4th May 2012
Using Kubernetes for Continuous Integration and Continuous Delivery
Gradle talk, Javarsovia 2010
Gdg cloud taipei ddt meetup #53 buildpack
Docker
Dev fest 2020 taiwan how to debug microservices on kubernetes as a pros (ht...
Docker Starter Pack
Containerizing a Web Application with Vue.js and Java
How to Dockerize Web Application using Docker Compose
Idiomatic Gradle Plugin Writing
Idiomatic Gradle Plugin Writing
Gradle in 45min
Basic Gradle Plugin Writing
Docker d2 박승환
The world of gradle - an introduction for developers
Gradle in 45min - JBCN2-16 version
ABCs of docker
如何透過 Go-kit 快速搭建微服務架構應用程式實戰
Gradle Introduction
Ad

Viewers also liked (20)

PPTX
Using Jenkins and Jmeter to build a scalable Load Testing solution
PDF
Meet scala
PDF
Intel Business Challenge Europe 2014 Pitching Hacks
PDF
Doktorat, a własny startup ? Jak zacząć budować startup na uczelni w ujęciu l...
PDF
Konferencja Intel Business Challenge 2014 w Gdańskim Parku Naukowo-Technologi...
PDF
NeurOn input EEG powered touchless keyboard
PPTX
Load Testing using Continuous Integration tools
PDF
Unsucking Error Handling with Futures
ODP
Gatling
PDF
Continous delivery - lad koden flyde 2014
PDF
Automated Performance Testing With J Meter And Maven
PDF
Spark workshop
PDF
Scala, docker and testing, oh my! mario camou
PDF
Akka Http , Routes, Streams with Scala
PPT
Performance Testing With Jmeter
PDF
Akka http 2
ODP
An Introduction to Akka http
PDF
Practical Akka HTTP - introduction
PDF
Securing Microservices using Play and Akka HTTP
PDF
Building scalable rest service using Akka HTTP
Using Jenkins and Jmeter to build a scalable Load Testing solution
Meet scala
Intel Business Challenge Europe 2014 Pitching Hacks
Doktorat, a własny startup ? Jak zacząć budować startup na uczelni w ujęciu l...
Konferencja Intel Business Challenge 2014 w Gdańskim Parku Naukowo-Technologi...
NeurOn input EEG powered touchless keyboard
Load Testing using Continuous Integration tools
Unsucking Error Handling with Futures
Gatling
Continous delivery - lad koden flyde 2014
Automated Performance Testing With J Meter And Maven
Spark workshop
Scala, docker and testing, oh my! mario camou
Akka Http , Routes, Streams with Scala
Performance Testing With Jmeter
Akka http 2
An Introduction to Akka http
Practical Akka HTTP - introduction
Securing Microservices using Play and Akka HTTP
Building scalable rest service using Akka HTTP
Ad

Recently uploaded (20)

PDF
Nekopoi APK 2025 free lastest update
PDF
Adobe Illustrator 28.6 Crack My Vision of Vector Design
PDF
How Creative Agencies Leverage Project Management Software.pdf
PPTX
Lecture 3: Operating Systems Introduction to Computer Hardware Systems
PDF
Which alternative to Crystal Reports is best for small or large businesses.pdf
PDF
PTS Company Brochure 2025 (1).pdf.......
PPTX
Introduction to Artificial Intelligence
PPTX
Transform Your Business with a Software ERP System
PPTX
VVF-Customer-Presentation2025-Ver1.9.pptx
PPTX
Odoo POS Development Services by CandidRoot Solutions
PDF
Wondershare Filmora 15 Crack With Activation Key [2025
PDF
Odoo Companies in India – Driving Business Transformation.pdf
PDF
System and Network Administration Chapter 2
PDF
Design an Analysis of Algorithms II-SECS-1021-03
PDF
T3DD25 TYPO3 Content Blocks - Deep Dive by André Kraus
PPTX
ISO 45001 Occupational Health and Safety Management System
PDF
Raksha Bandhan Grocery Pricing Trends in India 2025.pdf
PDF
medical staffing services at VALiNTRY
PDF
2025 Textile ERP Trends: SAP, Odoo & Oracle
PPTX
CHAPTER 2 - PM Management and IT Context
Nekopoi APK 2025 free lastest update
Adobe Illustrator 28.6 Crack My Vision of Vector Design
How Creative Agencies Leverage Project Management Software.pdf
Lecture 3: Operating Systems Introduction to Computer Hardware Systems
Which alternative to Crystal Reports is best for small or large businesses.pdf
PTS Company Brochure 2025 (1).pdf.......
Introduction to Artificial Intelligence
Transform Your Business with a Software ERP System
VVF-Customer-Presentation2025-Ver1.9.pptx
Odoo POS Development Services by CandidRoot Solutions
Wondershare Filmora 15 Crack With Activation Key [2025
Odoo Companies in India – Driving Business Transformation.pdf
System and Network Administration Chapter 2
Design an Analysis of Algorithms II-SECS-1021-03
T3DD25 TYPO3 Content Blocks - Deep Dive by André Kraus
ISO 45001 Occupational Health and Safety Management System
Raksha Bandhan Grocery Pricing Trends in India 2025.pdf
medical staffing services at VALiNTRY
2025 Textile ERP Trends: SAP, Odoo & Oracle
CHAPTER 2 - PM Management and IT Context

Continous delivery with sbt