SlideShare a Scribd company logo
1 of 69
Das kannste schon so
machen…
André Goliath
Disclaimer:
This talk is bad
Because I had no time
Because of the issues this talk is about
(makes sense, right?)
That being said…
Spring Boot & Netflix OSS Stack
WebServiceTemplate & Proxies
Jenkins & NPM
Spring Boot & Netflix OSS Stack
WebServiceTemplate & Proxies
Jenkins & NPM
You all know I´m a nice, calm, relaxed,
chilled, error-forgiving guy, right?
@ControllerAdvice
public class GlobalControllerExceptionHandler extends ResponseEntityExceptionHandler {
…
@ExceptionHandler({Exception.class})
private ResponseEntity<Object> handleAllUnknownExceptions(Exception ex) {
return handleExceptionInternal(ex, null, null,
HttpStatus.INTERNAL_SERVER_ERROR, null);
}
@Override
@ResponseBody
protected ResponseEntity<Object> handleExceptionInternal(Exception ex, Object body,
HttpHeaders headers, HttpStatus status, WebRequest request) {
BaseResponse errorMessage = createErrorMessage(ex);
HttpStatus returnStatus = status != null ? status :
HttpStatus.INTERNAL_SERVER_ERROR;
ResponseStatus exResponseStatus = AnnotationUtils.findAnnotation(ex.getClass(),
ResponseStatus.class);
if (exResponseStatus != null) {
returnStatus = exResponseStatus.value();
}
return new ResponseEntity<>(errorMessage, headers, returnStatus);
}
}
@Configuration
@EnableWebMvc
public class DispatcherServletConfigurer{
@Bean
public FSLDispatcherServletHandlerErrorConfigurator getDispatcherServletPostProcessor(){
return new FSLDispatcherServletHandlerErrorConfigurator();
}
public class FSLDispatcherServletHandlerErrorConfigurator implements BeanPostProcessor {
public Object postProcessBeforeInitialization(Object bean, String beanName) throws …{
if (bean instanceof DispatcherServlet) {
DispatcherServlet disp = ((DispatcherServlet) bean);
disp.setThrowExceptionIfNoHandlerFound(true);
}
return bean;
}
…
}
That´s so Spring Boot 1.2.x!
(1.2 was released in Dec 2014, 1.3 in Nov 2015)
spring.mvc.throw-exception-if-no-handler-found=true
spring.resources.add-mappings=false
(you still need the @ControllerAdvice though)
NETFLIX OSS
Configserver Spring Cloud Config
Service Registry eureka
Reverse Proxy zuul
Circuit Breaker hystrix
Client
Reverse Proxy
(ZUUL)
Service Registry
(EUREKA)
Config Server
So how do you deliver the configuration
for all your microservices and
environments?
HINT: NOT IN ONE BIG ZIP FILE
C:YOURSTUFFCONFIG-BAD

+---development
| global.yml
| service-a.yml
| service-b.yml
| service-c.yml
|
|
+---production
| global.yml
| service-a.yml
| service-b.yml
| service-c.yml
|
---uat
global.yml
service-a.yml
service-b.yml
service-c.yml
C:YOURSTUFFCONFIG-BAD

+---development
| global.yml
| service-a.yml
| service-b.yml
| service-c.yml
|
|
+---production
| global.yml
| service-a.yml
| service-b.yml
| service-c.yml
|
---uat
global.yml
service-a.yml
service-b.yml
service-c.yml
C:YOURSTUFFCONFIG-GOOD

|-- development.yml
|-- production.yml
|-- uat.yml
|
+---service-a
| service-a-development.yml
| service-a-production.yml
| service-a-uat.yml
|
+---service-b
| service-b-development.yml
| service-b-production.yml
| service-b-uat.yml
|
---service-c
service-c-development.yml
service-c-production.yml
service-c-uat.yml
C:YOURSTUFFCONFIG-BAD

+---development
| global.yml
| service-a.yml
| service-b.yml
| service-c.yml
|
|
+---production
| global.yml
| service-a.yml
| service-b.yml
| service-c.yml
|
---uat
global.yml
service-a.yml
service-b.yml
service-c.yml
C:YOURSTUFFCONFIG-GOOD

|-- development.yml
|-- production.yml
|-- uat.yml
|
+---service-a
| service-a-development.yml
| service-a-production.yml
| service-a-uat.yml
|
+---service-b
| service-b-development.yml
| service-b-production.yml
| service-b-uat.yml
|
---service-c
service-c-development.yml
service-c-production.yml
service-c-uat.yml
Never use
dashes In
service names!
What is that zuul anyway?
And what does it do?
AND HOW DO WE USE IT?
@SpringBootApplication
@Controller
@EnableZuulProxy
public class ZuulApplication {
public static void main(String[] args) {
new SpringApplicationBuilder(ZuulApplication.class)
.web(true).run(args);
}
}
ZUUL DOES MUCH MORE
THINGS THEN WE SEE!
NOTE TO SELF:
SPRING DOES NOT USE SEMANTIC
VERSIONING!
Lessons learned
from working with Spring
NEVER TRUST DEFAULT VALUES
READ THE FRIENDLY MANUAL…
… AND ESPECIALLY
THE RELEASE NOTES!
Spring Boot & Netflix OSS Stack
WebServiceTemplate & Proxies
Jenkins & NPM
private WebServiceTemplate attachProxy(WebServiceTemplate template) {
if (config.getUseProxy()) {
template.setProxy(new HttpHost(config.getProxyHost(),
config.getProxyPort()))
}
return template;
}
}
private WebServiceTemplate attachProxy(WebServiceTemplate template) {
if (config.getUseProxy()) {
if (senderForProxy == null) {
HttpClient client = HttpClients.custom()
.setProxy(new HttpHost(config.getProxyHost(),
config.getProxyPort()))
.build();
senderForProxy = new HttpComponentsMessageSender(client);
}
template.setMessageSender(senderForProxy);
}
return template;
}
}
org.springframework.ws.client.WebServiceIOException:
I/O error: null;
nested exception is org.apache.http.client
.ClientProtocolException
at org.springframework.ws.client.core.WebServiceTemplate
.sendAndReceive(WebServiceTemplate.java:543)
...
Caused by: org.apache.http.client.ClientProtocolException
at org.apache.http.impl.client.AbstractHttpClient.execute
(AbstractHttpClient.java:909)
... 32 more
Caused by: org.apache.http.ProtocolException:
Content-Length header already present
... 39 more
private WebServiceTemplate attachProxy(WebServiceTemplate template) {
if (config.getUseProxy()) {
if (senderForProxy == null) {
HttpClient client = HttpClients.custom()
.setProxy(new HttpHost(config.getProxyHost(),
config.getProxyPort()))
.addInterceptorFirst(
new HttpComponentsMessageSender
.RemoveSoapHeadersInterceptor()
)
.build();
senderForProxy = new HttpComponentsMessageSender(client);
}
template.setMessageSender(senderForProxy);
}
return template;
}
}
SSL Protocol Error: Handshake failure
private WebServiceTemplate attachProxy(WebServiceTemplate template) {
if (config.getUseProxy()) {
if (senderForProxy == null) {
HttpClient client = HttpClients.custom()
.useSystemProperties()
.setProxy(new HttpHost(config.getProxyHost(),
config.getProxyPort()))
.addInterceptorFirst(
new HttpComponentsMessageSender
.RemoveSoapHeadersInterceptor()
)
.build();
senderForProxy = new HttpComponentsMessageSender(client);
}
template.setMessageSender(senderForProxy);
}
return template;
}
}
400
(a.k.a. „Bad Request“)
400
(a.k.a. least helpful HTTP
response code of all times.)
…5 Hours of HTTP traffic
comparison later…
SOAP-Namespaces?
Am I missing any HTTP header?
Malformed XML?
No Proxy allowed?
Still SSL issues?
…5 Hours of HTTP traffic
comparison later…
Am I missing any HTTP header?
I am sending one header too much.
Am I missing any HTTP header?
private WebServiceTemplate attachProxy(WebServiceTemplate template) {
if (config.getUseProxy()) {
if (senderForProxy == null) {
HttpClient client = HttpClients.custom()
.useSystemProperties()
.setProxy(new HttpHost(config.getProxyHost(),
config.getProxyPort()))
.addInterceptorFirst(
new HttpComponentsMessageSender
.RemoveSoapHeadersInterceptor()
)
.build();
senderForProxy = new HttpComponentsMessageSender(client);
senderForProxy.setAcceptGzipEncoding(false);
}
template.setMessageSender(senderForProxy);
}
return template;
}
}
It took me about 5 full days
to get this right.
Lessons learned
from the proxy disaster
Have the same
communication infrastructure
on every(!) test setup
No Proxy? Make your own.
var http = require('http'),
httpProxy = require('http-proxy');
var proxy = httpProxy.createProxyServer({});
var interceptingServer = http.createServer(function (req, res) {
// define your custom logic to handle the request
// and then proxy the request.
proxy.web(req, res, {target: 'http://MyActualTargetService.com'});
});
console.log("proxy listening on port 5050")
interceptingServer.listen(5050);
https://github.com/nodejitsu/node-http-proxy
Talking about JavaScript…
Spring Boot & Netflix OSS Stack
WebServiceTemplate & Proxies
Jenkins & NPM
Node Package Manager v2
is bad. Like, really bad.
So what’s the big deal?
npm install
…on Senacor Hardware: 15 min
…on Clients Dev. Machine: 20 min
…on Jenkins: . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Filesystem Size Used Avail Use% Mounted on
...
/dev/mapper/datavg-lv_optsoftware
492G 22G 446G 5% /opt/software
Filesystem Size Used Avail Use% Mounted on
...
/dev/mapper/datavg-lv_optsoftware
492G 22G 446G 5% /opt/software
Filesystem Inodes IUsed IFree IUse% Mounted on
...
/dev/mapper/datavg-lv_optsoftware
32768000 32428987 39013 99% /opt/software
Filesystem Size Used Avail Use% Mounted on
...
/dev/mapper/datavg-lv_optsoftware
492G 22G 446G 5% /opt/software
Filesystem Inodes IUsed IFree IUse% Mounted on
...
/dev/mapper/datavg-lv_optsoftware
32768000 32428987 39013 99% /opt/software
I lost track when the deepest node_modules path
was about 2000 chars long…
npm dedupe would help,
but only if npm install worked
at least once…
Beware:
Npm3 will be the default package
manager starting with nodejs 5.x,
and is a breaking change:
Lessons learned:
We started the project when
NodeJS 4.x and npm 3.x
were still unstable.
That time is gone. Go for it.
Thank You!
André Goliath
Senior Technical Consultant
andre.goliath@senacor.de

