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

Carton 1.0 at OSCON 2013

Carton 1.0 at OSCON 2013

Introducing what's new in Carton at O'Reilly Open Source Convention 2013.

Tatsuhiko Miyagawa

July 25, 2013
Tweet

More Decks by Tatsuhiko Miyagawa

Other Decks in Technology

Transcript

  1. Carton 1.0 managing CPAN deps the right way Tatsuhiko Miyagawa

    @miyagawa O'Reilly OSCON 2013 Wednesday, July 24, 13
  2. Me • Tatsuhiko Miyagawa • Lives in San Francisco •

    {github,twitter,CPAN}/miyagawa Wednesday, July 24, 13
  3. When is the last time upgrading a CPAN module broke

    your app? Wednesday, July 24, 13
  4. You’re writing a new web app using as many CPAN

    modules. Wednesday, July 24, 13
  5. • Jul 2nd: Started working on project • using Web::Framework

    1.1 • Jul 9th: Finished version 1.0 • Jul 10-15th: internal beta, QA • Jul 16th: Deploy to the production Wednesday, July 24, 13
  6. • Jul 2nd: Started working on project • using Web::Framework

    1.1 • Jul 9th: Finished version 1.0 • Jul 10-15th: internal beta, QA • Jul 15th: Web::Framework 1.2 is released • Jul 16th: Deploy to the cloud/production Wednesday, July 24, 13
  7. >  cat  cpanfile requires  'Web::Framework',  '==  1.10'; >  cpanm  -­‐-­‐installdeps

     . installed  Web-­‐Framework-­‐1.10 Wednesday, July 24, 13
  8. requires  'Catalyst',  '5.8000';   recommends  'JSON::XS',  '2.0'; on  'test'  =>

     sub  {    requires  'Test::More',  '>=  0.96' }; on  'develop'  =>  sub  {    recommends  'Devel::NYTProf'; }; feature  'sqlite'  =>  sub  {    requires  'DBD::SQLite'; }; Wednesday, July 24, 13
  9. cpanfile + cpanm • Simple • Yet powerful and flexible

    way to describe dependencies and version requirements • Version control cpanfile Wednesday, July 24, 13
  10. caveats • Locking each dependency with specific version is tedious

    work • Can only lock direct dependencies • MetaCPAN as SPOF • No easy/reliable way to fallback Wednesday, July 24, 13
  11. • App-specific local environment • Fast and safe install with

    caches • Dep-tree analysis, including versions • Freezing module versions • Conservative updates • Easy Redeployment, Rollback • Single-file, VCS friendly Wednesday, July 24, 13
  12. Local perl environment Using local::lib and cpanm -L Each app

    has an isolated local library path Wednesday, July 24, 13
  13. Dep tree analysis Rebuild the dependency tree from snapshot Checks

    if anything is missing/superfluous Wednesday, July 24, 13
  14. Easy Redeployment Reinstall exactly the same set of modules on

    another prod/development machines. Wednesday, July 24, 13
  15. Conservative Update Modules won't be upgraded unless it is required,

    or manually updated. Wednesday, July 24, 13
  16. Single-file, VCS friendly You can add cpanfile.snapshot to git update

    whenever you update modules "Dependencies are part of your app." Wednesday, July 24, 13
  17.  @local>  carton  install  @local>  git  commit  cpanfile.snapshot  @local>  git  push

    @remote>  carton  install  -­‐-­‐deployment @remote>  carton  exec  plackup  ... Wednesday, July 24, 13
  18. Towards 1.1 • Inject patched versions (DarkPAN) • Install from

    github • bootstrap with fatpack Wednesday, July 24, 13