![Page 1: 12 Factor App - OverOps Blog · $ heroku run console Running `console` attached to terminal... up, run.2581 Picked up JAVA_TOOL_OPTIONS: -Djava.rmi.server.useCode... Failed to created](https://reader030.vdocument.in/reader030/viewer/2022040409/5ec73fea17ced54a0b7ae15b/html5/thumbnails/1.jpg)
12 Factor AppBest Practices for Scala Deployment
![Page 2: 12 Factor App - OverOps Blog · $ heroku run console Running `console` attached to terminal... up, run.2581 Picked up JAVA_TOOL_OPTIONS: -Djava.rmi.server.useCode... Failed to created](https://reader030.vdocument.in/reader030/viewer/2022040409/5ec73fea17ced54a0b7ae15b/html5/thumbnails/2.jpg)
2005 2015
WAR files JAR files
App Servers Microservices
Java Scala
Hot-Deploy Continuous Deploy
![Page 3: 12 Factor App - OverOps Blog · $ heroku run console Running `console` attached to terminal... up, run.2581 Picked up JAVA_TOOL_OPTIONS: -Djava.rmi.server.useCode... Failed to created](https://reader030.vdocument.in/reader030/viewer/2022040409/5ec73fea17ced54a0b7ae15b/html5/thumbnails/3.jpg)
Joe Kutner@codefinger
JVM Platform Owner
@Heroku
Joe Kutner
![Page 4: 12 Factor App - OverOps Blog · $ heroku run console Running `console` attached to terminal... up, run.2581 Picked up JAVA_TOOL_OPTIONS: -Djava.rmi.server.useCode... Failed to created](https://reader030.vdocument.in/reader030/viewer/2022040409/5ec73fea17ced54a0b7ae15b/html5/thumbnails/4.jpg)
12 Factor Appa methodology
ScalabilityMaintainability
Portability
![Page 5: 12 Factor App - OverOps Blog · $ heroku run console Running `console` attached to terminal... up, run.2581 Picked up JAVA_TOOL_OPTIONS: -Djava.rmi.server.useCode... Failed to created](https://reader030.vdocument.in/reader030/viewer/2022040409/5ec73fea17ced54a0b7ae15b/html5/thumbnails/5.jpg)
• Immutable
• Ephemeral
• Declarative
• Automated
![Page 6: 12 Factor App - OverOps Blog · $ heroku run console Running `console` attached to terminal... up, run.2581 Picked up JAVA_TOOL_OPTIONS: -Djava.rmi.server.useCode... Failed to created](https://reader030.vdocument.in/reader030/viewer/2022040409/5ec73fea17ced54a0b7ae15b/html5/thumbnails/6.jpg)
https://github.com/sbt/sbt-native-packager
![Page 7: 12 Factor App - OverOps Blog · $ heroku run console Running `console` attached to terminal... up, run.2581 Picked up JAVA_TOOL_OPTIONS: -Djava.rmi.server.useCode... Failed to created](https://reader030.vdocument.in/reader030/viewer/2022040409/5ec73fea17ced54a0b7ae15b/html5/thumbnails/7.jpg)
addSbtPlugin(
"com.typesafe.sbt" % "sbt-native-packager" % "0.7.6"
)
project/plugins.sbt
![Page 8: 12 Factor App - OverOps Blog · $ heroku run console Running `console` attached to terminal... up, run.2581 Picked up JAVA_TOOL_OPTIONS: -Djava.rmi.server.useCode... Failed to created](https://reader030.vdocument.in/reader030/viewer/2022040409/5ec73fea17ced54a0b7ae15b/html5/thumbnails/8.jpg)
$ sbt stage
![Page 9: 12 Factor App - OverOps Blog · $ heroku run console Running `console` attached to terminal... up, run.2581 Picked up JAVA_TOOL_OPTIONS: -Djava.rmi.server.useCode... Failed to created](https://reader030.vdocument.in/reader030/viewer/2022040409/5ec73fea17ced54a0b7ae15b/html5/thumbnails/9.jpg)
without further ado…
![Page 10: 12 Factor App - OverOps Blog · $ heroku run console Running `console` attached to terminal... up, run.2581 Picked up JAVA_TOOL_OPTIONS: -Djava.rmi.server.useCode... Failed to created](https://reader030.vdocument.in/reader030/viewer/2022040409/5ec73fea17ced54a0b7ae15b/html5/thumbnails/10.jpg)
The 12 Factors• Codebase
• Dependencies
• Config
• Backing services
• Build, release, run
• Processes
• Port binding
• Concurrency
• Disposability
• Dev/prod parity
• Logs
• Admin processes
![Page 11: 12 Factor App - OverOps Blog · $ heroku run console Running `console` attached to terminal... up, run.2581 Picked up JAVA_TOOL_OPTIONS: -Djava.rmi.server.useCode... Failed to created](https://reader030.vdocument.in/reader030/viewer/2022040409/5ec73fea17ced54a0b7ae15b/html5/thumbnails/11.jpg)
Thank You!
Goodbye!
(just kidding)
![Page 12: 12 Factor App - OverOps Blog · $ heroku run console Running `console` attached to terminal... up, run.2581 Picked up JAVA_TOOL_OPTIONS: -Djava.rmi.server.useCode... Failed to created](https://reader030.vdocument.in/reader030/viewer/2022040409/5ec73fea17ced54a0b7ae15b/html5/thumbnails/12.jpg)
The 12 Factors• Codebase
• Dependencies
• Config
• Backing services
• Build, release, run
• Processes
• Port binding
• Concurrency
• Disposability
• Dev/prod parity
• Logs
• Admin processes
![Page 13: 12 Factor App - OverOps Blog · $ heroku run console Running `console` attached to terminal... up, run.2581 Picked up JAVA_TOOL_OPTIONS: -Djava.rmi.server.useCode... Failed to created](https://reader030.vdocument.in/reader030/viewer/2022040409/5ec73fea17ced54a0b7ae15b/html5/thumbnails/13.jpg)
The 12 Factors• Codebase
• Dependencies
• Config
• Backing services
• Build, release, run
• Processes
• Port binding
• Concurrency
• Disposability
• Dev/prod parity
• Logs
• Admin processes
![Page 14: 12 Factor App - OverOps Blog · $ heroku run console Running `console` attached to terminal... up, run.2581 Picked up JAVA_TOOL_OPTIONS: -Djava.rmi.server.useCode... Failed to created](https://reader030.vdocument.in/reader030/viewer/2022040409/5ec73fea17ced54a0b7ae15b/html5/thumbnails/14.jpg)
Use Version Control
![Page 15: 12 Factor App - OverOps Blog · $ heroku run console Running `console` attached to terminal... up, run.2581 Picked up JAVA_TOOL_OPTIONS: -Djava.rmi.server.useCode... Failed to created](https://reader030.vdocument.in/reader030/viewer/2022040409/5ec73fea17ced54a0b7ae15b/html5/thumbnails/15.jpg)
![Page 16: 12 Factor App - OverOps Blog · $ heroku run console Running `console` attached to terminal... up, run.2581 Picked up JAVA_TOOL_OPTIONS: -Djava.rmi.server.useCode... Failed to created](https://reader030.vdocument.in/reader030/viewer/2022040409/5ec73fea17ced54a0b7ae15b/html5/thumbnails/16.jpg)
![Page 17: 12 Factor App - OverOps Blog · $ heroku run console Running `console` attached to terminal... up, run.2581 Picked up JAVA_TOOL_OPTIONS: -Djava.rmi.server.useCode... Failed to created](https://reader030.vdocument.in/reader030/viewer/2022040409/5ec73fea17ced54a0b7ae15b/html5/thumbnails/17.jpg)
BAD
![Page 18: 12 Factor App - OverOps Blog · $ heroku run console Running `console` attached to terminal... up, run.2581 Picked up JAVA_TOOL_OPTIONS: -Djava.rmi.server.useCode... Failed to created](https://reader030.vdocument.in/reader030/viewer/2022040409/5ec73fea17ced54a0b7ae15b/html5/thumbnails/18.jpg)
BAD
App #1 App #2
![Page 19: 12 Factor App - OverOps Blog · $ heroku run console Running `console` attached to terminal... up, run.2581 Picked up JAVA_TOOL_OPTIONS: -Djava.rmi.server.useCode... Failed to created](https://reader030.vdocument.in/reader030/viewer/2022040409/5ec73fea17ced54a0b7ae15b/html5/thumbnails/19.jpg)
my-project
! build.sbt
! app
! conf
! public
! my-library
! build.sbt
! src
! main
! scala
![Page 20: 12 Factor App - OverOps Blog · $ heroku run console Running `console` attached to terminal... up, run.2581 Picked up JAVA_TOOL_OPTIONS: -Djava.rmi.server.useCode... Failed to created](https://reader030.vdocument.in/reader030/viewer/2022040409/5ec73fea17ced54a0b7ae15b/html5/thumbnails/20.jpg)
my-project
! build.sbt
! app
! conf
! public
! my-library
! my-sub-project
! build.sbt
! src
! main
! scala
BAD
![Page 21: 12 Factor App - OverOps Blog · $ heroku run console Running `console` attached to terminal... up, run.2581 Picked up JAVA_TOOL_OPTIONS: -Djava.rmi.server.useCode... Failed to created](https://reader030.vdocument.in/reader030/viewer/2022040409/5ec73fea17ced54a0b7ae15b/html5/thumbnails/21.jpg)
Submodules
![Page 22: 12 Factor App - OverOps Blog · $ heroku run console Running `console` attached to terminal... up, run.2581 Picked up JAVA_TOOL_OPTIONS: -Djava.rmi.server.useCode... Failed to created](https://reader030.vdocument.in/reader030/viewer/2022040409/5ec73fea17ced54a0b7ae15b/html5/thumbnails/22.jpg)
$ git submodule add https://github.com/jkutner/play-sub-project
![Page 23: 12 Factor App - OverOps Blog · $ heroku run console Running `console` attached to terminal... up, run.2581 Picked up JAVA_TOOL_OPTIONS: -Djava.rmi.server.useCode... Failed to created](https://reader030.vdocument.in/reader030/viewer/2022040409/5ec73fea17ced54a0b7ae15b/html5/thumbnails/23.jpg)
The 12 Factors• Codebase
• Dependencies
• Config
• Backing services
• Build, release, run
• Processes
• Port binding
• Concurrency
• Disposability
• Dev/prod parity
• Logs
• Admin processes
![Page 24: 12 Factor App - OverOps Blog · $ heroku run console Running `console` attached to terminal... up, run.2581 Picked up JAVA_TOOL_OPTIONS: -Djava.rmi.server.useCode... Failed to created](https://reader030.vdocument.in/reader030/viewer/2022040409/5ec73fea17ced54a0b7ae15b/html5/thumbnails/24.jpg)
Don’t check JAR files into Git
![Page 25: 12 Factor App - OverOps Blog · $ heroku run console Running `console` attached to terminal... up, run.2581 Picked up JAVA_TOOL_OPTIONS: -Djava.rmi.server.useCode... Failed to created](https://reader030.vdocument.in/reader030/viewer/2022040409/5ec73fea17ced54a0b7ae15b/html5/thumbnails/25.jpg)
![Page 26: 12 Factor App - OverOps Blog · $ heroku run console Running `console` attached to terminal... up, run.2581 Picked up JAVA_TOOL_OPTIONS: -Djava.rmi.server.useCode... Failed to created](https://reader030.vdocument.in/reader030/viewer/2022040409/5ec73fea17ced54a0b7ae15b/html5/thumbnails/26.jpg)
Never rely on implicit
existence of system-wide
packages
Explicitly declare
and isolate
dependencies
![Page 27: 12 Factor App - OverOps Blog · $ heroku run console Running `console` attached to terminal... up, run.2581 Picked up JAVA_TOOL_OPTIONS: -Djava.rmi.server.useCode... Failed to created](https://reader030.vdocument.in/reader030/viewer/2022040409/5ec73fea17ced54a0b7ae15b/html5/thumbnails/27.jpg)
global local
BAD GOOD
Dependencies
~/.m2
~/.ivy2
(ok in dev)
target/
![Page 28: 12 Factor App - OverOps Blog · $ heroku run console Running `console` attached to terminal... up, run.2581 Picked up JAVA_TOOL_OPTIONS: -Djava.rmi.server.useCode... Failed to created](https://reader030.vdocument.in/reader030/viewer/2022040409/5ec73fea17ced54a0b7ae15b/html5/thumbnails/28.jpg)
Vendoring
GOOD
![Page 29: 12 Factor App - OverOps Blog · $ heroku run console Running `console` attached to terminal... up, run.2581 Picked up JAVA_TOOL_OPTIONS: -Djava.rmi.server.useCode... Failed to created](https://reader030.vdocument.in/reader030/viewer/2022040409/5ec73fea17ced54a0b7ae15b/html5/thumbnails/29.jpg)
$ sbt stage
...
$ tree target/universal/stage/lib/
target/universal/stage/lib/
"## ch.qos.logback.logback-classic-1.1.1.jar
"## ch.qos.logback.logback-core-1.1.1.jar
"## com.fasterxml.jackson.core.jackson-annotations-2.3...
"## com.fasterxml.jackson.core.jackson-core-2.3.2.jar
"## com.fasterxml.jackson.core.jackson-databind-2.3.2.jar
"## com.google.guava.guava-16.0.1.jar
...
![Page 30: 12 Factor App - OverOps Blog · $ heroku run console Running `console` attached to terminal... up, run.2581 Picked up JAVA_TOOL_OPTIONS: -Djava.rmi.server.useCode... Failed to created](https://reader030.vdocument.in/reader030/viewer/2022040409/5ec73fea17ced54a0b7ae15b/html5/thumbnails/30.jpg)
The 12 Factors• Codebase
• Dependencies
• Config
• Backing services
• Build, release, run
• Processes
• Port binding
• Concurrency
• Disposability
• Dev/prod parity
• Logs
• Admin processes
![Page 31: 12 Factor App - OverOps Blog · $ heroku run console Running `console` attached to terminal... up, run.2581 Picked up JAVA_TOOL_OPTIONS: -Djava.rmi.server.useCode... Failed to created](https://reader030.vdocument.in/reader030/viewer/2022040409/5ec73fea17ced54a0b7ae15b/html5/thumbnails/31.jpg)
Don’t check passwords into Git
![Page 32: 12 Factor App - OverOps Blog · $ heroku run console Running `console` attached to terminal... up, run.2581 Picked up JAVA_TOOL_OPTIONS: -Djava.rmi.server.useCode... Failed to created](https://reader030.vdocument.in/reader030/viewer/2022040409/5ec73fea17ced54a0b7ae15b/html5/thumbnails/32.jpg)
Or was it “DUH”?
😳
![Page 33: 12 Factor App - OverOps Blog · $ heroku run console Running `console` attached to terminal... up, run.2581 Picked up JAVA_TOOL_OPTIONS: -Djava.rmi.server.useCode... Failed to created](https://reader030.vdocument.in/reader030/viewer/2022040409/5ec73fea17ced54a0b7ae15b/html5/thumbnails/33.jpg)
Can you make your app open source
at any moment, without compromising
any credentials?
Litmus Test
![Page 34: 12 Factor App - OverOps Blog · $ heroku run console Running `console` attached to terminal... up, run.2581 Picked up JAVA_TOOL_OPTIONS: -Djava.rmi.server.useCode... Failed to created](https://reader030.vdocument.in/reader030/viewer/2022040409/5ec73fea17ced54a0b7ae15b/html5/thumbnails/34.jpg)
• Resource handles to the database,
Memcached, and other backing services
• Credentials to external services such as
Amazon S3 or Twitter
• Per-deploy values such as the canonical
hostname for the deploy
Anything that changes between deployment environments:
(does not include things like conf/routes)
Configuration is…
![Page 35: 12 Factor App - OverOps Blog · $ heroku run console Running `console` attached to terminal... up, run.2581 Picked up JAVA_TOOL_OPTIONS: -Djava.rmi.server.useCode... Failed to created](https://reader030.vdocument.in/reader030/viewer/2022040409/5ec73fea17ced54a0b7ae15b/html5/thumbnails/35.jpg)
Configuration belongs
in the environment,
not in the application
Configuration should
be strictly separated
from code
![Page 36: 12 Factor App - OverOps Blog · $ heroku run console Running `console` attached to terminal... up, run.2581 Picked up JAVA_TOOL_OPTIONS: -Djava.rmi.server.useCode... Failed to created](https://reader030.vdocument.in/reader030/viewer/2022040409/5ec73fea17ced54a0b7ae15b/html5/thumbnails/36.jpg)
db.default.url=${DATABASE_URL}
conf/application.conf
![Page 37: 12 Factor App - OverOps Blog · $ heroku run console Running `console` attached to terminal... up, run.2581 Picked up JAVA_TOOL_OPTIONS: -Djava.rmi.server.useCode... Failed to created](https://reader030.vdocument.in/reader030/viewer/2022040409/5ec73fea17ced54a0b7ae15b/html5/thumbnails/37.jpg)
The 12 Factors• Codebase
• Dependencies
• Config
• Backing services
• Build, release, run
• Processes
• Port binding
• Concurrency
• Disposability
• Dev/prod parity
• Logs
• Admin processes
![Page 38: 12 Factor App - OverOps Blog · $ heroku run console Running `console` attached to terminal... up, run.2581 Picked up JAVA_TOOL_OPTIONS: -Djava.rmi.server.useCode... Failed to created](https://reader030.vdocument.in/reader030/viewer/2022040409/5ec73fea17ced54a0b7ae15b/html5/thumbnails/38.jpg)
db.default.url=${DATABASE_URL}
conf/application.conf
![Page 39: 12 Factor App - OverOps Blog · $ heroku run console Running `console` attached to terminal... up, run.2581 Picked up JAVA_TOOL_OPTIONS: -Djava.rmi.server.useCode... Failed to created](https://reader030.vdocument.in/reader030/viewer/2022040409/5ec73fea17ced54a0b7ae15b/html5/thumbnails/39.jpg)
The 12 Factors• Codebase
• Dependencies
• Config
• Backing services
• Build, release, run
• Processes
• Port binding
• Concurrency
• Disposability
• Dev/prod parity
• Logs
• Admin processes
![Page 40: 12 Factor App - OverOps Blog · $ heroku run console Running `console` attached to terminal... up, run.2581 Picked up JAVA_TOOL_OPTIONS: -Djava.rmi.server.useCode... Failed to created](https://reader030.vdocument.in/reader030/viewer/2022040409/5ec73fea17ced54a0b7ae15b/html5/thumbnails/40.jpg)
build, release, run
![Page 41: 12 Factor App - OverOps Blog · $ heroku run console Running `console` attached to terminal... up, run.2581 Picked up JAVA_TOOL_OPTIONS: -Djava.rmi.server.useCode... Failed to created](https://reader030.vdocument.in/reader030/viewer/2022040409/5ec73fea17ced54a0b7ae15b/html5/thumbnails/41.jpg)
$ sbt stage
...
$ sbt deployHeroku
...
# in the cloud!
$ target/universal/stage/bin/my-app
build
release
run
![Page 42: 12 Factor App - OverOps Blog · $ heroku run console Running `console` attached to terminal... up, run.2581 Picked up JAVA_TOOL_OPTIONS: -Djava.rmi.server.useCode... Failed to created](https://reader030.vdocument.in/reader030/viewer/2022040409/5ec73fea17ced54a0b7ae15b/html5/thumbnails/42.jpg)
$ sbt run
BAD
(in production)
![Page 43: 12 Factor App - OverOps Blog · $ heroku run console Running `console` attached to terminal... up, run.2581 Picked up JAVA_TOOL_OPTIONS: -Djava.rmi.server.useCode... Failed to created](https://reader030.vdocument.in/reader030/viewer/2022040409/5ec73fea17ced54a0b7ae15b/html5/thumbnails/43.jpg)
simple build tool
![Page 44: 12 Factor App - OverOps Blog · $ heroku run console Running `console` attached to terminal... up, run.2581 Picked up JAVA_TOOL_OPTIONS: -Djava.rmi.server.useCode... Failed to created](https://reader030.vdocument.in/reader030/viewer/2022040409/5ec73fea17ced54a0b7ae15b/html5/thumbnails/44.jpg)
The 12 Factors• Codebase
• Dependencies
• Config
• Backing services
• Build, release, run
• Processes
• Port binding
• Concurrency
• Disposability
• Dev/prod parity
• Logs
• Admin processes
![Page 45: 12 Factor App - OverOps Blog · $ heroku run console Running `console` attached to terminal... up, run.2581 Picked up JAVA_TOOL_OPTIONS: -Djava.rmi.server.useCode... Failed to created](https://reader030.vdocument.in/reader030/viewer/2022040409/5ec73fea17ced54a0b7ae15b/html5/thumbnails/45.jpg)
DEMO!
![Page 46: 12 Factor App - OverOps Blog · $ heroku run console Running `console` attached to terminal... up, run.2581 Picked up JAVA_TOOL_OPTIONS: -Djava.rmi.server.useCode... Failed to created](https://reader030.vdocument.in/reader030/viewer/2022040409/5ec73fea17ced54a0b7ae15b/html5/thumbnails/46.jpg)
$ sbt stage
...
$ sbt deployHeroku
...
# in the cloud!
$ target/universal/stage/bin/scaladays
build
release
run
![Page 47: 12 Factor App - OverOps Blog · $ heroku run console Running `console` attached to terminal... up, run.2581 Picked up JAVA_TOOL_OPTIONS: -Djava.rmi.server.useCode... Failed to created](https://reader030.vdocument.in/reader030/viewer/2022040409/5ec73fea17ced54a0b7ae15b/html5/thumbnails/47.jpg)
The 12 Factors• Codebase
• Dependencies
• Config
• Backing services
• Build, release, run
• Processes
• Port binding
• Concurrency
• Disposability
• Dev/prod parity
• Logs
• Admin processes
![Page 48: 12 Factor App - OverOps Blog · $ heroku run console Running `console` attached to terminal... up, run.2581 Picked up JAVA_TOOL_OPTIONS: -Djava.rmi.server.useCode... Failed to created](https://reader030.vdocument.in/reader030/viewer/2022040409/5ec73fea17ced54a0b7ae15b/html5/thumbnails/48.jpg)
Processes should be stateless
![Page 49: 12 Factor App - OverOps Blog · $ heroku run console Running `console` attached to terminal... up, run.2581 Picked up JAVA_TOOL_OPTIONS: -Djava.rmi.server.useCode... Failed to created](https://reader030.vdocument.in/reader030/viewer/2022040409/5ec73fea17ced54a0b7ae15b/html5/thumbnails/49.jpg)
sticky sessions
😞
![Page 50: 12 Factor App - OverOps Blog · $ heroku run console Running `console` attached to terminal... up, run.2581 Picked up JAVA_TOOL_OPTIONS: -Djava.rmi.server.useCode... Failed to created](https://reader030.vdocument.in/reader030/viewer/2022040409/5ec73fea17ced54a0b7ae15b/html5/thumbnails/50.jpg)
The 12 Factors• Codebase
• Dependencies
• Config
• Backing services
• Build, release, run
• Processes
• Port binding
• Concurrency
• Disposability
• Dev/prod parity
• Logs
• Admin processes
![Page 51: 12 Factor App - OverOps Blog · $ heroku run console Running `console` attached to terminal... up, run.2581 Picked up JAVA_TOOL_OPTIONS: -Djava.rmi.server.useCode... Failed to created](https://reader030.vdocument.in/reader030/viewer/2022040409/5ec73fea17ced54a0b7ae15b/html5/thumbnails/51.jpg)
The twelve-factor app
is completely self-contained
The web app exports HTTP
as a service by binding to a port
![Page 52: 12 Factor App - OverOps Blog · $ heroku run console Running `console` attached to terminal... up, run.2581 Picked up JAVA_TOOL_OPTIONS: -Djava.rmi.server.useCode... Failed to created](https://reader030.vdocument.in/reader030/viewer/2022040409/5ec73fea17ced54a0b7ae15b/html5/thumbnails/52.jpg)
.war
Traditional Deployment
![Page 53: 12 Factor App - OverOps Blog · $ heroku run console Running `console` attached to terminal... up, run.2581 Picked up JAVA_TOOL_OPTIONS: -Djava.rmi.server.useCode... Failed to created](https://reader030.vdocument.in/reader030/viewer/2022040409/5ec73fea17ced54a0b7ae15b/html5/thumbnails/53.jpg)
.jar
Modern Deployment
![Page 54: 12 Factor App - OverOps Blog · $ heroku run console Running `console` attached to terminal... up, run.2581 Picked up JAVA_TOOL_OPTIONS: -Djava.rmi.server.useCode... Failed to created](https://reader030.vdocument.in/reader030/viewer/2022040409/5ec73fea17ced54a0b7ae15b/html5/thumbnails/54.jpg)
The 12 Factors• Codebase
• Dependencies
• Config
• Backing services
• Build, release, run
• Processes
• Port binding
• Concurrency
• Disposability
• Dev/prod parity
• Logs
• Admin processes
![Page 55: 12 Factor App - OverOps Blog · $ heroku run console Running `console` attached to terminal... up, run.2581 Picked up JAVA_TOOL_OPTIONS: -Djava.rmi.server.useCode... Failed to created](https://reader030.vdocument.in/reader030/viewer/2022040409/5ec73fea17ced54a0b7ae15b/html5/thumbnails/55.jpg)
Actors
Futures
Agents
RELAX BRO, I GOT THIS…
![Page 56: 12 Factor App - OverOps Blog · $ heroku run console Running `console` attached to terminal... up, run.2581 Picked up JAVA_TOOL_OPTIONS: -Djava.rmi.server.useCode... Failed to created](https://reader030.vdocument.in/reader030/viewer/2022040409/5ec73fea17ced54a0b7ae15b/html5/thumbnails/56.jpg)
Scale Up
Scale Out
![Page 57: 12 Factor App - OverOps Blog · $ heroku run console Running `console` attached to terminal... up, run.2581 Picked up JAVA_TOOL_OPTIONS: -Djava.rmi.server.useCode... Failed to created](https://reader030.vdocument.in/reader030/viewer/2022040409/5ec73fea17ced54a0b7ae15b/html5/thumbnails/57.jpg)
web.1
web.2
worker.1 clock.1
Workload Diversity
Num
ber
of P
rocesses
worker.2
worker.3
![Page 58: 12 Factor App - OverOps Blog · $ heroku run console Running `console` attached to terminal... up, run.2581 Picked up JAVA_TOOL_OPTIONS: -Djava.rmi.server.useCode... Failed to created](https://reader030.vdocument.in/reader030/viewer/2022040409/5ec73fea17ced54a0b7ae15b/html5/thumbnails/58.jpg)
The 12 Factors• Codebase
• Dependencies
• Config
• Backing services
• Build, release, run
• Processes
• Port binding
• Concurrency
• Disposability
• Dev/prod parity
• Logs
• Admin processes
![Page 59: 12 Factor App - OverOps Blog · $ heroku run console Running `console` attached to terminal... up, run.2581 Picked up JAVA_TOOL_OPTIONS: -Djava.rmi.server.useCode... Failed to created](https://reader030.vdocument.in/reader030/viewer/2022040409/5ec73fea17ced54a0b7ae15b/html5/thumbnails/59.jpg)
Graceful shutdown
Quick startup
Resilience to failure
![Page 60: 12 Factor App - OverOps Blog · $ heroku run console Running `console` attached to terminal... up, run.2581 Picked up JAVA_TOOL_OPTIONS: -Djava.rmi.server.useCode... Failed to created](https://reader030.vdocument.in/reader030/viewer/2022040409/5ec73fea17ced54a0b7ae15b/html5/thumbnails/60.jpg)
Servers are not pets
Servers are cattle
![Page 61: 12 Factor App - OverOps Blog · $ heroku run console Running `console` attached to terminal... up, run.2581 Picked up JAVA_TOOL_OPTIONS: -Djava.rmi.server.useCode... Failed to created](https://reader030.vdocument.in/reader030/viewer/2022040409/5ec73fea17ced54a0b7ae15b/html5/thumbnails/61.jpg)
Application Servers are
not disposable
![Page 62: 12 Factor App - OverOps Blog · $ heroku run console Running `console` attached to terminal... up, run.2581 Picked up JAVA_TOOL_OPTIONS: -Djava.rmi.server.useCode... Failed to created](https://reader030.vdocument.in/reader030/viewer/2022040409/5ec73fea17ced54a0b7ae15b/html5/thumbnails/62.jpg)
Microservices are
disposable
![Page 63: 12 Factor App - OverOps Blog · $ heroku run console Running `console` attached to terminal... up, run.2581 Picked up JAVA_TOOL_OPTIONS: -Djava.rmi.server.useCode... Failed to created](https://reader030.vdocument.in/reader030/viewer/2022040409/5ec73fea17ced54a0b7ae15b/html5/thumbnails/63.jpg)
Easy to replace
Decoupled from
external infrastructure
Easy to modify
![Page 64: 12 Factor App - OverOps Blog · $ heroku run console Running `console` attached to terminal... up, run.2581 Picked up JAVA_TOOL_OPTIONS: -Djava.rmi.server.useCode... Failed to created](https://reader030.vdocument.in/reader030/viewer/2022040409/5ec73fea17ced54a0b7ae15b/html5/thumbnails/64.jpg)
Microservices
![Page 65: 12 Factor App - OverOps Blog · $ heroku run console Running `console` attached to terminal... up, run.2581 Picked up JAVA_TOOL_OPTIONS: -Djava.rmi.server.useCode... Failed to created](https://reader030.vdocument.in/reader030/viewer/2022040409/5ec73fea17ced54a0b7ae15b/html5/thumbnails/65.jpg)
The 12 Factors• Codebase
• Dependencies
• Config
• Backing services
• Build, release, run
• Processes
• Port binding
• Concurrency
• Disposability
• Dev/prod parity
• Logs
• Admin processes
![Page 66: 12 Factor App - OverOps Blog · $ heroku run console Running `console` attached to terminal... up, run.2581 Picked up JAVA_TOOL_OPTIONS: -Djava.rmi.server.useCode... Failed to created](https://reader030.vdocument.in/reader030/viewer/2022040409/5ec73fea17ced54a0b7ae15b/html5/thumbnails/66.jpg)
dev
sqlite
postgres
stage
mysql
postgres
prod
postgres
postgres
=
≠
=
=
≠
=
![Page 67: 12 Factor App - OverOps Blog · $ heroku run console Running `console` attached to terminal... up, run.2581 Picked up JAVA_TOOL_OPTIONS: -Djava.rmi.server.useCode... Failed to created](https://reader030.vdocument.in/reader030/viewer/2022040409/5ec73fea17ced54a0b7ae15b/html5/thumbnails/67.jpg)
dev
jetty
jetty
stage
tomcat
jetty
prod
jboss
jetty
=
≠
=
=
≠
=
![Page 68: 12 Factor App - OverOps Blog · $ heroku run console Running `console` attached to terminal... up, run.2581 Picked up JAVA_TOOL_OPTIONS: -Djava.rmi.server.useCode... Failed to created](https://reader030.vdocument.in/reader030/viewer/2022040409/5ec73fea17ced54a0b7ae15b/html5/thumbnails/68.jpg)
dev
jetty
{}
stage
tomcat
{}
prod
jboss
{}
=
≠
=
=
≠
=
![Page 69: 12 Factor App - OverOps Blog · $ heroku run console Running `console` attached to terminal... up, run.2581 Picked up JAVA_TOOL_OPTIONS: -Djava.rmi.server.useCode... Failed to created](https://reader030.vdocument.in/reader030/viewer/2022040409/5ec73fea17ced54a0b7ae15b/html5/thumbnails/69.jpg)
Dropwizard
![Page 70: 12 Factor App - OverOps Blog · $ heroku run console Running `console` attached to terminal... up, run.2581 Picked up JAVA_TOOL_OPTIONS: -Djava.rmi.server.useCode... Failed to created](https://reader030.vdocument.in/reader030/viewer/2022040409/5ec73fea17ced54a0b7ae15b/html5/thumbnails/70.jpg)
disposable
⇒reproducible
parity⇒
![Page 71: 12 Factor App - OverOps Blog · $ heroku run console Running `console` attached to terminal... up, run.2581 Picked up JAVA_TOOL_OPTIONS: -Djava.rmi.server.useCode... Failed to created](https://reader030.vdocument.in/reader030/viewer/2022040409/5ec73fea17ced54a0b7ae15b/html5/thumbnails/71.jpg)
The 12 Factors• Codebase
• Dependencies
• Config
• Backing services
• Build, release, run
• Processes
• Port binding
• Concurrency
• Disposability
• Dev/prod parity
• Logs
• Admin processes
![Page 72: 12 Factor App - OverOps Blog · $ heroku run console Running `console` attached to terminal... up, run.2581 Picked up JAVA_TOOL_OPTIONS: -Djava.rmi.server.useCode... Failed to created](https://reader030.vdocument.in/reader030/viewer/2022040409/5ec73fea17ced54a0b7ae15b/html5/thumbnails/72.jpg)
The 12 Factors• Codebase
• Dependencies
• Config
• Backing services
• Build, release, run
• Processes
• Port binding
• Concurrency
• Disposability
• Dev/prod parity
• Logs
• Admin processes
![Page 73: 12 Factor App - OverOps Blog · $ heroku run console Running `console` attached to terminal... up, run.2581 Picked up JAVA_TOOL_OPTIONS: -Djava.rmi.server.useCode... Failed to created](https://reader030.vdocument.in/reader030/viewer/2022040409/5ec73fea17ced54a0b7ae15b/html5/thumbnails/73.jpg)
Admin tasks should be
run in isolated processes
![Page 74: 12 Factor App - OverOps Blog · $ heroku run console Running `console` attached to terminal... up, run.2581 Picked up JAVA_TOOL_OPTIONS: -Djava.rmi.server.useCode... Failed to created](https://reader030.vdocument.in/reader030/viewer/2022040409/5ec73fea17ced54a0b7ae15b/html5/thumbnails/74.jpg)
$ heroku run console
Running `console` attached to terminal... up, run.2581
Picked up JAVA_TOOL_OPTIONS: -Djava.rmi.server.useCode...
Failed to created JLineReader: java.lang.NoClassDefFou...
Falling back to SimpleReader.
Welcome to Scala version 2.11.1 (OpenJDK 64-Bit Server...
Type in expressions to have them evaluated.
Type :help for more information.
scala>
![Page 75: 12 Factor App - OverOps Blog · $ heroku run console Running `console` attached to terminal... up, run.2581 Picked up JAVA_TOOL_OPTIONS: -Djava.rmi.server.useCode... Failed to created](https://reader030.vdocument.in/reader030/viewer/2022040409/5ec73fea17ced54a0b7ae15b/html5/thumbnails/75.jpg)
web1
web2
web3
admin
![Page 76: 12 Factor App - OverOps Blog · $ heroku run console Running `console` attached to terminal... up, run.2581 Picked up JAVA_TOOL_OPTIONS: -Djava.rmi.server.useCode... Failed to created](https://reader030.vdocument.in/reader030/viewer/2022040409/5ec73fea17ced54a0b7ae15b/html5/thumbnails/76.jpg)
$ heroku run sbt console
?
![Page 77: 12 Factor App - OverOps Blog · $ heroku run console Running `console` attached to terminal... up, run.2581 Picked up JAVA_TOOL_OPTIONS: -Djava.rmi.server.useCode... Failed to created](https://reader030.vdocument.in/reader030/viewer/2022040409/5ec73fea17ced54a0b7ae15b/html5/thumbnails/77.jpg)
simple build tool
![Page 78: 12 Factor App - OverOps Blog · $ heroku run console Running `console` attached to terminal... up, run.2581 Picked up JAVA_TOOL_OPTIONS: -Djava.rmi.server.useCode... Failed to created](https://reader030.vdocument.in/reader030/viewer/2022040409/5ec73fea17ced54a0b7ae15b/html5/thumbnails/78.jpg)
addSbtPlugin(
"com.typesafe.sbt" % "sbt-native-packager" % "0.7.6"
)
project/plugins.sbt
![Page 79: 12 Factor App - OverOps Blog · $ heroku run console Running `console` attached to terminal... up, run.2581 Picked up JAVA_TOOL_OPTIONS: -Djava.rmi.server.useCode... Failed to created](https://reader030.vdocument.in/reader030/viewer/2022040409/5ec73fea17ced54a0b7ae15b/html5/thumbnails/79.jpg)
console: target/universal/stage/bin/my-app \
-main scala.tools.nsc.MainGenericRunner \
-usejavacp
Procfile
worker: target/universal/stage/bin/my-app \
-main com.example.MyWorker
![Page 80: 12 Factor App - OverOps Blog · $ heroku run console Running `console` attached to terminal... up, run.2581 Picked up JAVA_TOOL_OPTIONS: -Djava.rmi.server.useCode... Failed to created](https://reader030.vdocument.in/reader030/viewer/2022040409/5ec73fea17ced54a0b7ae15b/html5/thumbnails/80.jpg)
The 12 Factors• Codebase
• Dependencies
• Config
• Backing services
• Build, release, run
• Processes
• Port binding
• Concurrency
• Disposability
• Dev/prod parity
• Logs
• Admin processes
![Page 82: 12 Factor App - OverOps Blog · $ heroku run console Running `console` attached to terminal... up, run.2581 Picked up JAVA_TOOL_OPTIONS: -Djava.rmi.server.useCode... Failed to created](https://reader030.vdocument.in/reader030/viewer/2022040409/5ec73fea17ced54a0b7ae15b/html5/thumbnails/82.jpg)
Add sbt-native-packager1.
Run `sbt stage`2.
Deploy to Heroku?3.
Go to the sbt-native-packager talk4.
What next?
![Page 83: 12 Factor App - OverOps Blog · $ heroku run console Running `console` attached to terminal... up, run.2581 Picked up JAVA_TOOL_OPTIONS: -Djava.rmi.server.useCode... Failed to created](https://reader030.vdocument.in/reader030/viewer/2022040409/5ec73fea17ced54a0b7ae15b/html5/thumbnails/83.jpg)
Joe Kutner@codefinger
JVM Platform Owner
@Heroku
http://www.slideshare.net/jkutner/12-factor-scala