The long road to 1.0

The long road to 1.0

Talk from Scriptconf 2017 in Linz. A tale of the technical challenges we have faced as an open source JavaScript application, trying to get Ghost to 1.0.

13bc3aed226e3d7b0d262e5664468f50?s=128

Hannah Wolfe

January 27, 2017
Tweet

Transcript

  1. — by Hannah Wolfe — THE LONG ROAD TO 1.0

    A story of life, love and the pursuit of 100% test coverage
  2. None
  3. No matter what people tell you, words and ideas can

    change the world – Robin Williams
  4. FOCUSED PUBLISHING PLATFORM

  5. None
  6. Seth Godin - Purple Cow / Tribes Jeff Atwood -

    Founder @ StackOverflow Darren Rowse - ProBlogger Leo Babauta - Zen Habits Paul Bradshaw - Head of HE Journalism (UK) Tucker Max - I Hope They Serve Beer in Hell (that’s about €230k)
  7. FUTURE OF JOURNALISM

  8. None
  9. Easy to install

  10. None
  11. Not for profit Money © 2014 Aaron Patterson, Flickr

  12. Sustainable

  13. None
  14. None
  15. None
  16. None
  17. None
  18. None
  19. Ghost 1.0

  20. CHALLENGES

  21. To t CLIENT vs SERVER breaking that coupling

  22. JSON API Server Blog require() Client Admin HTTP

  23. JSON API Server Blog require() Client Admin HTTP

  24. None
  25. JSON API Server Blog require() Client Admin HTTP

  26. JSON API Server Blog require() Client Admin HTTP

  27. None
  28. JSON API Server Blog require() Client Admin HTTP

  29. JSON API Server Blog require() Client Admin HTTP

  30. None
  31. JSON API Server Blog require() Client Admin HTTP

  32. JSON API Server Blog require() Client Admin HTTP GET /api/posts/?limit=3

    api.posts.browse({limit: 3}) {{#get “posts” limit=“3”}}
  33. JSON API Server Blog require() Client Admin HTTP

  34. JSON API Server Blog require() Client Admin HTTP ?

  35. JSON API Server Blog require() Client Admin HTTP ?

  36. None
  37. Single page app? Ugly routing No data binding Memory issues

    Constant regressions Poor mobile support
  38. None
  39. None
  40. Lacking a clear consistent approach

  41. We needed a RULEBOOK

  42. None
  43. None
  44. JSON API Server Blog require() Client Admin HTTP ?

  45. JSON API Server Blog require() Client Admin HTTP

  46. Ghost 1.0

  47. JSON API Server Blog require() Client Admin HTTP

  48. JSON API Server Blog require() Client Admin HTTP

  49. On the shoulders of giants

  50. DATABASES the rule of three

  51. bookshelf & knex

  52. Easy to install

  53. None
  54. None
  55. POSTGRES SUPPORT

  56. None
  57. Easy to install

  58. 9414 verbose stack Error: sqlite3@3.1.8 install: `node-pre-gyp install --fallback-to-build` 9414

    verbose stack Exit status 1 9414 verbose stack at EventEmitter.<anonymous> (/root/.nvm/versions/node/v4.2.6/lib/node_modules/npm/lib/utils/lifecycle.js:279:16) 9414 verbose stack at emitTwo (events.js:87:13) 9414 verbose stack at EventEmitter.emit (events.js:172:7) 9414 verbose stack at ChildProcess.<anonymous> (/root/.nvm/versions/node/v4.2.6/lib/node_modules/npm/lib/utils/spawn.js:40:14) 9414 verbose stack at emitTwo (events.js:87:13) 9414 verbose stack at ChildProcess.emit (events.js:172:7) 9414 verbose stack at maybeClose (internal/child_process.js:821:16) 9414 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:211:5) 9415 verbose pkgid sqlite3@3.1.8 9416 verbose cwd /var/www/ghost 9417 error Linux 3.2.0-76-virtual 9418 error argv "/root/.nvm/versions/node/v4.2.6/bin/node" "/root/.nvm/versions/node/v4.2.6/bin/npm" "install" "sqlite3" "--loglevel=info" 9419 error node v4.2.6 9420 error npm v4.1.1 9421 error code ELIFECYCLE 9422 error sqlite3@3.1.8 install: `node-pre-gyp install --fallback-to-build` 9422 error Exit status 1 9423 error Failed at the sqlite3@3.1.8 install script 'node-pre-gyp install --fallback-to-build'. 9423 error Make sure you have the latest version of node.js and npm installed. 9423 error If you do, this is most likely a problem with the sqlite3 package, 9423 error not with npm itself. 9423 error Tell the author that this fails on your system: 9423 error node-pre-gyp install --fallback-to-build 9423 error You can get information on how to open an issue for this project with: 9423 error npm bugs sqlite3 9423 error Or if that isn't available, you can get their info via: 9423 error npm owner ls sqlite3 9423 error There is likely additional logging output above. 9424 verbose exit [ 1, true ]
  59. MIGRATIONS

  60. Ghost 1.0

  61. None
  62. None
  63. $> ghost install $> ghost install local Easy to install

  64. And some stuff EXPRESS APP STRUCTURE Or… wait… where does

    middleware go?
  65. None
  66. Ghost 0.3 - MVC

  67. app.get('/about/', function myController(req, res) { var myModelData = models.get('about'); //

    render the view called about.hbs res.render('about', myModelData); });
  68. None
  69. None
  70. None
  71. Ghost 1.0

  72. None
  73. None
  74. None
  75. // API parentApp.use('/ghost/api/v0.1/', require('./api')()); // ADMIN parentApp.use('/ghost', require('./admin')()); // BLOG

    parentApp.use(require('./blog')());
  76. None
  77. Solve real problems first, DRY later more use cases result

    in better abstractions
  78. Break files into packages as they get too complex (but

    not before)
  79. Use index.js to expose Public APIs avoid tight coupling &

    circular dependencies
  80. None
  81. CHALLENGES

  82. PERMISSIONS

  83. None
  84. Why can authors publish posts?

  85. None
  86. Ghost 1.0

  87. Ghost 1.0 • New Editor • CLI Tool for install

    & upgrade • Ghost OAuth login system • Improved logging & migrations • Much, much more…
  88. WHAT NEXT?

  89. None
  90. Thank you!