How dorma+kaba leverages and deploys on CloudFoundry - CloudFoundry Summit Europe 2016
-
Upload
adrai -
Category
Technology
-
view
127 -
download
13
Transcript of How dorma+kaba leverages and deploys on CloudFoundry - CloudFoundry Summit Europe 2016
How Leverages and Deploys on
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:
Who is dorma+kaba
154 + 108 years of experience
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
Urbanization
Increasing prosperity in emerging markets
Demographic change
Increasing need for security
Technology
Growth drivers shaping our industry
Our goal: innovation leadership
dorma+kaba is striving for
innovation leadership in its
industry.
What is exivo?
Our frontendapps are on
For customers, partners, market organisations, administrators, factories, support, etc...
Our backendservices are on
Business Domains, Identity Management, Web servers, API servers, etc...
Our IoTstack is on
Communication, messaging, signing service, authentication, firmware update, virtual device representation, management apis, diagnostics, etc...
Our Business Model is on
From acquisition to life cycle management...
Everythingis on
⇒ But Why?
PlatformKnow-How
ApplicationKnow-How
InfrastructureKnow-How
SysOpsDevOps
How many apps do you deploy (in parallel)?
50 Applications48 Services150 Instances
Frontend ApplicationsCustomer, Partner, RMO, Admin,Support, etc...
Business Domain30 Applications18 Services90 Instances
Backend connectionto peripheryWired Doors, Wireless Doors
IoT stack
CQRS(D)DDD
Event Sourcing
flexible
loosely-coupled
scalable
tolerant of failure
highly responsive
secure
no vendor lock-in
12-factor app methodologyshare nothing
public
virtualprivate
deploy
Our deployment journey
---
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
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
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
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);
//...
we need sophisticated,
reliable and flexible tooling
required for application
management
?
?
? ?
?
?
State definition Workflows
Apps
EnvVars
Services
Routes
Actual State
Desired State
App Connections
Secret Stores
App A
EnvVars
Services
Routes
App B
App A
EnvVars
Services
Routes
App B
B_HOST = "https://..."B_USERNAME = "deadbeef"B_PASSWORD = "..."
App A
App B
App C
App D
Release
1.0.0
1.0.1
1.5.0
1.2.1
Release
Application Defaults
Service Mappings
Secret Stores
Deployment
Target
Release
Deployment
App A
App B
App C
Compiler
Deployment Configuration
Actual State
Desired State
Actual State
Desired StateDeployment Configuration
Actual State
Desired StateDeployment Configuration
Actual State
Desired StateDeployment Configuration
Workflows
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)]
);
Sophisticated application configuration
Release- & Deployment management
Target platform agnostic
Flexible, customizable workflow framework
Extensible
Open Source
☑ Docker Support
☑ Custom Retry Handling
☑ Retry/Error statistics
☑ Release Manifest by filesystem
What’s new?
☑ TCP Routing
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
THANKS!Any questions?You can find push2cloud at:
www.push2.cloud
github.com/push2cloud
@Push2_cloud