Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Carton at London Perl Workshop 2013
Search
Tatsuhiko Miyagawa
November 30, 2013
Technology
0
250
Carton at London Perl Workshop 2013
Tatsuhiko Miyagawa
November 30, 2013
Tweet
Share
More Decks by Tatsuhiko Miyagawa
See All by Tatsuhiko Miyagawa
Carmel at YAPC::EU 2015
miyagawa
0
490
Managing CPAN dependencies with Carton
miyagawa
0
270
What's new in Carton and cpanm at YAPC::Asia 2013
miyagawa
6
1.2k
Carton 1.0 at OSCON 2013
miyagawa
11
2.2k
cpanm 1.6 at OSDC.TW
miyagawa
6
1.3k
10 more things to be ripped off
miyagawa
7
1.3k
Ruby; Exported
miyagawa
1
940
10 Years: LL, you and me
miyagawa
2
180
Plack 1.0 announcement at OSCON
miyagawa
1
250
Other Decks in Technology
See All in Technology
生成AIと知識グラフの相互利用に基づく文書解析
koujikozaki
1
140
顧客が本当に必要だったもの - パフォーマンス改善編 / Make what is needed
soudai
24
6.8k
Aurora_BlueGreenDeploymentsやってみた
tsukasa_ishimaru
1
130
【若手エンジニア応援LT会】AWSで繋がり、共に成長! ~コミュニティ活動と新人教育への挑戦~
kazushi_ohata
0
180
「視座」の上げ方が成人発達理論にわかりやすくまとまってた / think_ perspective_hidden_dimensions
shuzon
2
5.1k
いまさらのStorybook
ikumatadokoro
0
150
国土交通省 データコンペ参加者向け勉強会
takehikohashimoto
0
120
AWS re:Inventを徹底的に楽しむためのTips / Tips for thoroughly enjoying AWS re:Invent
yuj1osm
1
570
【技術書典17】OpenFOAM(自宅で極める流体解析)2次元円柱まわりの流れ
kamakiri1225
0
220
VPC間の接続方法を整理してみた #自治体クラウド勉強会
non97
1
860
よくわからんサービスについての問い合わせが来たときの強い味方 Amazon Q について
kazzpapa3
0
220
AIを駆使したゲーム開発戦略: 新設AI組織の取り組み / sge-ai-strategy
cyberagentdevelopers
PRO
1
130
Featured
See All Featured
Testing 201, or: Great Expectations
jmmastey
38
7k
Building Adaptive Systems
keathley
38
2.2k
Design and Strategy: How to Deal with People Who Don’t "Get" Design
morganepeng
126
18k
Build your cross-platform service in a week with App Engine
jlugia
229
18k
Producing Creativity
orderedlist
PRO
341
39k
Java REST API Framework Comparison - PWX 2021
mraible
PRO
28
7.9k
Into the Great Unknown - MozCon
thekraken
31
1.5k
The Pragmatic Product Professional
lauravandoore
31
6.3k
Become a Pro
speakerdeck
PRO
24
5k
What’s in a name? Adding method to the madness
productmarketing
PRO
22
3.1k
Side Projects
sachag
452
42k
Unsuck your backbone
ammeep
668
57k
Transcript
Carton managing CPAN dependencies Tatsuhiko Miyagawa @miyagawa London Perl Workshop
2013 Saturday, November 30, 13
Me • Tatsuhiko Miyagawa • Lives in San Francisco •
{github,twitter,CPAN}/miyagawa Saturday, November 30, 13
Thank You! Saturday, November 30, 13
Managing CPAN Dependencies Saturday, November 30, 13
How many CPAN modules your app depends on? Saturday, November
30, 13
When is the last time upgrading a CPAN module broke
your app? Saturday, November 30, 13
Case Study: Web App Development Saturday, November 30, 13
You’re writing a new web app using as many CPAN
modules. Saturday, November 30, 13
Get them from CPAN, install on your machine. Saturday, November
30, 13
john@local> cpanm Web::Framework installed LWP-‐5.912 installed Plack-‐0.9980 installed Web-‐Framework-‐1.10 Saturday,
November 30, 13
Test it... Saturday, November 30, 13
Works? Ship it! Saturday, November 30, 13
What if ... Saturday, November 30, 13
• 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
• 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
root@prod> cpanm Web::Framework installed LWP-‐5.912 installed Plack-‐0.9980 installed Web-‐Framework-‐1.20 Saturday,
November 30, 13
Web::Framework 1.2 API changes! Saturday, November 30, 13
Saturday, November 30, 13
“Upgrading CPAN modules broke my app” Saturday, November 30, 13
Dependencies are part of your app. Saturday, November 30, 13
a solution cpanm 1.6 Saturday, November 30, 13
> cpanm Web::
[email protected]
installed Web-‐Framework-‐1.10 Saturday, November 30, 13
> cpanm Web::Framework~">= 1.0, < 1.2" installed Web-‐Framework-‐1.19 Saturday, November
30, 13
♥ MetaCPAN Saturday, November 30, 13
a solution cpanfile + cpanm 1.6 Saturday, November 30, 13
> cat cpanfile requires 'Web::Framework', '== 1.10'; > cpanm -‐-‐installdeps
. installed Web-‐Framework-‐1.10 Saturday, November 30, 13
cpanfile DSL to describe prereqs Saturday, November 30, 13
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
inspired by: gemfile(5) Saturday, November 30, 13
Compatible to: Module::Install(::DSL) Saturday, November 30, 13
Converted to: CPAN::Meta::Prereqs Saturday, November 30, 13
Toolset Module::CPANfile Module::Install::CPANfile Dist::Zilla plugins Saturday, November 30, 13
Supported by dzil, Milla & cpanm 1.6 Saturday, November 30,
13
cpanfile + cpanm • Simple • Yet powerful and flexible
way to describe dependencies and version requirements • Version control cpanfile Saturday, November 30, 13
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
Many other solutions Needs servers, Needs databases Too simple, Too
complicated, etc. Saturday, November 30, 13
the new Solution Saturday, November 30, 13
Carton https://github.com/miyagawa/carton Saturday, November 30, 13
Inspired by... Saturday, November 30, 13
Saturday, November 30, 13
Basic idea: Describe CPAN dependencies snapshot tarball pathnames Saturday, November
30, 13
Built on top of: cpanfile + cpanm 1.7 Saturday, November
30, 13
• 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
Local perl environment Using local::lib and cpanm -L Each app
has an isolated local library path Saturday, November 30, 13
Fast and safe install Saves MYMETA.json and install meta info
Saturday, November 30, 13
Dep tree analysis Rebuild the dependency tree from snapshot Checks
if anything is missing/superfluous Saturday, November 30, 13
Freezing versions Versions are saved in snapshots including dependencies Saturday,
November 30, 13
Easy Redeployment Reinstall exactly the same set of modules on
another prod/development machines. Saturday, November 30, 13
Conservative Update Modules won't be upgraded unless it is required,
or manually updated. Saturday, November 30, 13
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
Safe and easy rollback revert the lock file and redeploy
Saturday, November 30, 13
DEMO Saturday, November 30, 13
Deployment with Carton Saturday, November 30, 13
@local> carton install @local> git commit cpanfile.snapshot @local> git push
@remote> carton install -‐-‐deployment @remote> carton exec plackup ... Saturday, November 30, 13
Example: github.com/miyagawa/cpanmetadb-perl capistrano, Server::Starter, carton, plackup (twiggy) Saturday, November 30,
13
PaaS/Cloud github.com/miyagawa/heroku-buildpack-perl Saturday, November 30, 13
Saturday, November 30, 13
http://weblog.bulknews.net Saturday, November 30, 13
Support to come! Dokku, DotCloud, Travis CI, Cloud Foundry etc.
Saturday, November 30, 13
carton 1.0 on CPAN Saturday, November 30, 13
> cpanm Carton Saturday, November 30, 13
Preview: next major releases Saturday, November 30, 13
cpanm 1.8 git (+ any URL) support in index Saturday,
November 30, 13
cpanfile 1.1 git syntax support Saturday, November 30, 13
requires 'Plack', '1.0000', git => 'git://github.com/plack/Plack.git', ref =>
'devel'; carton 1.1 Saturday, November 30, 13
requires 'Plack', '1.0011', dist => 'MIYAGAWA/Plack-‐1.0011.tar.gz'; carton 1.1 Saturday,
November 30, 13
requires 'Plack', '1.0011', dist => 'http://darkpan/Plack-‐1.tar.gz'; carton 1.1 Saturday,
November 30, 13
(demo) Saturday, November 30, 13
cpanm 1.8 • Rewrite internals • Backend API • Plugin
support • CPAN Testers support (via plugins) Saturday, November 30, 13
carton 1.1 • binstubs • configure args/hints support • safe
exec on development • remember options (--path etc.) Saturday, November 30, 13
github.com/miyagawa/carton irc.perl.org #carton Saturday, November 30, 13
speakerdeck.com /miyagawa Saturday, November 30, 13
gum.co/BmXz Saturday, November 30, 13
Questions? Saturday, November 30, 13