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
Managing CPAN dependencies with Carton
Search
Tatsuhiko Miyagawa
November 23, 2013
Technology
0
270
Managing CPAN dependencies with Carton
at Nordic Perl Workshop 2013
Tatsuhiko Miyagawa
November 23, 2013
Tweet
Share
More Decks by Tatsuhiko Miyagawa
See All by Tatsuhiko Miyagawa
Carmel at YAPC::EU 2015
miyagawa
0
490
Carton at London Perl Workshop 2013
miyagawa
0
250
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
950
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が変えるデータ分析の全体像
ishikawa_satoru
0
170
インフラとバックエンドとフロントエンドをくまなく調べて遅いアプリを早くした件
tubone24
1
430
日経電子版のStoreKit2フルリニューアル
shimastripe
1
150
エンジニア人生の拡張性を高める 「探索型キャリア設計」の提案
tenshoku_draft
1
130
プロダクト活用度で見えた真実 ホリゾンタルSaaSでの顧客解像度の高め方
tadaken3
0
200
Shopifyアプリ開発における Shopifyの機能活用
sonatard
4
260
テストコード品質を高めるためにMutation Testingライブラリ・Strykerを実戦導入してみた話
ysknsid25
7
2.7k
FlutterアプリにおけるSLI/SLOを用いたユーザー体験の可視化と計測基盤構築
ostk0069
0
110
Lexical Analysis
shigashiyama
1
150
SDN の Hype Cycle を一通り経験してみて思うこと / Going through the Hype Cycle of SDN
mshindo
1
100
【令和最新版】AWS Direct Connectと愉快なGWたちのおさらい
minorun365
PRO
5
760
EventHub Startup CTO of the year 2024 ピッチ資料
eventhub
0
130
Featured
See All Featured
Templates, Plugins, & Blocks: Oh My! Creating the theme that thinks of everything
marktimemedia
26
2.1k
4 Signs Your Business is Dying
shpigford
180
21k
Exploring the Power of Turbo Streams & Action Cable | RailsConf2023
kevinliebholz
27
4.3k
Designing on Purpose - Digital PM Summit 2013
jponch
115
7k
A Philosophy of Restraint
colly
203
16k
Evolution of real-time – Irina Nazarova, EuRuKo, 2024
irinanazarova
4
380
Into the Great Unknown - MozCon
thekraken
32
1.5k
I Don’t Have Time: Getting Over the Fear to Launch Your Podcast
jcasabona
28
2k
Building Adaptive Systems
keathley
38
2.3k
JavaScript: Past, Present, and Future - NDC Porto 2020
reverentgeek
47
5k
"I'm Feeling Lucky" - Building Great Search Experiences for Today's Users (#IAC19)
danielanewman
226
22k
ピンチをチャンスに:未来をつくるプロダクトロードマップ #pmconf2020
aki_iinuma
109
49k
Transcript
Carton managing CPAN dependencies Tatsuhiko Miyagawa @miyagawa Nordic Perl Workshop
2013 Saturday, November 23, 13
Me • Tatsuhiko Miyagawa • Lives in San Francisco •
{github,twitter,CPAN}/miyagawa Saturday, November 23, 13
Thank You! Saturday, November 23, 13
Managing CPAN Dependencies Saturday, November 23, 13
How many CPAN modules your app depends on? Saturday, November
23, 13
When is the last time upgrading a CPAN module broke
your app? Saturday, November 23, 13
Case Study: Web App Development Saturday, November 23, 13
You’re writing a new web app using as many CPAN
modules. Saturday, November 23, 13
Get them from CPAN, install on your machine. Saturday, November
23, 13
john@local> cpanm Web::Framework installed LWP-‐5.912 installed Plack-‐0.9980 installed Web-‐Framework-‐1.10 Saturday,
November 23, 13
Test it... Saturday, November 23, 13
Works? Ship it! Saturday, November 23, 13
What if ... Saturday, November 23, 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 23, 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 23, 13
root@prod> cpanm Web::Framework installed LWP-‐5.912 installed Plack-‐0.9980 installed Web-‐Framework-‐1.20 Saturday,
November 23, 13
Web::Framework 1.2 API changes! Saturday, November 23, 13
Saturday, November 23, 13
Saturday, November 23, 13
“Upgrading CPAN modules broke my app” Saturday, November 23, 13
Dependencies are part of your app. Saturday, November 23, 13
a solution cpanm 1.6 Saturday, November 23, 13
> cpanm Web::
[email protected]
installed Web-‐Framework-‐1.10 Saturday, November 23, 13
> cpanm Web::Framework~">= 1.0, < 1.2" installed Web-‐Framework-‐1.19 Saturday, November
23, 13
♥ MetaCPAN Saturday, November 23, 13
a solution cpanfile + cpanm 1.6 Saturday, November 23, 13
> cat cpanfile requires 'Web::Framework', '== 1.10'; > cpanm -‐-‐installdeps
. installed Web-‐Framework-‐1.10 Saturday, November 23, 13
cpanfile DSL to describe prereqs Saturday, November 23, 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 23, 13
inspired by: gemfile(5) Saturday, November 23, 13
Compatible to: Module::Install(::DSL) Saturday, November 23, 13
Converted to: CPAN::Meta::Prereqs Saturday, November 23, 13
Toolset Module::CPANfile Module::Install::CPANfile Dist::Zilla plugins Saturday, November 23, 13
Supported by dzil, Milla & cpanm 1.6 Saturday, November 23,
13
cpanfile + cpanm • Simple • Yet powerful and flexible
way to describe dependencies and version requirements • Version control cpanfile Saturday, November 23, 13
caveats • Locking each dependency with specific version is tedious
work • Can only lock direct dependencies • MetaCPAN as SPOF • No easy/reliable way to fallback Saturday, November 23, 13
Many other solutions Needs servers, Needs databases Too simple, Too
complicated, etc. Saturday, November 23, 13
the new Solution Saturday, November 23, 13
Carton https://github.com/miyagawa/carton Saturday, November 23, 13
Inspired by... Saturday, November 23, 13
Saturday, November 23, 13
Basic idea: Describe CPAN dependencies snapshot tarball pathnames Saturday, November
23, 13
Built on top of: cpanfile + cpanm 1.7 Saturday, November
23, 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 23, 13
Local perl environment Using local::lib and cpanm -L Each app
has an isolated local library path Saturday, November 23, 13
Fast and safe install Saves MYMETA.json and install meta info
Saturday, November 23, 13
Dep tree analysis Rebuild the dependency tree from snapshot Checks
if anything is missing/superfluous Saturday, November 23, 13
Freezing versions Versions are saved in snapshots including dependencies Saturday,
November 23, 13
Easy Redeployment Reinstall exactly the same set of modules on
another prod/development machines. Saturday, November 23, 13
Conservative Update Modules won't be upgraded unless it is required,
or manually updated. Saturday, November 23, 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 23, 13
Safe and easy rollback revert the lock file and redeploy
Saturday, November 23, 13
DEMO Saturday, November 23, 13
Deployment with Carton Saturday, November 23, 13
@local> carton install @local> git commit cpanfile.snapshot @local> git push
@remote> carton install -‐-‐deployment @remote> carton exec plackup ... Saturday, November 23, 13
Example: github.com/miyagawa/cpanmetadb-perl capistrano, Server::Starter, carton, plackup (twiggy) Saturday, November 23,
13
PaaS/Cloud github.com/miyagawa/heroku-buildpack-perl Saturday, November 23, 13
Saturday, November 23, 13
http://weblog.bulknews.net Saturday, November 23, 13
Support to come! Dokku, DotCloud, Travis CI, Cloud Foundry etc.
Saturday, November 23, 13
carton 1.0 on CPAN Saturday, November 23, 13
> cpanm Carton Saturday, November 23, 13
Preview: next major releases Saturday, November 23, 13
cpanm 1.8 git (+ any URL) support in index Saturday,
November 23, 13
cpanfile 1.1 git syntax support Saturday, November 23, 13
requires 'Plack', '1.0000', git => 'git://github.com/plack/Plack.git', ref =>
'devel'; carton 1.1 Saturday, November 23, 13
requires 'Plack', '1.0011', dist => 'MIYAGAWA/Plack-‐1.0011.tar.gz'; carton 1.1 Saturday,
November 23, 13
requires 'Plack', '1.0011', dist => 'http://darkpan/Plack-‐1.tar.gz'; carton 1.1 Saturday,
November 23, 13
(demo) Saturday, November 23, 13
cpanm 1.8 • Rewrite internals • Backend API • Plugin
support • CPAN Testers support (via plugins) Saturday, November 23, 13
carton 1.1 • binstubs • configure args/hints support • safe
exec on development • remember options (--path etc.) Saturday, November 23, 13
github.com/miyagawa/carton irc.perl.org #carton Saturday, November 23, 13
speakerdeck.com /miyagawa Saturday, November 23, 13
gum.co/BmXz Saturday, November 23, 13
Questions? Saturday, November 23, 13