More Related Content

What's hot

Going Node At Netflix
Going Node At NetflixGoing Node At Netflix
Going Node At NetflixRyan Anklam
 
Lock That Shit Down! Auth Security Patterns for Apps, APIs, and Infra - Sprin...
Lock That Shit Down! Auth Security Patterns for Apps, APIs, and Infra - Sprin...Lock That Shit Down! Auth Security Patterns for Apps, APIs, and Infra - Sprin...
Lock That Shit Down! Auth Security Patterns for Apps, APIs, and Infra - Sprin...Matt Raible
 
When Web meet Native App
When Web meet Native AppWhen Web meet Native App
When Web meet Native AppYu-Wei Chuang
 
High Performance JavaScript - jQuery Conference SF Bay Area 2010
High Performance JavaScript - jQuery Conference SF Bay Area 2010High Performance JavaScript - jQuery Conference SF Bay Area 2010
High Performance JavaScript - jQuery Conference SF Bay Area 2010Nicholas Zakas
 
Modern UI Development With Node.js
Modern UI Development With Node.jsModern UI Development With Node.js
Modern UI Development With Node.jsRyan Anklam
 
High Performance JavaScript - WebDirections USA 2010
High Performance JavaScript - WebDirections USA 2010High Performance JavaScript - WebDirections USA 2010
High Performance JavaScript - WebDirections USA 2010Nicholas Zakas
 
