I've got 99 problems the server ain't one

22725c2d3eb331146549bf0d5d3c050c?s=47 stefan judis
November 27, 2018

I've got 99 problems the server ain't one

22725c2d3eb331146549bf0d5d3c050c?s=128

stefan judis

November 27, 2018
Tweet

Transcript

  1. I’ve got 99 problems but the server ain’t one @stefanjudis

    Modern architectures without maintaining servers
  2. web

  3. Building for the web

  4. Frontend Backend Different responsibilities

  5. Different responsibilities Frontend Backend Everybody stays on their side!

  6. Frontend Backend Different responsibilities

  7. Frontend Backend Different responsibilities

  8. Frontend Backend Different responsibilities

  9. Frontend Backend Different experts

  10. Backend Different experts ๏ Servers ๏ Databases ๏ Scalability ๏

    Security ๏ ... ... ...
  11. Frontend Backend Different experts

  12. Frontend Different experts ๏ Browsers ๏ Performance ๏ Responsive Web

    Design ๏ Progressive Web Apps ๏ ... ... ...
  13. Frontend Backend Different experts

  14. Frontend Backend Feature development

  15. Frontend Backend Feature development Both sides are involved

  16. Frontend Backend Feature development It takes time and money

  17. Frontend Backend Feature development Will we succeed?

  18. Frontend Backend Feature development Does it have to be like

    that?
  19. Frontend world

  20. Frontend world But these are just UI widgets!

  21. Frontend world But these are just UI widgets! (are they?)

  22. APIs Frontend world

  23. WOULD YOU BUILD & MAINTAIN YOUR OWN MAPS WIDGET?

  24. WOULD YOU BUILD & MAINTAIN YOUR OWN NEWSLETTER SOFTWARE?

  25. WOULD YOU BUILD & MAINTAIN YOUR OWN REAL-TIME
 SUPPORT SOFTWARE?

  26. WOULD YOU BUILD & MAINTAIN YOUR OWN CMS?

  27. Writing good software is hard!

  28. The world speaks JSON JSON JSON

  29. “ So, isn't Contentful just a JSON API on top

    of a database?
  30. Content Delivery API Content infrastructure Content Delivery API

  31. Content infrastructure Content Delivery API {} {} {} {} {}

    {} {} {} {} {} {} {} {} {} {}
  32. Content infrastructure Content Delivery API {} {} {} {} {}

    {} {} {} {} {} {} {} {} {} {} CONTENT DELIVERED BY FAST CDNs
  33. Content Delivery API Content Preview API Content infrastructure Content Preview

    API
  34. Name Image Mumford & Sons Name Image Mumford & Sons

    & Me JSON ???
  35. Name Image Mumford & Sons Name Image Mumford & Sons

    & Me JSON JSON DELIVERY API PREVIEW API
  36. YOUR EDITORS HAVE TO BE HAPPY (AND SAFE)

  37. Content Delivery API Content Management API Content Preview API Content

    infrastructure Content Management API
  38. How to evolve content in a JSON API?

  39. Content infrastructure Content Management API

  40. How do you do this with an API? Content infrastructure

    Content Management API
  41. Migration Scripts Sandbox Environments Content infrastructure Content Management API

  42. Content infrastructure Content Management API ctfl.io/content-deployment

  43. These requirements are only touching the surface of content at

    scale
  44. It's always more complicated than it looks!

  45. It's always more complicated than it looks!

  46. I wouldn't reinvent the wheel...

  47. I wouldn't reinvent the wheel... ...because I have to maintain

    and scale that wheel later!
  48. Platform as a Service (PaaS) Specialized Services on top of

    PaaS and IaaS Infrastructure as a Service (IaaS)
  49. There is a service for everything!

  50. App development today 50% use 2-5 APIs 9% use 25+

    APIs Global Development Survey Vol. 1 © 2017 Evans Data
  51. None
  52. Chris Coyier – "The All Powerful Front End Developer"

  53. Nothing is for free

  54. Nothing is for free Evaluate carefully and consider time and

    effort!
  55. But how to connect all the dots? (watch out... buzzword

    approaching)
  56. Serverless computing

  57. “ Developers no longer have to think "that much" about

    Servers. Computing resources get used as services without having to manage around physical capacities or limits. www.quora.com/What-is-Serverless-Computing
  58. SERVERLESS COMPUTING Cloud services Function as a service Serverless framework

  59. SERVERLESS COMPUTING Cloud services Function as a service Serverless framework

    ¯\_(ϑ)_/¯
  60. thepowerofserverless.info

  61. “ You can take your front-end skills and do things

    that typically only a back-end can do. Chris Coyier
  62. “ You can take your front-end skills and do things

    that typically only a back-end can do. Chris Coyier
  63. “ You can take your front-end skills and do things

    that typically only a back-end can do. Chris Coyier
  64. Function as a service aka Cloud Functions

  65. Cloud functions No servers to maintain Automatically upscaling No payment

    for idle time
  66. serverlesscalc.com

  67. Cloud functions exports.sayHello = async (event) => { return 'Hello

    from Lambda!'; };
  68. Cloud functions exports.sayHello = async (event) => { return 'Hello

    from Lambda!'; };
  69. Cloud functions exports.sayHello = async (event) => { return 'Hello

    from Lambda!'; };
  70. Cloud functions exports.sayHello = async (event) => { return 'Hello

    from Lambda!'; }; Lambda
  71. Cloud functions exports.sayHello = async (event) => { return 'Hello

    from Lambda!'; }; API Gateway Lambda GET /.../eu-central-1.amazonaws.com/prod/ POST /.../eu-central-1.amazonaws.com/prod/ PUT /.../eu-central-1.amazonaws.com/prod/ ...
  72. Cloud functions API Gateway GET /.../eu-central-1.amazonaws.com/prod/ POST /.../eu-central-1.amazonaws.com/prod/ PUT /.../eu-central-1.amazonaws.com/prod/

    ... exports.sayHello = async (event) => { return { statusCode: 200, body: JSON.stringify({"msg": "Hello from Lambda!"}) }; }; Lambda
  73. Cloud functions API Gateway GET /.../eu-central-1.amazonaws.com/prod/ POST /.../eu-central-1.amazonaws.com/prod/ PUT /.../eu-central-1.amazonaws.com/prod/

    ... exports.sayHello = async (event) => { return { statusCode: 200, body: JSON.stringify({"msg": "Hello from Lambda!"}) }; }; Lambda Congratulations! You just created an HTTP endpoint
  74. "Serverless weekend" module.exports.redirect = async ({ pathParameters }, context) =>

    { };
  75. "Serverless weekend" module.exports.redirect = async ({ pathParameters }, context) =>

    { try { } catch (e) { console.log(e); return { statusCode: 500, body: e.message }; } };
  76. "Serverless weekend" module.exports.redirect = async ({ pathParameters }, context) =>

    { try { const { shortUrl } = pathParameters; const queryUrl = `https://cdn.contentful.com/spaces/${ process.env.SPACE_ID }/environments/master/entries?content_type=${ process.env.CONTENT_TYPE }&fields.shortUrl=${shortUrl}&access_token=${process.env.ACCESS_TOKEN}`; } catch (e) { console.log(e); return { statusCode: 500, body: e.message }; } };
  77. "Serverless weekend" const got = require('got'); module.exports.redirect = async ({

    pathParameters }, context) => { try { const { shortUrl } = pathParameters; const queryUrl = `https://cdn.contentful.com/spaces/${ process.env.SPACE_ID }/environments/master/entries?content_type=${ process.env.CONTENT_TYPE }&fields.shortUrl=${shortUrl}&access_token=${process.env.ACCESS_TOKEN}`; const response = JSON.parse((await got(queryUrl)).body); const redirect = response.items[0]; return { statusCode: 301, headers: { Location: redirect.fields.targetUrl } }; } catch (e) { console.log(e); return { statusCode: 500, body: e.message }; } };
  78. "Serverless weekend" const got = require('got'); module.exports.redirect = async ({

    pathParameters }, context) => { try { const { shortUrl } = pathParameters; const queryUrl = `https://cdn.contentful.com/spaces/${ process.env.SPACE_ID }/environments/master/entries?content_type=${ process.env.CONTENT_TYPE }&fields.shortUrl=${shortUrl}&access_token=${process.env.ACCESS_TOKEN}`; const response = JSON.parse((await got(queryUrl)).body); const redirect = response.items[0]; return { statusCode: 301, headers: { Location: redirect.fields.targetUrl } }; } catch (e) { console.log(e); return { statusCode: 500, body: e.message }; } }; www.my-links.online/ 99-problems
  79. "Serverless weekend" const got = require('got'); module.exports.redirect = async ({

    pathParameters }, context) => { try { const { shortUrl } = pathParameters; const queryUrl = `https://cdn.contentful.com/spaces/${ process.env.SPACE_ID }/environments/master/entries?content_type=${ process.env.CONTENT_TYPE }&fields.shortUrl=${shortUrl}&access_token=${process.env.ACCESS_TOKEN}`; const response = JSON.parse((await got(queryUrl)).body); const redirect = response.items[0]; return { statusCode: 301, headers: { Location: redirect.fields.targetUrl } }; } catch (e) { console.log(e); return { statusCode: 500, body: e.message }; } }; www.my-links.online/ 99-problems (yes, I bought this domain)
  80. Google AWS Microsoft IBM Fn-as-a-service provider

  81. webtask.io

  82. webtask.io www.netlify.com/docs/functions/

  83. webtask.io www.netlify.com/docs/functions/ Cloud functions will become a requirement to keep

    complexity low
  84. WHEN TO "LAMBDA" low complexity 01 self-contained 02 03 short-lived

  85. Perfect to connect services

  86. You'll become a conductor

  87. You'll become a serverless conductor

  88. Serverless orchestration Slack ? ?

  89. ? ? module.exports.handleDiscourse = (event, context, callback) => { };

    Serverless orchestration Slack
  90. ? ? module.exports.handleDiscourse = (event, context, callback) => { const

    post = JSON.parse(event.body).post; }; Serverless orchestration Slack
  91. ? ? module.exports.handleDiscourse = (event, context, callback) => { const

    post = JSON.parse(event.body).post; if (post && event.headers['X-Discourse-Event'] !== 'post_edited') { const { name, topic_title, topic_slug, topic_id, post_number } = post; } }; Serverless orchestration Slack
  92. ? ? module.exports.handleDiscourse = (event, context, callback) => { const

    post = JSON.parse(event.body).post; if (post && event.headers['X-Discourse-Event'] !== 'post_edited') { const { name, topic_title, topic_slug, topic_id, post_number } = post; // send it to Slack // ... // ... } }; Serverless orchestration Slack
  93. www.contentful.com/slack/

  94. Serverless orchestration Slack

  95. Serverless orchestration Asset manipulation C Asset published

  96. ctfl.io/image-watermark

  97. twitter.com/randomMDN

  98. twitter.com/randomMDN You can schedule functions!!!

  99. Connecting services has never been easier

  100. Spend your time building your business and not reinventing the

    wheel
  101. API-driven architectures

  102. APIs FTW!

  103. APIs FTW! Use the right tool for the job!

  104. Rethink you architecture!

  105. None
  106. Every 6 hours CSS & JavaScript

  107. Every 6 hours The Node.js process needs more and more

    memory
  108. Every 6 hours Can this server handle high load?

  109. I'M PAYING EVERY MONTH TO KEEP THIS RUNNING

  110. IS IT TIME FOR THE JAM?

  111. Thanks. @stefanjudis Slides