how dorma+kaba leverages and deploys on cloudfoundry - cloudfoundry summit europe 2016

45
How Leverages and Deploys on

Upload: adrai

Post on 08-Apr-2017

127 views

Category:

Technology


13 download

TRANSCRIPT

Page 1: How dorma+kaba leverages and deploys on CloudFoundry - CloudFoundry Summit Europe 2016

How Leverages and Deploys on

Page 2: How dorma+kaba leverages and deploys on CloudFoundry - CloudFoundry Summit Europe 2016

Lead Software/System architect at dorma+kabaAuthor and maintainer in multiple open source projects such as a cqrs framework for node.js (cqrs.js.org), push2.cloud and i18next.com with its "as a service" offering locize.com.

Father of 2 children.

Always in search for innovative and disruptive stuff.

CEO and System Engineer at wölkli gmbhSupports the dorma+kaba group in their journey with Cloud Foundry. One of the maintainers of the open source deployment framework push2.cloud.

Owner of 2 cats.

Adriano

Hello!My name is:

@adrirai

adrai

@themerne

michaelerne

Michael

Hello!My name is:

Page 3: How dorma+kaba leverages and deploys on CloudFoundry - CloudFoundry Summit Europe 2016

Who is dorma+kaba

Page 4: How dorma+kaba leverages and deploys on CloudFoundry - CloudFoundry Summit Europe 2016

154 + 108 years of experience

Page 5: How dorma+kaba leverages and deploys on CloudFoundry - CloudFoundry Summit Europe 2016

Top three position Over 2 billion Swiss francs 16,000 employees

Subsidiaries +50 countries products, solutions, services

for secure physical access

partners in 130 countries

Page 6: How dorma+kaba leverages and deploys on CloudFoundry - CloudFoundry Summit Europe 2016

Urbanization

Increasing prosperity in emerging markets

Demographic change

Increasing need for security

Technology

Growth drivers shaping our industry

Page 7: How dorma+kaba leverages and deploys on CloudFoundry - CloudFoundry Summit Europe 2016

Our goal: innovation leadership

dorma+kaba is striving for

innovation leadership in its

industry.

Page 8: How dorma+kaba leverages and deploys on CloudFoundry - CloudFoundry Summit Europe 2016

What is exivo?

Page 9: How dorma+kaba leverages and deploys on CloudFoundry - CloudFoundry Summit Europe 2016
Page 10: How dorma+kaba leverages and deploys on CloudFoundry - CloudFoundry Summit Europe 2016
Page 11: How dorma+kaba leverages and deploys on CloudFoundry - CloudFoundry Summit Europe 2016

Our frontendapps are on

For customers, partners, market organisations, administrators, factories, support, etc...

Page 12: How dorma+kaba leverages and deploys on CloudFoundry - CloudFoundry Summit Europe 2016

Our backendservices are on

Business Domains, Identity Management, Web servers, API servers, etc...

Page 13: How dorma+kaba leverages and deploys on CloudFoundry - CloudFoundry Summit Europe 2016

Our IoTstack is on

Communication, messaging, signing service, authentication, firmware update, virtual device representation, management apis, diagnostics, etc...

Page 14: How dorma+kaba leverages and deploys on CloudFoundry - CloudFoundry Summit Europe 2016

Our Business Model is on

From acquisition to life cycle management...

Page 15: How dorma+kaba leverages and deploys on CloudFoundry - CloudFoundry Summit Europe 2016

Everythingis on

⇒ But Why?

Page 16: How dorma+kaba leverages and deploys on CloudFoundry - CloudFoundry Summit Europe 2016
Page 17: How dorma+kaba leverages and deploys on CloudFoundry - CloudFoundry Summit Europe 2016

PlatformKnow-How

ApplicationKnow-How

InfrastructureKnow-How

SysOpsDevOps

Page 18: How dorma+kaba leverages and deploys on CloudFoundry - CloudFoundry Summit Europe 2016