探討Web ui自動化測試工具
探討Web ui自動化測試工具探討Web ui自動化測試工具
探討Web ui自動化測試工具政億 林
 
High Performance Snippets
High Performance SnippetsHigh Performance Snippets
High Performance SnippetsSteve Souders
 
Deploying JHipster Microservices
Deploying JHipster MicroservicesDeploying JHipster Microservices
Deploying JHipster MicroservicesJoe Kutner
 
High Performance JavaScript 2011
High Performance JavaScript 2011High Performance JavaScript 2011
High Performance JavaScript 2011Nicholas Zakas
 
10 Excellent Ways to Secure Spring Boot Applications - Okta Webinar 2020
10 Excellent Ways to Secure Spring Boot Applications - Okta Webinar 202010 Excellent Ways to Secure Spring Boot Applications - Okta Webinar 2020
10 Excellent Ways to Secure Spring Boot Applications - Okta Webinar 2020Matt Raible
 
The Play Framework at LinkedIn
The Play Framework at LinkedInThe Play Framework at LinkedIn
The Play Framework at LinkedInYevgeniy Brikman
 
Bootiful Development with Spring Boot and React - SpringOne 2017
Bootiful Development with Spring Boot and React - SpringOne 2017Bootiful Development with Spring Boot and React - SpringOne 2017
Bootiful Development with Spring Boot and React - SpringOne 2017Matt Raible
 
Microservices for the Masses with Spring Boot, JHipster, and JWT - Rich Web 2016
Microservices for the Masses with Spring Boot, JHipster, and JWT - Rich Web 2016Microservices for the Masses with Spring Boot, JHipster, and JWT - Rich Web 2016
Microservices for the Masses with Spring Boot, JHipster, and JWT - Rich Web 2016Matt Raible
 
JavaOne India 2011 - Running your Java EE 6 Apps in the Cloud
JavaOne India 2011 - Running your Java EE 6 Apps in the CloudJavaOne India 2011 - Running your Java EE 6 Apps in the Cloud
JavaOne India 2011 - Running your Java EE 6 Apps in the CloudArun Gupta
 
Java REST API Framework Comparison - PWX 2021
Java REST API Framework Comparison - PWX 2021Java REST API Framework Comparison - PWX 2021
Java REST API Framework Comparison - PWX 2021Matt Raible
 
Introduction to Node.js
Introduction to Node.jsIntroduction to Node.js
Introduction to Node.jsVikash Singh
 

What's hot (20)

Cache is King
Cache is KingCache is King
Cache is King
 
Going Node At Netflix
Going Node At NetflixGoing Node At Netflix
Going Node At Netflix
 
Lock That Shit Down! Auth Security Patterns for Apps, APIs, and Infra - Sprin...
Lock That Shit Down! Auth Security Patterns for Apps, APIs, and Infra - Sprin...Lock That Shit Down! Auth Security Patterns for Apps, APIs, and Infra - Sprin...
Lock That Shit Down! Auth Security Patterns for Apps, APIs, and Infra - Sprin...
 
When Web meet Native App
When Web meet Native AppWhen Web meet Native App
When Web meet Native App
 
