Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Introducing Mint Source

Andy Appleton
November 24, 2011

Introducing Mint Source

Talk given at the lnug meetup on 23rd November 2011

Andy Appleton

November 24, 2011
Tweet

More Decks by Andy Appleton

Other Decks in Technology

Transcript

  1. MINT SOURCE

    View Slide

  2. View Slide

  3. Andy Appleton
    @appltn
    http://mintdigital.com

    View Slide

  4. What, why?

    View Slide

  5. Node.js - Redis - Heroku
    CoffeeScript - Socket.IO

    View Slide

  6. Simple Heroku deploy
    $ git clone [email protected]:mintdigital/mint-source.git
    $ heroku create appname --stack cedar
    $ git push heroku master
    $ heroku ps:scale web=1
    $ heroku addons:add redistogo:nano
    $ heroku config:add NODE_ENV=production

    View Slide

  7. Optional HTTP Auth
    $ heroku config:add AUTH_ENABLED=true
    $ heroku config:add AUTH_USER=chunky
    $ heroku config:add AUTH_PASS=bacon

    View Slide

  8. http://github.com/user/project/admin/hooks

    View Slide

  9. {
    "before": "5aef35982fb2d34e9d9d4502f6ede1072793222d",
    "repository": {
    "url": "http://github.com/mint-digital/mint-source",
    "name": "mintdigital",
    "description": "A simple Node.js status board showing github commits and more.",
    "watchers": 5,
    "forks": 2,
    "private": 1,
    "owner": {
    "name": "mintdigital"
    }
    },
    "commits": [
    {
    "id": "41a212ee83ca127e3c8cf465891ab7216a705f59",
    "url": "http://github.com/mintdigital/mint-source/commit/41a212ee83ca127e3891ab7216a705f59",
    "author": {
    "email": "[email protected]",
    "name": "Andrew Appleton"
    },
    "message": "Devs love bacon",
    "timestamp": "2011-11-15T14:57:17-08:00",
    "added": ["filepath.rb"]
    POST
    http://appname.herokuapp.com/github_prh

    View Slide

  10. View Slide

  11. Jenkins CI
    http://jenkins-ci.org/

    View Slide

  12. Notification Plugin
    (post build hooks for Jenkins)
    https://wiki.jenkins-ci.org/display/JENKINS/Notification+Plugin

    View Slide

  13. $ heroku config:add JENKINS_ENABLED=true
    http://your-ci-box/job/project-name/configure

    View Slide

  14. {
    "name":"bacon",
    "url":"http://devslovebacon.com",
    "build":{
    "number":1,
    "phase":"FINISHED",
    "status":"FAILURE",
    "url":"job/project/5",
    "fullUrl":"http://your-ci-box/job/project/5"
    }
    }
    POST
    http://appname.herokuapp.com/jenkins_pbh

    View Slide

  15. View Slide

  16. no HTTP auth support, so
    Jenkins box IP whitelisting
    $ heroku config:add JENKINS_IP=60.70.80.90

    View Slide

  17. Discretion
    $ redis-cli
    > lpush Discretions "{\"orig\":\"secret\",
    \"subs\":\"public\"}"

    View Slide

  18. View Slide

  19. Last.fm
    http://www.last.fm/api

    View Slide

  20. POST
    http://appname.herokuapp.com/github_prh
    $ heroku config:add LASTFM_ENABLED=true
    $ heroku config:add LASTFM_KEY=12345...
    $ heroku config:add LASTFM_USER=mintdigital
    Last.fm API credentials

    View Slide

  21. Polling on the server,
    send data to clients via Socket.IO

    View Slide

  22. What’s next?

    View Slide

  23. app.get('/javascripts/:resource.js', (req, res) ->
    # Compile and serve client side CoffeeScript on the fly
    filePath = "./public/javascripts/#{req.params.resource}.coffee"
    fs.readFile(filePath, 'utf-8', (err, data) ->
    res.writeHead(200, {'Content-Type': 'application/javascript'})
    res.write(coffee.compile(data))
    res.end()
    )
    )
    CS > JS Caching

    View Slide

  24. Server Sent Events
    (Possibly)

    View Slide

  25. More Services
    Tweets, Foursquare checkins
    Generic notification endpoint

    View Slide

  26. Available now on Github
    https://github.com/mintdigital/mint-source

    View Slide

  27. http://devslovebacon.com

    View Slide