How many apps do you deploy (in parallel)?

Page 19: How dorma+kaba leverages and deploys on CloudFoundry - CloudFoundry Summit Europe 2016

50 Applications48 Services150 Instances

Frontend ApplicationsCustomer, Partner, RMO, Admin,Support, etc...

Business Domain30 Applications18 Services90 Instances

Backend connectionto peripheryWired Doors, Wireless Doors

IoT stack

Page 20: How dorma+kaba leverages and deploys on CloudFoundry - CloudFoundry Summit Europe 2016

CQRS(D)DDD

Event Sourcing

flexible

loosely-coupled

scalable

tolerant of failure

highly responsive

secure

no vendor lock-in

12-factor app methodologyshare nothing

Page 21: How dorma+kaba leverages and deploys on CloudFoundry - CloudFoundry Summit Europe 2016

public

virtualprivate

deploy

Page 22: How dorma+kaba leverages and deploys on CloudFoundry - CloudFoundry Summit Europe 2016

Our deployment journey

Page 23: How dorma+kaba leverages and deploys on CloudFoundry - CloudFoundry Summit Europe 2016

---

applications:

- name: taibika-app-customer-host

buildpack: https://github.com/KABA-CCEAC/nodejs-buildpack.git

# buildpack: https://github.com/cloudfoundry/nodejs-buildpack.git

memory: 256M

instances: 1

path: .

command: node server.js

env:

DEPLOY_TYPE: cf

RABBITMQ_MODE: compatibility

➜ ~ cf push

➜ ~ cf set-env my-app myvar myval

➜ ~ cf create-service mongodb default my-db

➜ ~ cf bind-service my-app my-db

➜ ~ cf restart my-app

Start the classic way

Page 24: How dorma+kaba leverages and deploys on CloudFoundry - CloudFoundry Summit Europe 2016

shell script serial push

#!/bin/bash

SCRIPTDIR=$(dirname $(readlink -f $0))

PROJECTROOT=$(readlink -f "${SCRIPTDIR}/../../..")

cd ${SCRIPTDIR}

# CF_USER injected from username and password binding

CF_USER_USERNAME=`echo $CF_USER | cut -f1 -d:`

CF_USER_PASSWORD=`echo $CF_USER | cut -f2 -d:`

org=kaba ; space=dev

api=http://api.appcloud.swisscom.com

# login

cf api ${api}

cf auth ${CF_USER_USERNAME} ${CF_USER_PASSWORD}

cf target -o ${org} -s ${space}

# deploy auth

(cd ${PROJECTROOT}/auth && \

npm install && ./deploy.sh ${org} ${space})

# deploy domain

(cd ${PROJECTROOT}/domain/server && \

npm install && ./deploy.sh ${org} ${space})

# deploy app-customer-host

(cd ${PROJECTROOT}/app_customer/host && \

npm install && ./deploy.sh ${org} ${space})

...

#!/bin/bash

org="$1"

space="$2"

appname=taibika-app-customer

hostname=${appname}-${org}-${space}

echo "create services"

cf cs redis default taibika-app-customer-sessions

echo "pushing app but do not start it..."

cf push -n ${hostname} --no-start

echo "set env var AUTH_HOST"

cf set-env ${appname} AUTH_HOST https://taibika-

auth.scapp.io

echo "set env var MY_HOST"

cf set-env ${appname} MY_HOST

https://${hostname}.beta.scapp.io

echo "set env var DAAL_HOST"

cf set-env ${appname} DAAL_HOST https://cust.scapp.io

echo "set env var DAAL_USERNAME"

cf set-env ${appname} DAAL_USERNAME user

echo "set env var DAAL_PASSWORD"

cf set-env ${appname} DAAL_PASSWORD password

echo "restage/restart app"

cf push

echo "OK"

Script of scripts

