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

Sponsored · Ship Features Fearlessly Turn features on and off without deploys. Used by thousands of Ruby developers. →
stefan judis
November 27, 2018

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

stefan judis

November 27, 2018

Annual Pro sale · Save $30

Have presentations of your own?

Share with private links, password protection, and more control over your work.

Transcript

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

    Modern architectures without maintaining servers
  2. web

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

    Design ๏ Progressive Web Apps ๏ ... ... ...
  4. Content infrastructure Content Delivery API {} {} {} {} {}

    {} {} {} {} {} {} {} {} {} {} CONTENT DELIVERED BY FAST CDNs
  5. Name Image Mumford & Sons Name Image Mumford & Sons

    & Me JSON JSON DELIVERY API PREVIEW API
  6. Platform as a Service (PaaS) Specialized Services on top of

    PaaS and IaaS Infrastructure as a Service (IaaS)
  7. App development today 50% use 2-5 APIs 9% use 25+

    APIs Global Development Survey Vol. 1 © 2017 Evans Data
  8. “ 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
  9. “ You can take your front-end skills and do things

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

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

    that typically only a back-end can do. Chris Coyier
  12. 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/ ...
  13. 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
  14. 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
  15. "Serverless weekend" module.exports.redirect = async ({ pathParameters }, context) =>

    { try { } catch (e) { console.log(e); return { statusCode: 500, body: e.message }; } };
  16. "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 }; } };
  17. "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 }; } };
  18. "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
  19. "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)
  20. ? ? module.exports.handleDiscourse = (event, context, callback) => { const

    post = JSON.parse(event.body).post; }; Serverless orchestration Slack
  21. ? ? 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
  22. ? ? 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

More Decks by stefan judis

Other Decks in Technology