Deployment
Set up new production servers.
Install used CPAN modules
Sunday, April 15, 12
Slide 15
Slide 15 text
Few weeks later...
Sunday, April 15, 12
Slide 16
Slide 16 text
Your website is popular!
Need more web servers!
Sunday, April 15, 12
Slide 17
Slide 17 text
Re-Deployment
Set up new production servers.
Install CPAN modules.
Sunday, April 15, 12
Slide 18
Slide 18 text
“Crap, Web::Framework has been
updated to 1.4 and many APIs
have been changed or deprecated!”
Sunday, April 15, 12
Slide 19
Slide 19 text
Rollback
Log in to the old web server.
Check Perl module versions.
Install them on the new server.
Sunday, April 15, 12
Slide 20
Slide 20 text
“Crap, this author deleted
the version 1.20 we want.
Let’s go to BackPAN...”
Sunday, April 15, 12
Slide 21
Slide 21 text
“Crap, version 1.20 doesn’t actually work
with the newer LWP 6 that we just
installed! Have to downgrade this too...”
Sunday, April 15, 12
Slide 22
Slide 22 text
Sunday, April 15, 12
Slide 23
Slide 23 text
“Upgrading CPAN modules
broke my app”
Sunday, April 15, 12
Slide 24
Slide 24 text
What was wrong?
Sunday, April 15, 12
Slide 25
Slide 25 text
• Dependency declaration
• Isolated Perl environments
• Version controls/history
• Dependency analysis
• Repeatable deployments
• etc.
Sunday, April 15, 12
Slide 26
Slide 26 text
Many existing solutions
MyCPAN, DPAN, CPAN::Mini::Inject,
OrePAN, Shipwright
Sunday, April 15, 12
Slide 27
Slide 27 text
None of those
didn’t quite work for me.
(Or I haven’t even tried)
Sunday, April 15, 12
Slide 28
Slide 28 text
So I wrote a new one.
Sunday, April 15, 12
Slide 29
Slide 29 text
Carton
https://github.com/miyagawa/carton
Sunday, April 15, 12
Slide 30
Slide 30 text
Inspired by...
Sunday, April 15, 12
Slide 31
Slide 31 text
Sunday, April 15, 12
Slide 32
Slide 32 text
• App-specific local environment
• Fast and safe install
• Dep-tree analysis, including versions
• Locking module versions
• Easy Redeployment
• Single-file, VCS friendly
• Safe and easy rollback
Sunday, April 15, 12
Slide 33
Slide 33 text
Local perl environment
Using local::lib and cpanm -L
Each app has an isolated local library path
Sunday, April 15, 12
Slide 34
Slide 34 text
Fast and safe install
cpanm 1.5
Saves MYMETA.json and install meta info
Sunday, April 15, 12
Slide 35
Slide 35 text
Dep tree analysis
Rebuild the dependency tree from meta info
Checks if anything is missing/superfluous
Sunday, April 15, 12
Slide 36
Slide 36 text
Locking versions
Versions are saved in carton.lock
including dependencies
Sunday, April 15, 12
Slide 37
Slide 37 text
Easy Redeployment
Reinstall exactly the same set of modules
on another prod/development machines.
Sunday, April 15, 12
Slide 38
Slide 38 text
Single-file, VCS friendly
You can add carton.lock to git
update whenever you update modules
Sunday, April 15, 12
Slide 39
Slide 39 text
Safe and easy rollback
revert the lock file and redeploy
Sunday, April 15, 12
Slide 40
Slide 40 text
Declaring CPAN
dependencies
Sunday, April 15, 12
Slide 41
Slide 41 text
CPAN Distributions:
Makefile.PL
or
Build.PL
Sunday, April 15, 12
Slide 42
Slide 42 text
Carton apps:
cpanfile
Sunday, April 15, 12
Slide 43
Slide 43 text
cpanfile
Module::Install + CPAN::Meta
Sunday, April 15, 12
Slide 44
Slide 44 text
requires
‘Plack’,
0.99;
on
‘develop’
=>
sub
{
recommends
‘Devel::Cover’;
};
test_requires
‘Test::Warn’;
requires
‘Devel::NYTProf’,
‘>=
3.2,
<
5’;
conflicts
‘MooseX::Declare’,
‘<
0.99’;
Sunday, April 15, 12
Slide 45
Slide 45 text
WHY
• Your applications are not CPAN dists.
• GitHub scripts
• PaaS
• DotCloud
• Heroku
• Stackato
Sunday, April 15, 12
Slide 46
Slide 46 text
DEMO
Sunday, April 15, 12
Slide 47
Slide 47 text
>
cpanm
Carton
Sunday, April 15, 12
Slide 48
Slide 48 text
ܯࠂ
It is beta software, some features are
missing or not working correctly (yet).
Sunday, April 15, 12
Slide 49
Slide 49 text
TODO / Roadmap
• Update specific modules
• Make install and bundle faster
• Inject old versions / patched versions
• Install from git SHA
Sunday, April 15, 12
Slide 50
Slide 50 text
github.com/miyagawa/carton
irc.perl.org #carton
Sunday, April 15, 12
Slide 51
Slide 51 text
Sunday, April 15, 12
Slide 52
Slide 52 text
ʁ
Sunday, April 15, 12
Slide 53
Slide 53 text
ँँʂ
speakerdeck.com/u/miyagawa
Sunday, April 15, 12