Page 25: How dorma+kaba leverages and deploys on CloudFoundry - CloudFoundry Summit Europe 2016

shell script parallel push

#!/bin/bash

SCRIPTDIR=$(dirname $(readlink -f $0))

PROJECTROOT=$(readlink -f "${SCRIPTDIR}/../../..")

cd ${SCRIPTDIR}

# CF_USER injected from username and password binding

CF_USER_USERNAME=`echo $CF_USER | cut -f1 -d:`

CF_USER_PASSWORD=`echo $CF_USER | cut -f2 -d:`

org=kaba

space=dev

api=http://api.appcloud-beta.swisscom.com

# login

cf api ${api}

cf auth ${CF_USER_USERNAME} ${CF_USER_PASSWORD}

cf target -o ${org} -s ${space}

# deploy auth

(cd ${PROJECTROOT}/auth && npm install && ./deploy.sh ${org} ${space} &)

# deploy domain

(cd ${PROJECTROOT}/domain/server && npm install && ./deploy.sh ${org} ${space} &)

# deploy app-customer-host

(cd ${PROJECTROOT}/app_customer/host && npm install && ./deploy.sh ${org} ${space} &)

...

in parallel

Page 26: How dorma+kaba leverages and deploys on CloudFoundry - CloudFoundry Summit Europe 2016

echo('deploy ' + appsToDeploy.length + ' apps');

echo(JSON.stringify(appsToDeploy, null, 2));

echo('with ' + servicesToDeploy.length + ' services');

echo(JSON.stringify(servicesToDeploy, null, 2));

echo('starting to deploy...');

async.series([

function (callback) {

utils.prepushApps(appsToDeploy, callback);

},

function (callback) {

utils.createServices(servicesToDeploy, callback);

},

function (callback) {

utils.deployAppsStep1(appsToDeploy, function (err,

deployedApps) {

alreadyDeployedApps = deployedApps;

callback(err);

});

},

function (callback) {

utils.bindServices(appsToDeploy, callback);

},

function (callback) {

utils.deployAppsStep2(appsToDeploy, alreadyDeployedApps,

callback);

}

], function (err) {

if (err) return exit(err);

echo('!!!! finished :-) !!!');

});

Wrap the clirequire('shelljs/global');

//...

if (!which('cf')) {

echo('sorry, this script requires cf (cloudfoundry-cli)');

exit(1);

}

if (!which('git')) {

echo('sorry, this script requires git');

exit(1);

}

//...

var branch = env['BRANCH'] || env['GIT_BRANCH'] ||

currentBranch() || 'develop';

var org = env['ORG'] || currentOrg() || 'kaba';

var space = env['SPACE'] || currentSpace() || branch;

var deployType = env['DEPLOY_TYPE'] || branch || space;

var api = env['API'] || currentApi() || 'https://api.appcloud-

nova.swisscom.com';

execCmd('cf api ' + api);

execCmd('cf target -o ' + org + ' -s ' + space);

//...

Page 27: How dorma+kaba leverages and deploys on CloudFoundry - CloudFoundry Summit Europe 2016

we need sophisticated,

reliable and flexible tooling

required for application

management

Page 28: How dorma+kaba leverages and deploys on CloudFoundry - CloudFoundry Summit Europe 2016

?

?

? ?

?

?

Page 29: How dorma+kaba leverages and deploys on CloudFoundry - CloudFoundry Summit Europe 2016
Page 30: How dorma+kaba leverages and deploys on CloudFoundry - CloudFoundry Summit Europe 2016

State definition Workflows

Apps

EnvVars

Services

Routes

Actual State

Desired State

App Connections

Secret Stores

Page 31: How dorma+kaba leverages and deploys on CloudFoundry - CloudFoundry Summit Europe 2016

App A

EnvVars

Services

Routes

App B

Page 32: How dorma+kaba leverages and deploys on CloudFoundry - CloudFoundry Summit Europe 2016

