Development and deployment of polyglot systems

30
@3x14159265 development and deployment of polyglot systems by david pichsenmeister

description

At orat.io we are developing a comment plugin for online bloggers and publishers. Since the uptime of our software is very important, we try to apply best practices to our development and deployment workflow. Our system is based on different stacks, which includes the use of different languages like PHP, Scala and TypeScript. This talk is about how we manage the consistency of our data-models through the different stacks, how our SOA is designed and how our continuous integration pipeline works. I'll also show, how we use code generators and shell scripts to automate code creation and tasks. Last, I'll show how we handle our database migrations "on-the-fly".

Transcript of Development and deployment of polyglot systems

Page 1: Development and deployment of polyglot systems

@3x14159265

development and deployment of polyglot

systemsby

david pichsenmeister

Page 6: Development and deployment of polyglot systems

@3x14159265

reasons for polyglot

● system is already live

● technologies/skills evolved

● current stack is already a “technical

debt”

● get rid of legacy code

Page 7: Development and deployment of polyglot systems

@3x14159265

service oriented architecture

● backend only

● choose what service to decouple

● design to use from any

language/platform

Page 8: Development and deployment of polyglot systems

@3x14159265

possible pitfalls

● use only one(!) message format (e.g.

json, xml, soap,...)

● make use of different HTTP request

and status codes

● document your internal API

Page 9: Development and deployment of polyglot systems

@3x14159265

“app oriented architecture”

● thin layer on top of SOA

● form set of features to standalone

app

Page 10: Development and deployment of polyglot systems

@3x14159265

orat.io appsplatformwidget

moderation

analytics

login

Page 11: Development and deployment of polyglot systems

@3x14159265

pros

● easier to maintain/test

● don’t effect your existing codebase

● seperation of business logic

Page 12: Development and deployment of polyglot systems

@3x14159265

cons

● over-fragmentation

● repeatedly functionality

● achieve model consistency through

all apps

Page 14: Development and deployment of polyglot systems

@3x14159265

code generators

● define MDL

● use/write codegenerators to

distribute models to other languages

● compiler hook

Page 15: Development and deployment of polyglot systems

@3x14159265

code generators

● doctrine (php ORM) = MDL

● slick (scala ORM) = generates

classes from SQL

● custom code generator: Scala

classes → TypeScript classes

Page 17: Development and deployment of polyglot systems

@3x14159265

deployment strategies

● always have working branch

● staging environment

● immutable infrastructure

Page 18: Development and deployment of polyglot systems

@3x14159265

automation

● automate everything that’s possible

● make use of cloud provider features

● shell scripts are your friend

Page 21: Development and deployment of polyglot systems

@3x14159265

database migrations

● some application changes require

changes in db schema

● simple and/or risky

● always a pain

Page 22: Development and deployment of polyglot systems

@3x14159265

simple changes

● add table

● add index

● add column

● ...

Page 23: Development and deployment of polyglot systems

@3x14159265

risky changes● rename/add column

● change foreign key

● migrate data from one table/column

to another

● ...

Page 24: Development and deployment of polyglot systems

@3x14159265

how we’ve done it

● migrate “on-the-fly”

● create new table for entity to be

changed

● “transfer” entity to new table when

queried

Page 25: Development and deployment of polyglot systems

@3x14159265

how we’ve done it

● delete entity on “old” table

● additionally run this procedure as

background job

Page 26: Development and deployment of polyglot systems

@3x14159265

must haves

● tool, which keeps track of db

evolutions

● simple integration into existing

project

Page 27: Development and deployment of polyglot systems

@3x14159265

must haves

● changelog

● up/down db evolutions

● intense testing

● backups