High Performance JavaScript - jQuery Conference SF Bay Area 2010
High Performance JavaScript - jQuery Conference SF Bay Area 2010High Performance JavaScript - jQuery Conference SF Bay Area 2010
High Performance JavaScript - jQuery Conference SF Bay Area 2010
 
Modern UI Development With Node.js
Modern UI Development With Node.jsModern UI Development With Node.js
Modern UI Development With Node.js
 
High Performance JavaScript - WebDirections USA 2010
High Performance JavaScript - WebDirections USA 2010High Performance JavaScript - WebDirections USA 2010
High Performance JavaScript - WebDirections USA 2010
 
Node.js vs Play Framework
Node.js vs Play FrameworkNode.js vs Play Framework
Node.js vs Play Framework
 
探討Web ui自動化測試工具
探討Web ui自動化測試工具探討Web ui自動化測試工具
探討Web ui自動化測試工具
 
High Performance Snippets
High Performance SnippetsHigh Performance Snippets
High Performance Snippets
 
Deploying JHipster Microservices
Deploying JHipster MicroservicesDeploying JHipster Microservices
Deploying JHipster Microservices
 
High Performance JavaScript 2011
High Performance JavaScript 2011High Performance JavaScript 2011
High Performance JavaScript 2011
 
10 Excellent Ways to Secure Spring Boot Applications - Okta Webinar 2020
10 Excellent Ways to Secure Spring Boot Applications - Okta Webinar 202010 Excellent Ways to Secure Spring Boot Applications - Okta Webinar 2020
10 Excellent Ways to Secure Spring Boot Applications - Okta Webinar 2020
 
The Play Framework at LinkedIn
The Play Framework at LinkedInThe Play Framework at LinkedIn
The Play Framework at LinkedIn
 
Bootiful Development with Spring Boot and React - SpringOne 2017
Bootiful Development with Spring Boot and React - SpringOne 2017Bootiful Development with Spring Boot and React - SpringOne 2017
Bootiful Development with Spring Boot and React - SpringOne 2017
 
Microservices for the Masses with Spring Boot, JHipster, and JWT - Rich Web 2016
Microservices for the Masses with Spring Boot, JHipster, and JWT - Rich Web 2016Microservices for the Masses with Spring Boot, JHipster, and JWT - Rich Web 2016
Microservices for the Masses with Spring Boot, JHipster, and JWT - Rich Web 2016
 
JavaOne India 2011 - Running your Java EE 6 Apps in the Cloud
JavaOne India 2011 - Running your Java EE 6 Apps in the CloudJavaOne India 2011 - Running your Java EE 6 Apps in the Cloud
JavaOne India 2011 - Running your Java EE 6 Apps in the Cloud
 
Java REST API Framework Comparison - PWX 2021
Java REST API Framework Comparison - PWX 2021Java REST API Framework Comparison - PWX 2021
Java REST API Framework Comparison - PWX 2021
 
Introduction to Node.js
Introduction to Node.jsIntroduction to Node.js
Introduction to Node.js
 
Night Watch with QA
Night Watch with QANight Watch with QA
Night Watch with QA
 

Viewers also liked

Microservices: Architecture for the Real-time Organization
Microservices: Architecture for the Real-time OrganizationMicroservices: Architecture for the Real-time Organization
Microservices: Architecture for the Real-time OrganizationKevin Webber
 
Domain Driven Design Introduction
Domain Driven Design IntroductionDomain Driven Design Introduction
Domain Driven Design IntroductionTung Nguyen Thanh
 
5 Anti-Patterns in API Design - DDD East Anglia 2015
5 Anti-Patterns in API Design - DDD East Anglia 20155 Anti-Patterns in API Design - DDD East Anglia 2015
5 Anti-Patterns in API Design - DDD East Anglia 2015Ali Kheyrollahi
 
Domain Driven Design with the F# type System -- F#unctional Londoners 2014
Domain Driven Design with the F# type System -- F#unctional Londoners 2014Domain Driven Design with the F# type System -- F#unctional Londoners 2014
Domain Driven Design with the F# type System -- F#unctional Londoners 2014Scott Wlaschin
 
10 Tips for failing at microservices
10 Tips for failing at microservices10 Tips for failing at microservices
10 Tips for failing at microservicesDavid Schmitz
 
DDD patterns that were not in the book
DDD patterns that were not in the bookDDD patterns that were not in the book
DDD patterns that were not in the bookCyrille Martraire
 
How to Make Awesome SlideShares: Tips & Tricks
How to Make Awesome SlideShares: Tips & TricksHow to Make Awesome SlideShares: Tips & Tricks
How to Make Awesome SlideShares: Tips & TricksSlideShare
 
Getting Started With SlideShare
Getting Started With SlideShareGetting Started With SlideShare
Getting Started With SlideShareSlideShare
 

Viewers also liked (9)

Microservices: Architecture for the Real-time Organization
Microservices: Architecture for the Real-time OrganizationMicroservices: Architecture for the Real-time Organization
Microservices: Architecture for the Real-time Organization
 
Domain Driven Design Introduction
Domain Driven Design IntroductionDomain Driven Design Introduction
Domain Driven Design Introduction
 