App A

EnvVars

Services

Routes

App B

B_HOST = "https://..."B_USERNAME = "deadbeef"B_PASSWORD = "..."

Page 33: How dorma+kaba leverages and deploys on CloudFoundry - CloudFoundry Summit Europe 2016

App A

App B

App C

App D

Release

1.0.0

1.0.1

1.5.0

1.2.1

Page 34: How dorma+kaba leverages and deploys on CloudFoundry - CloudFoundry Summit Europe 2016

Release

Application Defaults

Service Mappings

Secret Stores

Deployment

Target

Page 35: How dorma+kaba leverages and deploys on CloudFoundry - CloudFoundry Summit Europe 2016

Release

Deployment

App A

App B

App C

Compiler

Deployment Configuration

Page 36: How dorma+kaba leverages and deploys on CloudFoundry - CloudFoundry Summit Europe 2016

Actual State

Desired State

Page 37: How dorma+kaba leverages and deploys on CloudFoundry - CloudFoundry Summit Europe 2016

Actual State

Desired StateDeployment Configuration

Page 38: How dorma+kaba leverages and deploys on CloudFoundry - CloudFoundry Summit Europe 2016

Actual State

Desired StateDeployment Configuration

Page 39: How dorma+kaba leverages and deploys on CloudFoundry - CloudFoundry Summit Europe 2016

Actual State

Desired StateDeployment Configuration

Workflows

Page 40: How dorma+kaba leverages and deploys on CloudFoundry - CloudFoundry Summit Europe 2016

Actual State

Desired State

const blueGreen = (deploymentConfig, api, log) =>waterfall([ init(deploymentConfig, api, log), map(api.packageApp, missing.apps), mapSeries(api.createServiceInstance, missing.services), map(api.createRoute, missing.routes), mapLimit(api.pushApp, missing.apps), map(api.setEnv, missing.envVars), map(api.stageApp, missing.apps), map(api.waitForServiceInstance, missing.services), map(api.bindService, missing.serviceBindings), map(api.startAppAndWaitForInstances, missing.apps), map(api.associateRoute, missing.unAssociatedRoutes), map(api.switchRoutes, old.routes), map(api.stopApp, old.apps), map(api.unbindService, old.serviceBindings), map(api.deleteApp, old.apps)]

);

Page 41: How dorma+kaba leverages and deploys on CloudFoundry - CloudFoundry Summit Europe 2016
Page 42: How dorma+kaba leverages and deploys on CloudFoundry - CloudFoundry Summit Europe 2016

Sophisticated application configuration

Release- & Deployment management

Target platform agnostic

Flexible, customizable workflow framework

Extensible

Open Source

Page 43: How dorma+kaba leverages and deploys on CloudFoundry - CloudFoundry Summit Europe 2016

☑ Docker Support

☑ Custom Retry Handling

☑ Retry/Error statistics

☑ Release Manifest by filesystem

What’s new?

☑ TCP Routing

Page 44: How dorma+kaba leverages and deploys on CloudFoundry - CloudFoundry Summit Europe 2016

Backed by ...

ZHAW InIT Cloud Computing Lab (ICCLab)Research Lab at School of Engineering at Zurich University of Applied Sciences (ZHAW)Working on the forefront of cloud technologies

dorma+kaba One of the top three companies in the global market for physical security and access solutions with pro forma sales of more than CHF 2 billion (USD 2.1 billion) and around 16'000 employees in more than 50 countries.

SwisscomSwitzerland's leading telecom provider and one of its leading IT companies. Cloud Foundry certified provider.

blog.zhaw.ch/icclab

www.dormakaba.com

developer.swisscom.com

Page 45: How dorma+kaba leverages and deploys on CloudFoundry - CloudFoundry Summit Europe 2016

THANKS!Any questions?You can find push2cloud at:

www.push2.cloud

github.com/push2cloud

@Push2_cloud