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 1.0 at OSCON 2013
Search
Tatsuhiko Miyagawa
July 25, 2013
Technology
11
2.2k
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
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
Managing CPAN dependencies with Carton
miyagawa
0
270
What's new in Carton and cpanm at YAPC::Asia 2013
miyagawa
6
1.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時代のデータセンターネットワーク
lycorptech_jp
PRO
1
280
WACATE2024冬セッション資料(ユーザビリティ)
scarletplover
0
190
Amazon VPC Lattice 最新アップデート紹介 - PrivateLink も似たようなアップデートあったけど違いとは
bigmuramura
0
190
KnowledgeBaseDocuments APIでベクトルインデックス管理を自動化する
iidaxs
1
250
DevOps視点でAWS re:invent2024の新サービス・アプデを振り返ってみた
oshanqq
0
180
サイボウズフロントエンドエキスパートチームについて / FrontendExpert Team
cybozuinsideout
PRO
5
38k
プロダクト開発を加速させるためのQA文化の築き方 / How to build QA culture to accelerate product development
mii3king
1
250
成果を出しながら成長する、アウトプット駆動のキャッチアップ術 / Output-driven catch-up techniques to grow while producing results
aiandrox
0
180
Jetpack Composeで始めるServer Cache State
ogaclejapan
2
160
PHPからGoへのマイグレーション for DMMアフィリエイト
yabakokobayashi
1
160
CustomCopを使ってMongoidのコーディングルールを整えてみた
jinoketani
0
220
マルチプロダクト開発の現場でAWS Security Hubを1年以上運用して得た教訓
muziyoshiz
2
2.1k
Featured
See All Featured
Java REST API Framework Comparison - PWX 2021
mraible
PRO
28
8.3k
A Philosophy of Restraint
colly
203
16k
Optimising Largest Contentful Paint
csswizardry
33
3k
Helping Users Find Their Own Way: Creating Modern Search Experiences
danielanewman
29
2.3k
Rails Girls Zürich Keynote
gr2m
94
13k
No one is an island. Learnings from fostering a developers community.
thoeni
19
3k
The Art of Programming - Codeland 2020
erikaheidi
53
13k
Why Our Code Smells
bkeepers
PRO
335
57k
Site-Speed That Sticks
csswizardry
2
190
Designing for Performance
lara
604
68k
Bootstrapping a Software Product
garrettdimon
PRO
305
110k
The Power of CSS Pseudo Elements
geoffreycrofte
73
5.4k
Transcript
Carton 1.0 managing CPAN deps the right way Tatsuhiko Miyagawa
@miyagawa O'Reilly OSCON 2013 Wednesday, July 24, 13
Me • Tatsuhiko Miyagawa • Lives in San Francisco •
{github,twitter,CPAN}/miyagawa Wednesday, July 24, 13
Managing CPAN Dependencies Wednesday, July 24, 13
How many CPAN modules your app depends on? Wednesday, July
24, 13
When is the last time upgrading a CPAN module broke
your app? Wednesday, July 24, 13
Case Study: Web App Development Wednesday, July 24, 13
You’re writing a new web app using as many CPAN
modules. Wednesday, July 24, 13
Get them from CPAN, install on your machine. Wednesday, July
24, 13
john@local> cpanm Web::Framework installed LWP-‐5.912 installed Plack-‐0.9980 installed Web-‐Framework-‐1.10 Wednesday,
July 24, 13
Test it... Wednesday, July 24, 13
Works? Ship it! Wednesday, July 24, 13
What if ... Wednesday, July 24, 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 Wednesday, July 24, 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 Wednesday, July 24, 13
root@prod> cpanm Web::Framework installed LWP-‐5.912 installed Plack-‐0.9980 installed Web-‐Framework-‐1.20 Wednesday,
July 24, 13
Web::Framework 1.2 API changes! Wednesday, July 24, 13
Wednesday, July 24, 13
Wednesday, July 24, 13
“Upgrading CPAN modules broke my app” Wednesday, July 24, 13
Dependencies are part of your app. Wednesday, July 24, 13
a solution cpanm 1.6 Wednesday, July 24, 13
> cpanm Web::
[email protected]
installed Web-‐Framework-‐1.10 Wednesday, July 24, 13
> cpanm Web::Framework~">= 1.0, < 1.2" installed Web-‐Framework-‐1.19 Wednesday, July
24, 13
♥ MetaCPAN Wednesday, July 24, 13
a solution cpanfile + cpanm 1.6 Wednesday, July 24, 13
> cat cpanfile requires 'Web::Framework', '== 1.10'; > cpanm -‐-‐installdeps
. installed Web-‐Framework-‐1.10 Wednesday, July 24, 13
cpanfile DSL to describe prereqs Wednesday, July 24, 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'; }; Wednesday, July 24, 13
inspired by: gemfile(5) Wednesday, July 24, 13
Backward compatible to: Module::Install(::DSL) Wednesday, July 24, 13
Converted to to: CPAN::Meta::Prereqs Wednesday, July 24, 13
Toolset Module::CPANfile Module::Install::CPANfile Dist::Zilla plugins Wednesday, July 24, 13
Supported by dzil, Milla & cpanm 1.6 Wednesday, July 24,
13
cpanfile + cpanm • Simple • Yet powerful and flexible
way to describe dependencies and version requirements • Version control cpanfile Wednesday, July 24, 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 Wednesday, July 24, 13
Many other solutions Needs servers, Needs databases Too simple, Too
complicated, etc. Wednesday, July 24, 13
the Solution Wednesday, July 24, 13
Carton https://github.com/miyagawa/carton Wednesday, July 24, 13
Inspired by... Wednesday, July 24, 13
Wednesday, July 24, 13
Basic idea: Describe CPAN dependencies snapshot tarball pathnames Wednesday, July
24, 13
Built on top of: cpanfile + cpanm 1.6 Wednesday, July
24, 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 Wednesday, July 24, 13
Local perl environment Using local::lib and cpanm -L Each app
has an isolated local library path Wednesday, July 24, 13
Fast and safe install Saves MYMETA.json and install meta info
Wednesday, July 24, 13
Dep tree analysis Rebuild the dependency tree from snapshot Checks
if anything is missing/superfluous Wednesday, July 24, 13
Freezing versions Versions are saved in snapshots including dependencies Wednesday,
July 24, 13
Easy Redeployment Reinstall exactly the same set of modules on
another prod/development machines. Wednesday, July 24, 13
Conservative Update Modules won't be upgraded unless it is required,
or manually updated. Wednesday, July 24, 13
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
Safe and easy rollback revert the lock file and redeploy
Wednesday, July 24, 13
DEMO Wednesday, July 24, 13
Deployment with Carton Wednesday, July 24, 13
@local> carton install @local> git commit cpanfile.snapshot @local> git push
@remote> carton install -‐-‐deployment @remote> carton exec plackup ... Wednesday, July 24, 13
Example: github.com/miyagawa/cpanmetadb-perl capistrano, Server::Starter, carton, plackup (twiggy) Wednesday, July 24,
13
PaaS/Cloud github.com/miyagawa/heroku-buildpack-perl Wednesday, July 24, 13
Wednesday, July 24, 13
http://weblog.bulknews.net Wednesday, July 24, 13
Support to come! Dokku, DotCloud, Travis CI, Cloud Foundry etc.
Wednesday, July 24, 13
carton 1.0 later this week Wednesday, July 24, 13
> cpanm -‐-‐dev Carton Wednesday, July 24, 13
Towards 1.1 • Inject patched versions (DarkPAN) • Install from
github • bootstrap with fatpack Wednesday, July 24, 13
github.com/miyagawa/carton irc.perl.org #carton Wednesday, July 24, 13
speakerdeck.com /miyagawa Wednesday, July 24, 13
Questions? Wednesday, July 24, 13