Slide 1

Slide 1 text

What Devs Should Consider, When Coding Applications

Slide 2

Slide 2 text

● Introduction ● Context ● Challenges and Approaches

Slide 3

Slide 3 text

Thomas Philipona • CTO @ Puzzle ITC • OpenSource • Responsible for our CI/CD Processes • APPUiO – Swiss Container Platform @tphilipona phil-pona

Slide 4

Slide 4 text

www.puzzle.ch @puzzleitc | |

Slide 5

Slide 5 text

Context

Slide 6

Slide 6 text

Container Hype ©Håkan Dahlström Source: https://www.flickr.com/photos/dahlstroms/3144199355 Container Hype Docker | Rocket | Dev - driven | Ecosystem

Slide 7

Slide 7 text

Docker in Production Monitoring Log server Storage Jenkins Mail server DB Server Backup Network Lifecycle Container u. Infrastruktur

Slide 8

Slide 8 text

How it all began Multiple Workloads | OpenShift 3 | Internal use | Platform to run our Apps

Slide 9

Slide 9 text

Our Container Platform Cloudscale IaaS ✓ ISO 27001 ✓ FINMA ✓ -based ✓

Slide 10

Slide 10 text

Docker Kubernetes APPUiO is based on

Slide 11

Slide 11 text

Our Application Stack Angular 2 Client DB External Services Wildfly 10 Java EE 7 . . .

Slide 12

Slide 12 text

Challenges and Approaches

Slide 13

Slide 13 text

Dynamic Container Platform Restarts of nodes due to maintenance Container gets moved due to ressource allocation → Start up time of the Application → Robustness Reconnect of Backends → at least two instances running

Slide 14

Slide 14 text

Start Up Time of Applications 17:11:38,607 INFO [org.jboss.as] (MSC service thread 1-7) WFLYSRV0049: WildFly Full 10.0.0.Final (WildFly Core 2.0.10.Final) starting ... ... 17:13:10,297 INFO [org.jboss.as] (Controller Boot Thread) WFLYSRV0025: WildFly Full 10.0.0.Final (WildFly Core 2.0.10.Final) started in 93046ms - Started 1235 of 1510 services (409 services are lazy, passive or on-demand)

Slide 15

Slide 15 text

Scalability Stateless architecture No session pinning (Sessions in the database or at the client) No local filesystem → Easier testable . . .

Slide 16

Slide 16 text

Avoid Long Running Tasks Avoid them completely (if possible) Separate processes / applications running along the application Split them into parts, allow continuation t . . .

Slide 17

Slide 17 text

Monitoring / Application Healthchecks View into platform | fast feedback | easily integrated into infrastructure

Slide 18

Slide 18 text

Monitoring / Healthchecks Liveness check /health Process is running If not ok, process gets restarted Readiness check /health/ready Deployment ok Ready for requests Fully functional Health checks as simple JSON response on a REST endpoint

Slide 19

Slide 19 text

Cascading Checks app DB backend GET /health GET /health select 1 from ... HTTP/1.1 200 OK { "status": "UP", "db": { "status": "UP" }, "backend": { "status": "UP" } }

Slide 20

Slide 20 text

Cascading Errors app DB backend GET /health GET /health select 1 from ... HTTP/1.1 299 Warning { "status": "UP", "db": { "status": "DOWN" }, "backend": { "status": "UP" } }

Slide 21

Slide 21 text

Advantages Easily integratable into external monitoring and alarming Kubernetes / OpenShift uses those heath checks

Slide 22

Slide 22 text

Automation and CI/CD Git code Compile, Unit-tests Integration Tests, Package Deploy to Dev Acceptance Tests Deploy to UAT env Manual Tests Deploy to Prod

Slide 23

Slide 23 text

keep everything you need to build, deploy, test, & release in version control

Slide 24

Slide 24 text

Groovy Jenkins Pipeline Scripts stage 'Build' sh "${mvnHome}/bin/mvn versions:set -DnewVersion=${buildVersion}" sh "${mvnHome}/bin/mvn clean install" // prepare Dockerfile and Context sh "tar cvfz docker-context.tar.gz Dockerfile target/javaee7-wildfly-example.war" archive 'docker-context.tar.gz'

Slide 25

Slide 25 text

If It Hurts, Do It More Frequently, and Bring the Pain Forward Source: Jez Humble, David Farley, Continuous Delivery, Pearson Education, Inc. 2011

Slide 26

Slide 26 text

Automated Database Migrations DB migrationscripts are part of the deployed application and run during startup or deployment. $ php bin/console doctrine:schema:update $ rake db:migrate

Slide 27

Slide 27 text

Conclusion

Slide 28

Slide 28 text

Heterogeneous Team Devs | Ops | User Experience | Product Owner

Slide 29

Slide 29 text

The Twelve-Factor App Framework / Manifest on how to build Software-as-a-Service Apps • To max the portability and decrease vendor lockin • Deployment on cloud-platforms • Ensure continuous deployment • Scalability https:/ /12factor.net/

Slide 30

Slide 30 text

No content