Domain Driven Design 101
Domain Driven Design 101Domain Driven Design 101
Domain Driven Design 101
 
5 Anti-Patterns in API Design - DDD East Anglia 2015
5 Anti-Patterns in API Design - DDD East Anglia 20155 Anti-Patterns in API Design - DDD East Anglia 2015
5 Anti-Patterns in API Design - DDD East Anglia 2015
 
Domain Driven Design with the F# type System -- F#unctional Londoners 2014
Domain Driven Design with the F# type System -- F#unctional Londoners 2014Domain Driven Design with the F# type System -- F#unctional Londoners 2014
Domain Driven Design with the F# type System -- F#unctional Londoners 2014
 
10 Tips for failing at microservices
10 Tips for failing at microservices10 Tips for failing at microservices
10 Tips for failing at microservices
 
DDD patterns that were not in the book
DDD patterns that were not in the bookDDD patterns that were not in the book
DDD patterns that were not in the book
 
How to Make Awesome SlideShares: Tips & Tricks
How to Make Awesome SlideShares: Tips & TricksHow to Make Awesome SlideShares: Tips & Tricks
How to Make Awesome SlideShares: Tips & Tricks
 
Getting Started With SlideShare
Getting Started With SlideShareGetting Started With SlideShare
Getting Started With SlideShare
 

Similar to Das kannste schon so machen

"Applied Enterprise Metaprogramming in JavaScript", Vladyslav Dukhin
"Applied Enterprise Metaprogramming in JavaScript", Vladyslav Dukhin"Applied Enterprise Metaprogramming in JavaScript", Vladyslav Dukhin
"Applied Enterprise Metaprogramming in JavaScript", Vladyslav DukhinFwdays
 
Testing frontends with nightwatch & saucelabs
Testing frontends with nightwatch & saucelabsTesting frontends with nightwatch & saucelabs
Testing frontends with nightwatch & saucelabsTudor Barbu
 
Javascript unit testing, yes we can e big
Javascript unit testing, yes we can   e bigJavascript unit testing, yes we can   e big
Javascript unit testing, yes we can e bigAndy Peterson
 
Workshop 23: ReactJS, React & Redux testing
Workshop 23: ReactJS, React & Redux testingWorkshop 23: ReactJS, React & Redux testing
Workshop 23: ReactJS, React & Redux testingVisual Engineering
 
soft-shake.ch - Hands on Node.js
soft-shake.ch - Hands on Node.jssoft-shake.ch - Hands on Node.js
soft-shake.ch - Hands on Node.jssoft-shake.ch
 
33rd Degree 2013, Bad Tests, Good Tests
33rd Degree 2013, Bad Tests, Good Tests33rd Degree 2013, Bad Tests, Good Tests
33rd Degree 2013, Bad Tests, Good TestsTomek Kaczanowski
 
HTML5 for the Silverlight Guy
HTML5 for the Silverlight GuyHTML5 for the Silverlight Guy
HTML5 for the Silverlight GuyDavid Padbury
 
JavaScript Growing Up
JavaScript Growing UpJavaScript Growing Up
JavaScript Growing UpDavid Padbury
 
Experienced Selenium Interview questions
Experienced Selenium Interview questionsExperienced Selenium Interview questions
Experienced Selenium Interview questionsarchana singh
 
Writing robust Node.js applications
Writing robust Node.js applicationsWriting robust Node.js applications
Writing robust Node.js applicationsTom Croucher
 
Protractor framework architecture with example
Protractor framework architecture with exampleProtractor framework architecture with example
Protractor framework architecture with exampleshadabgilani
 
GeeCON 2017 - TestContainers. Integration testing without the hassle
GeeCON 2017 - TestContainers. Integration testing without the hassleGeeCON 2017 - TestContainers. Integration testing without the hassle
GeeCON 2017 - TestContainers. Integration testing without the hassleAnton Arhipov
 
Release with confidence
Release with confidenceRelease with confidence
Release with confidenceJohn Congdon
 
Construire une application JavaFX 8 avec gradle
Construire une application JavaFX 8 avec gradleConstruire une application JavaFX 8 avec gradle
Construire une application JavaFX 8 avec gradleThierry Wasylczenko
 
Future Decoded - Node.js per sviluppatori .NET
Future Decoded - Node.js per sviluppatori .NETFuture Decoded - Node.js per sviluppatori .NET
Future Decoded - Node.js per sviluppatori .NETGianluca Carucci
 
Server side JavaScript: going all the way
Server side JavaScript: going all the wayServer side JavaScript: going all the way
Server side JavaScript: going all the wayOleg Podsechin
 
Node.js vs Play Framework (with Japanese subtitles)
Node.js vs Play Framework (with Japanese subtitles)Node.js vs Play Framework (with Japanese subtitles)
Node.js vs Play Framework (with Japanese subtitles)Yevgeniy Brikman
 

Similar to Das kannste schon so machen (20)

"Applied Enterprise Metaprogramming in JavaScript", Vladyslav Dukhin
"Applied Enterprise Metaprogramming in JavaScript", Vladyslav Dukhin"Applied Enterprise Metaprogramming in JavaScript", Vladyslav Dukhin
"Applied Enterprise Metaprogramming in JavaScript", Vladyslav Dukhin
 
