Development and deployment of polyglot systems

Post on 29-Nov-2014

627 views 1 download

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

@3x14159265

development and deployment of polyglot

systemsby

david pichsenmeister

@3x14159265

reasons for polyglot

● system is already live

● technologies/skills evolved

● current stack is already a “technical

debt”

● get rid of legacy code

@3x14159265

service oriented architecture

● backend only

● choose what service to decouple

● design to use from any

language/platform

@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

@3x14159265

“app oriented architecture”

● thin layer on top of SOA

● form set of features to standalone

app

@3x14159265

orat.io appsplatformwidget

moderation

analytics

login

@3x14159265

pros

● easier to maintain/test

● don’t effect your existing codebase

● seperation of business logic

@3x14159265

cons

● over-fragmentation

● repeatedly functionality

● achieve model consistency through

all apps

@3x14159265

code generators

● define MDL

● use/write codegenerators to

distribute models to other languages

● compiler hook

@3x14159265

code generators

● doctrine (php ORM) = MDL

● slick (scala ORM) = generates

classes from SQL

● custom code generator: Scala

classes → TypeScript classes

@3x14159265

deployment strategies

● always have working branch

● staging environment

● immutable infrastructure

@3x14159265

automation

● automate everything that’s possible

● make use of cloud provider features

● shell scripts are your friend

@3x14159265

database migrations

● some application changes require

changes in db schema

● simple and/or risky

● always a pain

@3x14159265

simple changes

● add table

● add index

● add column

● ...

@3x14159265

risky changes● rename/add column

● change foreign key

● migrate data from one table/column

to another

● ...

@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

@3x14159265

how we’ve done it

● delete entity on “old” table

● additionally run this procedure as

background job

@3x14159265

must haves

● tool, which keeps track of db

evolutions

● simple integration into existing

project

@3x14159265

must haves

● changelog

● up/down db evolutions

● intense testing

● backups