Download - SVQDC 2017 Tecnologías para Microservicios
![Page 1: SVQDC 2017 Tecnologías para Microservicios](https://reader033.vdocumento.com/reader033/viewer/2022051707/58b896b71a28ab3e3a8b6b83/html5/thumbnails/1.jpg)
Sevilla Developer Conference
#SVQDC 2017.02.18
![Page 2: SVQDC 2017 Tecnologías para Microservicios](https://reader033.vdocumento.com/reader033/viewer/2022051707/58b896b71a28ab3e3a8b6b83/html5/thumbnails/2.jpg)
![Page 3: SVQDC 2017 Tecnologías para Microservicios](https://reader033.vdocumento.com/reader033/viewer/2022051707/58b896b71a28ab3e3a8b6b83/html5/thumbnails/3.jpg)
![Page 4: SVQDC 2017 Tecnologías para Microservicios](https://reader033.vdocumento.com/reader033/viewer/2022051707/58b896b71a28ab3e3a8b6b83/html5/thumbnails/4.jpg)
Pedro J. Molina@pmolinam
![Page 5: SVQDC 2017 Tecnologías para Microservicios](https://reader033.vdocumento.com/reader033/viewer/2022051707/58b896b71a28ab3e3a8b6b83/html5/thumbnails/5.jpg)
![Page 7: SVQDC 2017 Tecnologías para Microservicios](https://reader033.vdocumento.com/reader033/viewer/2022051707/58b896b71a28ab3e3a8b6b83/html5/thumbnails/7.jpg)
![Page 8: SVQDC 2017 Tecnologías para Microservicios](https://reader033.vdocumento.com/reader033/viewer/2022051707/58b896b71a28ab3e3a8b6b83/html5/thumbnails/8.jpg)
![Page 9: SVQDC 2017 Tecnologías para Microservicios](https://reader033.vdocumento.com/reader033/viewer/2022051707/58b896b71a28ab3e3a8b6b83/html5/thumbnails/9.jpg)
![Page 10: SVQDC 2017 Tecnologías para Microservicios](https://reader033.vdocumento.com/reader033/viewer/2022051707/58b896b71a28ab3e3a8b6b83/html5/thumbnails/10.jpg)
![Page 11: SVQDC 2017 Tecnologías para Microservicios](https://reader033.vdocumento.com/reader033/viewer/2022051707/58b896b71a28ab3e3a8b6b83/html5/thumbnails/11.jpg)
“Las organizaciones que diseñan sistemas están limitadasa producir diseños que copian las estructuras de comunicación de esas organizaciones”.
Melvin Conway, 1968
![Page 12: SVQDC 2017 Tecnologías para Microservicios](https://reader033.vdocumento.com/reader033/viewer/2022051707/58b896b71a28ab3e3a8b6b83/html5/thumbnails/12.jpg)
![Page 13: SVQDC 2017 Tecnologías para Microservicios](https://reader033.vdocumento.com/reader033/viewer/2022051707/58b896b71a28ab3e3a8b6b83/html5/thumbnails/13.jpg)
application/json text/xml text/html text/plain text/csv
GET /actors/42Accept: text/xml
200 OKContent-Type: text/xml
<actor id="42"><name>Jessica</name><lastname>Alba</lastname><filmography
url= "/films/42" /></actor>
![Page 14: SVQDC 2017 Tecnologías para Microservicios](https://reader033.vdocumento.com/reader033/viewer/2022051707/58b896b71a28ab3e3a8b6b83/html5/thumbnails/14.jpg)
GET /actors/42Accept: application/json
200 OKContent-Type: application/json
{ "id": 42"name": "Jessica""lastname": "Alba""filmography": "/films/42"
}
![Page 15: SVQDC 2017 Tecnologías para Microservicios](https://reader033.vdocumento.com/reader033/viewer/2022051707/58b896b71a28ab3e3a8b6b83/html5/thumbnails/15.jpg)
GET /factura/217
POST /factura/ 201 Created
<link rel=“lineas”
uri=“/factura/217/lineas” />
![Page 16: SVQDC 2017 Tecnologías para Microservicios](https://reader033.vdocumento.com/reader033/viewer/2022051707/58b896b71a28ab3e3a8b6b83/html5/thumbnails/16.jpg)
![Page 17: SVQDC 2017 Tecnologías para Microservicios](https://reader033.vdocumento.com/reader033/viewer/2022051707/58b896b71a28ab3e3a8b6b83/html5/thumbnails/17.jpg)
{
“id”: 1234
“name”: “Alice in Wonderland”
“_links”: {
“self”: { “href”: “/book/10”},
“prev”: { “href”: “/book/9”},
“next”: { “href”: “/book/11”},
“action-delete”: {
“verb”: “DELETE”,
“href”: “/book/10”
}
}
}
![Page 18: SVQDC 2017 Tecnologías para Microservicios](https://reader033.vdocumento.com/reader033/viewer/2022051707/58b896b71a28ab3e3a8b6b83/html5/thumbnails/18.jpg)
![Page 19: SVQDC 2017 Tecnologías para Microservicios](https://reader033.vdocumento.com/reader033/viewer/2022051707/58b896b71a28ab3e3a8b6b83/html5/thumbnails/19.jpg)
![Page 20: SVQDC 2017 Tecnologías para Microservicios](https://reader033.vdocumento.com/reader033/viewer/2022051707/58b896b71a28ab3e3a8b6b83/html5/thumbnails/20.jpg)
![Page 21: SVQDC 2017 Tecnologías para Microservicios](https://reader033.vdocumento.com/reader033/viewer/2022051707/58b896b71a28ab3e3a8b6b83/html5/thumbnails/21.jpg)
Dev
Local:27001
Local:5000
-
Navegador
Nube
db:27001
app:80
-
Navegador
Producción
cluster:27001
app :80
-
Navegador
lb: 443
![Page 24: SVQDC 2017 Tecnologías para Microservicios](https://reader033.vdocumento.com/reader033/viewer/2022051707/58b896b71a28ab3e3a8b6b83/html5/thumbnails/24.jpg)
Client ExpressJS BaucisJS Mongoose MongoDB
HTTP req
resourcequery/command
data
401 | 403
AuthN/AuthZ middleware
<req.user, res>
Microservice
![Page 25: SVQDC 2017 Tecnologías para Microservicios](https://reader033.vdocumento.com/reader033/viewer/2022051707/58b896b71a28ab3e3a8b6b83/html5/thumbnails/25.jpg)
var express = require('express');var app = express();
app.get('/hello', function(req, res) {res.status(200).send('hello world');
});
/helloreq res
![Page 26: SVQDC 2017 Tecnologías para Microservicios](https://reader033.vdocumento.com/reader033/viewer/2022051707/58b896b71a28ab3e3a8b6b83/html5/thumbnails/26.jpg)
public class SampleModule : Nancy.NancyModule{
public SampleModule(){
Get["/hello"] = _ => “hello world";}
}
/helloreq res
![Page 27: SVQDC 2017 Tecnologías para Microservicios](https://reader033.vdocumento.com/reader033/viewer/2022051707/58b896b71a28ab3e3a8b6b83/html5/thumbnails/27.jpg)
![Page 28: SVQDC 2017 Tecnologías para Microservicios](https://reader033.vdocumento.com/reader033/viewer/2022051707/58b896b71a28ab3e3a8b6b83/html5/thumbnails/28.jpg)
exports.handler = function(event, context) {switch (event.operation) {
case 'ping': context.succeed('pong'); return;
case 'getSample':event.customArgs = ["rose:", "/tmp/rose.png"];im.convert(event.customArgs, function(err, output) {
if (err) context.fail(err);else {
var resultImgBase64 = new Buffer(fs.readFileSync("/tmp/rose.png")).toString('base64');
try { fs.unlinkSync("/tmp/rose.png");} catch (e) {}context.succeed(resultImgBase64);
}});break;
default:return context.fail(new Error('Unrecognized operation "' +
event.operation + '"'));}};
![Page 30: SVQDC 2017 Tecnologías para Microservicios](https://reader033.vdocumento.com/reader033/viewer/2022051707/58b896b71a28ab3e3a8b6b83/html5/thumbnails/30.jpg)
connect-mongo
nginx haproxy, etc.
![Page 31: SVQDC 2017 Tecnologías para Microservicios](https://reader033.vdocumento.com/reader033/viewer/2022051707/58b896b71a28ab3e3a8b6b83/html5/thumbnails/31.jpg)
![Page 32: SVQDC 2017 Tecnologías para Microservicios](https://reader033.vdocumento.com/reader033/viewer/2022051707/58b896b71a28ab3e3a8b6b83/html5/thumbnails/32.jpg)
![Page 33: SVQDC 2017 Tecnologías para Microservicios](https://reader033.vdocumento.com/reader033/viewer/2022051707/58b896b71a28ab3e3a8b6b83/html5/thumbnails/33.jpg)
![Page 34: SVQDC 2017 Tecnologías para Microservicios](https://reader033.vdocumento.com/reader033/viewer/2022051707/58b896b71a28ab3e3a8b6b83/html5/thumbnails/34.jpg)
![Page 35: SVQDC 2017 Tecnologías para Microservicios](https://reader033.vdocumento.com/reader033/viewer/2022051707/58b896b71a28ab3e3a8b6b83/html5/thumbnails/35.jpg)
process.env.VAR1
![Page 36: SVQDC 2017 Tecnologías para Microservicios](https://reader033.vdocumento.com/reader033/viewer/2022051707/58b896b71a28ab3e3a8b6b83/html5/thumbnails/36.jpg)
git remote add heroku https://git.heroku.com/app1.git
/Procfile
git push heroku master
web: node app/server.js
![Page 37: SVQDC 2017 Tecnologías para Microservicios](https://reader033.vdocumento.com/reader033/viewer/2022051707/58b896b71a28ab3e3a8b6b83/html5/thumbnails/37.jpg)
db: image: dockerfile/mongodbports: - "27017"
app: build: . environment: NODE_ENV: productionPORT: 80 SERVICE_NAME: app
links: - "db:DB" ports: - "80"
lb: image: jasonwyatt/nginx-loadbalancerlinks: - appenvironment: APP_PATH: "/"
ports: - "80:80"
![Page 38: SVQDC 2017 Tecnologías para Microservicios](https://reader033.vdocumento.com/reader033/viewer/2022051707/58b896b71a28ab3e3a8b6b83/html5/thumbnails/38.jpg)
db
app
lb app
app
#0
#1
#2
80
80 27017
consul prometheus8500
8500autoregistro
8500autodescubre /metrics
/ping
![Page 39: SVQDC 2017 Tecnologías para Microservicios](https://reader033.vdocumento.com/reader033/viewer/2022051707/58b896b71a28ab3e3a8b6b83/html5/thumbnails/39.jpg)
![Page 40: SVQDC 2017 Tecnologías para Microservicios](https://reader033.vdocumento.com/reader033/viewer/2022051707/58b896b71a28ab3e3a8b6b83/html5/thumbnails/40.jpg)
![Page 41: SVQDC 2017 Tecnologías para Microservicios](https://reader033.vdocumento.com/reader033/viewer/2022051707/58b896b71a28ab3e3a8b6b83/html5/thumbnails/41.jpg)
![Page 42: SVQDC 2017 Tecnologías para Microservicios](https://reader033.vdocumento.com/reader033/viewer/2022051707/58b896b71a28ab3e3a8b6b83/html5/thumbnails/42.jpg)
@pmolinam