Testing frontends with nightwatch & saucelabs
Testing frontends with nightwatch & saucelabsTesting frontends with nightwatch & saucelabs
Testing frontends with nightwatch & saucelabs
 
Javascript unit testing, yes we can e big
Javascript unit testing, yes we can   e bigJavascript unit testing, yes we can   e big
Javascript unit testing, yes we can e big
 
Workshop 23: ReactJS, React & Redux testing
Workshop 23: ReactJS, React & Redux testingWorkshop 23: ReactJS, React & Redux testing
Workshop 23: ReactJS, React & Redux testing
 
Having Fun with Play
Having Fun with PlayHaving Fun with Play
Having Fun with Play
 
soft-shake.ch - Hands on Node.js
soft-shake.ch - Hands on Node.jssoft-shake.ch - Hands on Node.js
soft-shake.ch - Hands on Node.js
 
33rd Degree 2013, Bad Tests, Good Tests
33rd Degree 2013, Bad Tests, Good Tests33rd Degree 2013, Bad Tests, Good Tests
33rd Degree 2013, Bad Tests, Good Tests
 
HTML5 for the Silverlight Guy
HTML5 for the Silverlight GuyHTML5 for the Silverlight Guy
HTML5 for the Silverlight Guy
 
JavaScript Growing Up
JavaScript Growing UpJavaScript Growing Up
JavaScript Growing Up
 
Experienced Selenium Interview questions
Experienced Selenium Interview questionsExperienced Selenium Interview questions
Experienced Selenium Interview questions
 
Writing robust Node.js applications
Writing robust Node.js applicationsWriting robust Node.js applications
Writing robust Node.js applications
 
Protractor framework architecture with example
Protractor framework architecture with exampleProtractor framework architecture with example
Protractor framework architecture with example
 
GeeCON 2017 - TestContainers. Integration testing without the hassle
GeeCON 2017 - TestContainers. Integration testing without the hassleGeeCON 2017 - TestContainers. Integration testing without the hassle
GeeCON 2017 - TestContainers. Integration testing without the hassle
 
Release with confidence
Release with confidenceRelease with confidence
Release with confidence
 
Construire une application JavaFX 8 avec gradle
Construire une application JavaFX 8 avec gradleConstruire une application JavaFX 8 avec gradle
Construire une application JavaFX 8 avec gradle
 
Gwt.create
Gwt.createGwt.create
Gwt.create
 
Future Decoded - Node.js per sviluppatori .NET
Future Decoded - Node.js per sviluppatori .NETFuture Decoded - Node.js per sviluppatori .NET
Future Decoded - Node.js per sviluppatori .NET
 
JS everywhere 2011
JS everywhere 2011JS everywhere 2011
JS everywhere 2011
 
Server side JavaScript: going all the way
Server side JavaScript: going all the wayServer side JavaScript: going all the way
Server side JavaScript: going all the way
 
Node.js vs Play Framework (with Japanese subtitles)
Node.js vs Play Framework (with Japanese subtitles)Node.js vs Play Framework (with Japanese subtitles)
Node.js vs Play Framework (with Japanese subtitles)
 

Recently uploaded

DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenHervé Boutemy
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Manik S Magar
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Mattias Andersson
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfAlex Barbosa Coqueiro
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupFlorian Wilhelm
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brandgvaughan
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii SoldatenkoFwdays
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsSergiu Bodiu
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek SchlawackFwdays
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsRizwan Syed
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfAddepto
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piececharlottematthew16
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxLoriGlavin3
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyAlfredo García Lavilla
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr BaganFwdays
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningLars Bell
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):comworks
 

Recently uploaded (20)

DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache Maven
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdf
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project Setup
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brand
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platforms
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL Certs
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdf
 
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptxE-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piece
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easy
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine Tuning
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):
 

