Carton at London Perl Workshop 2013

Carton at London Perl Workshop 2013

B2d653d5d663e750a2cd57bfbc9b727f?s=128

Tatsuhiko Miyagawa

November 30, 2013
Tweet

Transcript

  1. 2.

    Me • Tatsuhiko Miyagawa • Lives in San Francisco •

    {github,twitter,CPAN}/miyagawa Saturday, November 30, 13
  2. 6.

    When is the last time upgrading a CPAN module broke

    your app? Saturday, November 30, 13
  3. 8.

    You’re writing a new web app using as many CPAN

    modules. Saturday, November 30, 13
  4. 14.

    • 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 Saturday, November 30, 13
  5. 15.

    • 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 Saturday, November 30, 13
  6. 26.

    >  cat  cpanfile requires  'Web::Framework',  '==  1.10'; >  cpanm  -­‐-­‐installdeps

     . installed  Web-­‐Framework-­‐1.10 Saturday, November 30, 13
  7. 28.

    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'; }; Saturday, November 30, 13
  8. 34.

    cpanfile + cpanm • Simple • Yet powerful and flexible

    way to describe dependencies and version requirements • Version control cpanfile Saturday, November 30, 13
  9. 35.

    caveats • Locking each dependency with specific version is tedious

    work • Can only lock direct dependencies • MetaCPAN as SPOF • No easy/reliable way to rollback Saturday, November 30, 13
  10. 36.

    Many other solutions Needs servers, Needs databases Too simple, Too

    complicated, etc. Saturday, November 30, 13
  11. 43.

    • 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 Saturday, November 30, 13
  12. 44.

    Local perl environment Using local::lib and cpanm -L Each app

    has an isolated local library path Saturday, November 30, 13
  13. 46.

    Dep tree analysis Rebuild the dependency tree from snapshot Checks

    if anything is missing/superfluous Saturday, November 30, 13
  14. 48.

    Easy Redeployment Reinstall exactly the same set of modules on

    another prod/development machines. Saturday, November 30, 13
  15. 49.

    Conservative Update Modules won't be upgraded unless it is required,

    or manually updated. Saturday, November 30, 13
  16. 50.

    Single-file, VCS friendly You can add cpanfile.snapshot to git update

    whenever you update modules "Dependencies are part of your app." Saturday, November 30, 13
  17. 54.

     @local>  carton  install  @local>  git  commit  cpanfile.snapshot  @local>  git  push

    @remote>  carton  install  -­‐-­‐deployment @remote>  carton  exec  plackup  ... Saturday, November 30, 13
  18. 69.

    cpanm 1.8 • Rewrite internals • Backend API • Plugin

    support • CPAN Testers support (via plugins) Saturday, November 30, 13
  19. 70.

    carton 1.1 • binstubs • configure args/hints support • safe

    exec on development • remember options (--path etc.) Saturday, November 30, 13