Professional Documents
Culture Documents
Microservice in an Hour
Andrew Rouse: Open Liberty Developer for MicroProfle and CDI, IBM
@azquelt
Contents
– A methodology
– Best Practices
– Manifesto
https://12factor.net/ by Heroku
Why 12 factor?
Application Infrastructure
THE FACTORS
In the modern era, software is commonly delivered as a service: called web apps, or software-as-a-service. The
twelve-factor app is a methodology for building software-as-a-service apps that:
Use declarative formats for setup automation, to minimize time and cost for new developers joining the project;
Have a clean contract with the underlying operating system, offering maximum portability between execution
environments;
Are suitable for deployment on modern cloud platforms, obviating the need for servers and systems
administration;
Minimize divergence between development and production, enabling continuous deployment for maximum
agility;
And can scale up without signifcant changes to tooling, architecture, or development practices.
The twelve-factor methodology can be applied to apps written in any programming language, and which use any
combination of backing services (database, queue, memory cache, etc).
From https://12factor.net
I. Codebase
App Password=blah
IV. Backing services
Application
Port=80
VIII. Concurrency
1 2 3 4 5 6 7 8 9 10 11 12
Codebase Deps Config Backing Build Stateless Port Scaling Disposability Prod, Dev, Logs Admin
Service Release Binding Staging Processes
12 F
Run
AC
2. Declare our dependencies using Maven and Dockerfle
–
TOR
Including OpenLiberty
BI N
3. Release and Run by deploying with confg to Kubernetes
GO
4. Update our app to call another service
5. Deploy again with scaling
References
o https://github.com/Azquelt/12factor-app-a
o https://github.com/Azquelt/12factor-app-b
• http://microprofle.io
• https://www.12factor.net/
microservice
Infrastructure
K8s
12 factor app
Infrastructure
microservice
K8s
MicroProfle Confg
Static Confg
microprofle-confg.properties
@Inject myStaticProp=defaultSValue
@ConfiProperty(name="myStaticProp") myDynamicProp=defaultDValue
@azquelt
1
Contents
– A methodology
– Best Practices
– Manifesto
https://12factor.net/ by Heroku
Why 12 factor?
Application Infrastructure
5
Why 12 factor?
In the modern era, software is commonly delivered as a service: called web apps, or software-as-a-service. The
twelve-factor app is a methodology for building software-as-a-service apps that:
Use declarative formats for setup automation, to minimize time and cost for new developers joining the project;
Have a clean contract with the underlying operating system, offering maximum portability between execution
environments;
Are suitable for deployment on modern cloud platforms, obviating the need for servers and systems
administration;
Minimize divergence between development and production, enabling continuous deployment for maximum
agility;
And can scale up without signifcant changes to tooling, architecture, or development practices.
The twelve-factor methodology can be applied to apps written in any programming language, and which use any
combination of backing services (database, queue, memory cache, etc).
From https://12factor.net
6
I. Codebase
A codebase is any single repo (in a centralized revision control system like
Subversion), or any set of repos who share a root commit (in a
decentralized system like Git where changes are committed.) Also in Git –
scenario of repository per package/service.
App Password=blah
9
IV. Backing services
Application
10
V. Build, release, run
12
VII. Port binding
Port=80
VIII. Concurrency
19
DEMO
1 2 3 4 5 6 7 8 9 10 11 12
Codebase Deps Config Backing Build Stateless Port Scaling Disposability Prod, Dev, Logs Admin
Service Release Binding Staging Processes
12 F
Run
AC
2. Declare our dependencies using Maven and Dockerfle
–
TOR
Including OpenLiberty
BIN
3. Release and Run by deploying with confg to Kubernetes
GO
4. Update our app to call another service
5. Deploy again with scaling
20
References
o https://github.com/Azquelt/12factor-app-a
o https://github.com/Azquelt/12factor-app-b
• http://microprofle.io
• https://www.12factor.net/
microservice
Infrastructure
K8s
Infrastructure
microservice
K8s
23
MicroProfle Confg
Static Confg
microprofle-confg.properties
@Inject myStaticProp=defaultSValue
@ConfiProperty(name="myStaticProp") myDynamicProp=defaultDValue