Das kannste schon so machen

  • 1. Das kannste schon so machen… André Goliath
  • 2. Disclaimer: This talk is bad Because I had no time Because of the issues this talk is about
  • 5.
  • 6. Spring Boot & Netflix OSS Stack WebServiceTemplate & Proxies Jenkins & NPM
  • 7. Spring Boot & Netflix OSS Stack WebServiceTemplate & Proxies Jenkins & NPM
  • 8. You all know I´m a nice, calm, relaxed, chilled, error-forgiving guy, right?
  • 9.
  • 10. @ControllerAdvice public class GlobalControllerExceptionHandler extends ResponseEntityExceptionHandler { … @ExceptionHandler({Exception.class}) private ResponseEntity<Object> handleAllUnknownExceptions(Exception ex) { return handleExceptionInternal(ex, null, null, HttpStatus.INTERNAL_SERVER_ERROR, null); } @Override @ResponseBody protected ResponseEntity<Object> handleExceptionInternal(Exception ex, Object body, HttpHeaders headers, HttpStatus status, WebRequest request) { BaseResponse errorMessage = createErrorMessage(ex); HttpStatus returnStatus = status != null ? status : HttpStatus.INTERNAL_SERVER_ERROR; ResponseStatus exResponseStatus = AnnotationUtils.findAnnotation(ex.getClass(), ResponseStatus.class); if (exResponseStatus != null) { returnStatus = exResponseStatus.value(); } return new ResponseEntity<>(errorMessage, headers, returnStatus); } }
  • 11. @Configuration @EnableWebMvc public class DispatcherServletConfigurer{ @Bean public FSLDispatcherServletHandlerErrorConfigurator getDispatcherServletPostProcessor(){ return new FSLDispatcherServletHandlerErrorConfigurator(); } public class FSLDispatcherServletHandlerErrorConfigurator implements BeanPostProcessor { public Object postProcessBeforeInitialization(Object bean, String beanName) throws …{ if (bean instanceof DispatcherServlet) { DispatcherServlet disp = ((DispatcherServlet) bean); disp.setThrowExceptionIfNoHandlerFound(true); } return bean; } … }
  • 12. That´s so Spring Boot 1.2.x! (1.2 was released in Dec 2014, 1.3 in Nov 2015)
  • 15. Configserver Spring Cloud Config Service Registry eureka Reverse Proxy zuul Circuit Breaker hystrix
  • 17. So how do you deliver the configuration for all your microservices and environments?
  • 18. HINT: NOT IN ONE BIG ZIP FILE
  • 19. C:YOURSTUFFCONFIG-BAD +---development | global.yml | service-a.yml | service-b.yml | service-c.yml | | +---production | global.yml | service-a.yml | service-b.yml | service-c.yml | ---uat global.yml service-a.yml service-b.yml service-c.yml
  • 20. C:YOURSTUFFCONFIG-BAD +---development | global.yml | service-a.yml | service-b.yml | service-c.yml | | +---production | global.yml | service-a.yml | service-b.yml | service-c.yml | ---uat global.yml service-a.yml service-b.yml service-c.yml C:YOURSTUFFCONFIG-GOOD |-- development.yml |-- production.yml |-- uat.yml | +---service-a | service-a-development.yml | service-a-production.yml | service-a-uat.yml | +---service-b | service-b-development.yml | service-b-production.yml | service-b-uat.yml | ---service-c service-c-development.yml service-c-production.yml service-c-uat.yml
  • 21. C:YOURSTUFFCONFIG-BAD +---development | global.yml | service-a.yml | service-b.yml | service-c.yml | | +---production | global.yml | service-a.yml | service-b.yml | service-c.yml | ---uat global.yml service-a.yml service-b.yml service-c.yml C:YOURSTUFFCONFIG-GOOD |-- development.yml |-- production.yml |-- uat.yml | +---service-a | service-a-development.yml | service-a-production.yml | service-a-uat.yml | +---service-b | service-b-development.yml | service-b-production.yml | service-b-uat.yml | ---service-c service-c-development.yml service-c-production.yml service-c-uat.yml Never use dashes In service names!
  • 22. What is that zuul anyway? And what does it do? AND HOW DO WE USE IT?
  • 23. @SpringBootApplication @Controller @EnableZuulProxy public class ZuulApplication { public static void main(String[] args) { new SpringApplicationBuilder(ZuulApplication.class) .web(true).run(args); } }
  • 24. ZUUL DOES MUCH MORE THINGS THEN WE SEE!
  • 25.
  • 26. NOTE TO SELF: SPRING DOES NOT USE SEMANTIC VERSIONING!
  • 27.
  • 28.
  • 31. READ THE FRIENDLY MANUAL…
  • 32. … AND ESPECIALLY THE RELEASE NOTES!
  • 33. Spring Boot & Netflix OSS Stack WebServiceTemplate & Proxies Jenkins & NPM
  • 34. private WebServiceTemplate attachProxy(WebServiceTemplate template) { if (config.getUseProxy()) { template.setProxy(new HttpHost(config.getProxyHost(), config.getProxyPort())) } return template; } }
  • 35. private WebServiceTemplate attachProxy(WebServiceTemplate template) { if (config.getUseProxy()) { if (senderForProxy == null) { HttpClient client = HttpClients.custom() .setProxy(new HttpHost(config.getProxyHost(), config.getProxyPort())) .build(); senderForProxy = new HttpComponentsMessageSender(client); } template.setMessageSender(senderForProxy); } return template; } }
  • 36. org.springframework.ws.client.WebServiceIOException: I/O error: null; nested exception is org.apache.http.client .ClientProtocolException at org.springframework.ws.client.core.WebServiceTemplate .sendAndReceive(WebServiceTemplate.java:543) ... Caused by: org.apache.http.client.ClientProtocolException at org.apache.http.impl.client.AbstractHttpClient.execute (AbstractHttpClient.java:909) ... 32 more Caused by: org.apache.http.ProtocolException: Content-Length header already present ... 39 more
  • 37.
  • 38. private WebServiceTemplate attachProxy(WebServiceTemplate template) { if (config.getUseProxy()) { if (senderForProxy == null) { HttpClient client = HttpClients.custom() .setProxy(new HttpHost(config.getProxyHost(), config.getProxyPort())) .addInterceptorFirst( new HttpComponentsMessageSender .RemoveSoapHeadersInterceptor() ) .build(); senderForProxy = new HttpComponentsMessageSender(client); } template.setMessageSender(senderForProxy); } return template; } }
  • 39. SSL Protocol Error: Handshake failure
  • 40.
  • 41. private WebServiceTemplate attachProxy(WebServiceTemplate template) { if (config.getUseProxy()) { if (senderForProxy == null) { HttpClient client = HttpClients.custom() .useSystemProperties() .setProxy(new HttpHost(config.getProxyHost(), config.getProxyPort())) .addInterceptorFirst( new HttpComponentsMessageSender .RemoveSoapHeadersInterceptor() ) .build(); senderForProxy = new HttpComponentsMessageSender(client); } template.setMessageSender(senderForProxy); } return template; } }
  • 42.
  • 44. 400 (a.k.a. least helpful HTTP response code of all times.)
  • 45. …5 Hours of HTTP traffic comparison later… SOAP-Namespaces? Am I missing any HTTP header? Malformed XML? No Proxy allowed? Still SSL issues?
  • 46. …5 Hours of HTTP traffic comparison later… Am I missing any HTTP header?
  • 47.
  • 48. I am sending one header too much. Am I missing any HTTP header?
  • 49. private WebServiceTemplate attachProxy(WebServiceTemplate template) { if (config.getUseProxy()) { if (senderForProxy == null) { HttpClient client = HttpClients.custom() .useSystemProperties() .setProxy(new HttpHost(config.getProxyHost(), config.getProxyPort())) .addInterceptorFirst( new HttpComponentsMessageSender .RemoveSoapHeadersInterceptor() ) .build(); senderForProxy = new HttpComponentsMessageSender(client); senderForProxy.setAcceptGzipEncoding(false); } template.setMessageSender(senderForProxy); } return template; } }
  • 50. It took me about 5 full days to get this right.
  • 51. Lessons learned from the proxy disaster
  • 52. Have the same communication infrastructure on every(!) test setup
  • 53. No Proxy? Make your own. var http = require('http'), httpProxy = require('http-proxy'); var proxy = httpProxy.createProxyServer({}); var interceptingServer = http.createServer(function (req, res) { // define your custom logic to handle the request // and then proxy the request. proxy.web(req, res, {target: 'http://MyActualTargetService.com'}); }); console.log("proxy listening on port 5050") interceptingServer.listen(5050); https://github.com/nodejitsu/node-http-proxy
  • 55. Spring Boot & Netflix OSS Stack WebServiceTemplate & Proxies Jenkins & NPM
  • 56.
  • 57. Node Package Manager v2 is bad. Like, really bad.
  • 58.
  • 59.
  • 60.
  • 61. So what’s the big deal?
  • 62. npm install …on Senacor Hardware: 15 min …on Clients Dev. Machine: 20 min …on Jenkins: . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
  • 63. Filesystem Size Used Avail Use% Mounted on ... /dev/mapper/datavg-lv_optsoftware 492G 22G 446G 5% /opt/software
  • 64. Filesystem Size Used Avail Use% Mounted on ... /dev/mapper/datavg-lv_optsoftware 492G 22G 446G 5% /opt/software Filesystem Inodes IUsed IFree IUse% Mounted on ... /dev/mapper/datavg-lv_optsoftware 32768000 32428987 39013 99% /opt/software
  • 65. Filesystem Size Used Avail Use% Mounted on ... /dev/mapper/datavg-lv_optsoftware 492G 22G 446G 5% /opt/software Filesystem Inodes IUsed IFree IUse% Mounted on ... /dev/mapper/datavg-lv_optsoftware 32768000 32428987 39013 99% /opt/software I lost track when the deepest node_modules path was about 2000 chars long…
  • 66. npm dedupe would help, but only if npm install worked at least once…
  • 67. Beware: Npm3 will be the default package manager starting with nodejs 5.x, and is a breaking change:
  • 68. Lessons learned: We started the project when NodeJS 4.x and npm 3.x were still unstable. That time is gone. Go for it.
  • 69. Thank You! André Goliath Senior Technical Consultant andre.goliath@senacor.de

Editor's Notes

  1. 1
  2. 5
  3. 2
  4. 3
  5. 3
  6. 4
  7. 5
  8. 6
  9. 7
  10. 7
  11. 8
  12. 9
  13. 10
  14. 12
  15. 13
  16. 15
  17. 16
  18. 17
  19. 18
  20. 19
  21. 20
  22. 21
  23. 22
  24. 23
  25. 24
  26. 25
  27. 26
  28. 26
  29. 28
  30. 29
  31. 30
  32. 31
  33. 31
  34. 32
  35. 32
  36. 5
  37. 33
  38. 5
  39. 34
  40. 35
  41. 35
  42. 36
  43. 37
  44. 38
  45. 38
  46. 39
  47. 40
  48. 5
  49. 5
  50. 41
  51. 41
  52. 43
  53. 43
  54. 45
  55. 47
  56. 5
  57. 5
  58. 5
  59. 5
  60. 5
  61. 5