SlideShare une entreprise Scribd logo
1  sur  38
Télécharger pour lire hors ligne
Divorcing
System
- Years ago, perl developers required root
access to install modules
- Admins reluctant to hand over reins and
security policies restricted it
- use lib and @inc could get around
some problems
- perl bundled with OS always lagged
behind
- enter the tools
What?
• Removing dependency on root access
• providing consistent environments
Divorcing System // Toronto Perl Mongers // Shawn Sorichetti
- going to start with plenv
How to avoid root access
• plenv
• carton
Divorcing System // Toronto Perl Mongers // Shawn Sorichetti
- Written Tokuhiro Matsuno
- plenv is implemented in bash, and
provides simple shell script wrappers
(called "shims") for each perl
executable files.
- perl is installed in user space and
doesn't require any special
permissions.
plenv - perl binary manager
https://github.com/tokuhirom/plenv
Written by: Tokuhiro Matsuno
Divorcing System // Toronto Perl Mongers // Shawn Sorichetti
- Taken directly from the GitHub
project page
- perls are installed in your home
directory
- implemented in bash with simple
shell script wrappers called shims
- the shims provide access to perl
executable files (carton, cpanm, prove)
plenv vs. perlbrew
Like perlbrew, plenv installs perls under your home directory and lets you
install modules locally, and allows you to switch to arbitrary perl versions on
your shell.
Unlike perlbrew, plenv is implemented in bash, and provides simple shell script
wrappers (called "shims") for each perl executable files. It doesn't export any
shell functions that switches PATH before running commands.
Unlike perlbrew, plenv allows you to set local perl version per directory,
using .perl-version file.
Unlike perlbrew, plenv doesn't provide built-in local::lib integrations, but
plenv-contrib implements use and lib commands for a replacement
Divorcing System // Toronto Perl Mongers // Shawn Sorichetti
- there are multiple choices for
installation to fit your needs
- The installation page goes
into detail
plenv Installation
https://github.com/tokuhirom/plenv#installation
• macOS via homebrew
brew install plenv perl-build
• via git clone
git clone https://github.com/tokuhirom/plenv.git
~/.plenv
• manual/neckbeard
Divorcing System // Toronto Perl Mongers // Shawn Sorichetti
- plenv help provides an
overview and can provide
details per command
- We're going to look at some
of these commands more in
depth
plenv help
Extensive online help system
through plenv
Each command has its own help
via plenv help <command>
Divorcing System // Toronto Perl Mongers // Shawn
Sorichetti
- You can see here that I have multiple
installations of the same version
- each of these is a directory that
contains everything required for perl
to run
- the -debug version is built with
additional flags, I'll come back to this
perl binary manager
• Installs perl in ~/.plenv
• each directory contains an entire
perl installation
Divorcing System // Toronto Perl Mongers // Shawn
Sorichetti
- versions of perl that are available to
install
- This is a command that I always
forget
- There are a lot of versions available,
including Release Candidates, Trials,
cutting edge and ones you really
shouldn't be running
What versions can I build?
plenv install --list lists all
versions that can be installed.
Divorcing System // Toronto Perl Mongers // Shawn
Sorichetti
- allows you to create a custom install of perl per
project
- using the as directive gives the perl installation a
custom name
- names can be anything, and are useful for matching
projects
or options specified
- if you have modules that need to be installed for a
project, using
a project specific perl installation will keep the
modules separate
Custom versions per project
The --as directive allows the name
of the installed perl to be
changed.
Divorcing System // Toronto Perl Mongers // Shawn
Sorichetti
- build options can be passed to
install
- build in parallel
- yes, this project required threads
- there's no need to install man
pages for all perl versions
- unique name to identify
Adding options to perl build
Add options to the build directly
on the command line
Divorcing System // Toronto Perl Mongers // Shawn
Sorichetti
- plenv allows control of perl versions
in different scenarios
- the scope of use increases through
the list
- if a version is not set, plenv will default
to system perl, which is whatever is
installed with the OS
- this can lead to undesirable results
Selecting a version to use
Sub commands for setting perl version:
• local
• shell
• global
Divorcing System // Toronto Perl Mongers // Shawn Sorichetti
- sets the perl version via .perl-
version file in the current directory
- simple text file containing the version
to use, so automation tools can write it
- automatically searches up directory
tree, which you can see here with the
cd lib
In directory tree
• uses the local subcommand
• also write the .perl-version file
manually
• specific to the working directory
tree
Divorcing System // Toronto Perl Mongers // Shawn
Sorichetti
- sets the version for the current shell
- version stays in place until:
- shell is closed
- new version requested
- enter directory with a .perl-version file
- or the shell is --unset
- as a side note, does not work with fish shell, to
get around this set the PLENV_VERSION
environment variable
- in fact that's how we test with Jenkins
Shell
• uses the shell subcommand
• specific to the current shell
• use the --unset option to revert
Divorcing System // Toronto Perl Mongers // Shawn
Sorichetti
- The global setting sets a
common perl version to be
used
when none other is set
- To use within cron a login
shell is required bash -lc
Global
• uses the global subcommand
• sets the default used for the
system
• only works in shells that have
been initialized with plenv
Divorcing System // Toronto Perl Mongers // Shawn
Sorichetti
- if home directories are an NFS
or limited space in partition
- overriding the plenv defaults
using environment variables
- plenv init is called to
continue environment setup
Change installation directory
• Useful if $HOME isn't a good place
to store perl installations
Divorcing System // Toronto Perl Mongers // Shawn
Sorichetti
- Modules kept within the perl
version's directory
- each perl version has its own
set of modules
Where are the modules
stored?
Modules are contained along with
other perl files
Divorcing System // Toronto Perl Mongers // Shawn
Sorichetti
- plenv has built in support
for installing cpanminus
- automatically installs and
runs plenv rehash
CPANMINUS?
plenv install-cpanm
Divorcing System // Toronto Perl Mongers // Shawn Sorichetti
- the plenv which command
shows the full path to the
script/bin that will be executed.
- plenv rehash updates the
shims that allow commands
to be executed
What's rehash?
Packages that install scripts or bin/ are also stored by perl version.
When new scripts/bins are installed plenv rehash must be run to update the shims.
Divorcing System // Toronto Perl Mongers // Shawn Sorichetti
- to install a version upgrade, just
use plenv install
- migrate-modules reads the
previous versions module and
installs them for the new
version.
Upgrading
Same as installing a new version.
migrate-modules re-installs all modules into the new version
Divorcing System // Toronto Perl Mongers // Shawn Sorichetti
- Handles installation and
configuration for all of these
environments
And while you're managing
plenv
Why not manage all the envs!
anyenv - all in one for **env
https://github.com/riywo/anyenv
Divorcing System // Toronto Perl Mongers // Shawn
Sorichetti
Enter
CartonDivorcing System // Toronto Perl Mongers // Shawn Sorichetti
- maintains a list of required
versions and dependencies
- allows locking down specific
versions of modules
- managed through
cpanfile
Carton
Carton - Perl module dependency manager (aka
Bundler for Perl)
https://github.com/perl-carton/carton
Written by: Tatsuhiko Miyagawa
Divorcing System // Toronto Perl Mongers // Shawn Sorichetti
- installation with cpanm in a
fresh install
Installing with plenv
Divorcing System // Toronto Perl Mongers // Shawn Sorichetti
- Another Miyagawa creation
- Modules are specified using the
requires keyword
- optional minimal version numbers can
be specified using the =>
'<version>' construct
- version ranges, and exact versions can
be specified with operators
Version management
Modules are managed through a
cpanfile.
More on cpanfile can be read here
https://metacpan.org/pod/cpanfile
Divorcing System // Toronto Perl Mongers // Shawn
Sorichetti
- reads the cpanfile and installs
modules and dependencies using cpanm
- All modules are installed in local/
directory
- After modules are installed carton reads
the contents of local/ and writes
a cpanfile.snapshot
Installing modules
carton install reads the cpanfile file and installs modules and dependencies.
All modules are installed in the local/ directory.
Divorcing System // Toronto Perl Mongers // Shawn Sorichetti
- local/ directory is identical
to the system directories
- bin/ contains scripts and
binaries
- lib/ standard perl module
structure with perl5 directory
Contents of local
The local/ directory contains subdirectories of module contents.
Divorcing System // Toronto Perl Mongers // Shawn Sorichetti
- the carton exec command establishes
the shell environment for script/command
execution
- local/bin scripts/commands are in the
path and can be called directly
- other commands can be executed using
perl
- it's also possible to carton exec --
bash to set environment within the shell
Execution with carton
The carton command will also set
the shell environment to use the
local/ directory.
Divorcing System // Toronto Perl Mongers // Shawn
Sorichetti
- File is automatically
generated by carton
install
- both a blessing and a curse
What is the cpanfile.snapshot?
Maintains a list of all installed
modules, what they provide,
versions, and dependencies.
Divorcing System // Toronto Perl Mongers // Shawn
Sorichetti
- extremely useful for maintaining
a consistent development
environment
across developers
- maintains versions between
development, test, QA and
production
Locking down versions
When installing with the --deployment option, carton installs versions
specified in cpanfile.snapshot.
Divorcing System // Toronto Perl Mongers // Shawn Sorichetti
- there are some difficulties with
carton
- there used to be more, but when
trying to replicate them, they didn't
occur again
- most gotchas revolve around
maintaining the cpanfile.snapshot
Gotchas
Divorcing System // Toronto Perl Mongers // Shawn Sorichetti
- suspect that cpanm is failing
to parse META.yml and the
result
is that the provides includes
and undef version number
Modules with malformed
META.yml or META.json files
provides includes an undef version
number.
Divorcing System // Toronto Perl Mongers // Shawn
Sorichetti
- Example of cpanfile.snapshot with
File::HomeDir that's required
by sqitch on Mac, get a diff with it being deleted
- In this instance a co-worker installed a new
module, but during
the scan by carton install the Mac-
SystemDirectory module was
removed from cpanfile.snapshot
- Must be careful when removing modules
Module not required
Difference between Linux and Mac
requirements can cause different
cpanfile.snapshot contents.
Divorcing System // Toronto Perl Mongers // Shawn
Sorichetti
- using this method (discovered by Cees) mitigates a lot of issues
- First install the versions specified in cpanfile.snapshot
- update the cpanfile with the new requirements
- Use cpanm to install any modules and dependencies into
local/
- run carton install to update the cpanfile.snapshot
- the tricky part is the commit, make sure not to include anything
that might
be updated.
- To be thorough, remove rm -fr local/ and run carton
install --deployment
again
Using cpanm to add/update modules
Divorcing System // Toronto Perl Mongers // Shawn Sorichetti
- Everything is stored in
local/
- no breakout by version
- adding separation isn't too
difficult
Upgrading Perl
There is no disconnection between local/ directories
and perl versions.
Carton does not have a concept of perl version, any
module that isn't pure perl
or is platform dependent requires recompilation.
There is a manual solution!
Divorcing System // Toronto Perl Mongers // Shawn Sorichetti
- move the existing local directory out of the way
- plenv version-name returns only the
version name
- create a symbolic link from the perl version to
local
- install the new version of perl
- set the perl version, install cpanminus, and Carton
- create a new versioned local directory
- re-point the symbolic link
- now install everything else
Upgrading Perl
Divorcing System // Toronto Perl Mongers // Shawn Sorichetti
Questions?
Divorcing System // Toronto Perl Mongers // Shawn Sorichetti
Slides
https://github.com/ssoriche/talks
Divorcing System // Toronto Perl Mongers // Shawn Sorichetti

Contenu connexe

Tendances

OSDC 2014 ONIE by Nat Morris
OSDC 2014 ONIE by Nat MorrisOSDC 2014 ONIE by Nat Morris
OSDC 2014 ONIE by Nat MorrisCumulus Networks
 
Puppet control-repo 
to the next level
Puppet control-repo 
to the next levelPuppet control-repo 
to the next level
Puppet control-repo 
to the next levelAlessandro Franceschi
 
Prizm Installation Guide
Prizm Installation GuidePrizm Installation Guide
Prizm Installation Guidevjvarenya
 
Software management in linux
Software management in linuxSoftware management in linux
Software management in linuxnejadmand
 
Lecture1: NGS Analysis on Beocat and an introduction to Perl programming for ...
Lecture1: NGS Analysis on Beocat and an introduction to Perl programming for ...Lecture1: NGS Analysis on Beocat and an introduction to Perl programming for ...
Lecture1: NGS Analysis on Beocat and an introduction to Perl programming for ...Jennifer Shelton
 
Snort296x centos6x 2
Snort296x centos6x 2Snort296x centos6x 2
Snort296x centos6x 2Trinh Tuan
 
Yocto - Embedded Linux Distribution Maker
Yocto - Embedded Linux Distribution MakerYocto - Embedded Linux Distribution Maker
Yocto - Embedded Linux Distribution MakerSherif Mousa
 
Practical SVN for PHP Developers
Practical SVN for PHP DevelopersPractical SVN for PHP Developers
Practical SVN for PHP DevelopersLorna Mitchell
 
CMake - Introduction and best practices
CMake - Introduction and best practicesCMake - Introduction and best practices
CMake - Introduction and best practicesDaniel Pfeifer
 
ONIE / Cumulus Networks Webinar
ONIE / Cumulus Networks WebinarONIE / Cumulus Networks Webinar
ONIE / Cumulus Networks WebinarCumulus Networks
 
ONIE LinuxCon 2015
ONIE LinuxCon 2015ONIE LinuxCon 2015
ONIE LinuxCon 2015Curt Brune
 
L.A.M.P Installation Note --- CentOS 6.5
L.A.M.P Installation Note --- CentOS 6.5L.A.M.P Installation Note --- CentOS 6.5
L.A.M.P Installation Note --- CentOS 6.5William Lee
 
aptly: Debian repository management tool
aptly: Debian repository management toolaptly: Debian repository management tool
aptly: Debian repository management toolAndrey Smirnov
 
Introduction To Embedding The PH7 PHP Engine in a C/C++ Host Application.
Introduction To Embedding The PH7 PHP Engine in a C/C++ Host Application.Introduction To Embedding The PH7 PHP Engine in a C/C++ Host Application.
Introduction To Embedding The PH7 PHP Engine in a C/C++ Host Application.Chems Mrad
 
Operating System Practice : Meeting 7- working with bash shell-a-slide
Operating System Practice : Meeting 7- working with bash shell-a-slideOperating System Practice : Meeting 7- working with bash shell-a-slide
Operating System Practice : Meeting 7- working with bash shell-a-slideSyaiful Ahdan
 
Operating System Practice : Meeting 8- bekerja dengan bash shell-b-slide
Operating System Practice :  Meeting 8- bekerja dengan bash shell-b-slideOperating System Practice :  Meeting 8- bekerja dengan bash shell-b-slide
Operating System Practice : Meeting 8- bekerja dengan bash shell-b-slideSyaiful Ahdan
 
Deploying and maintaining your software with RPM/APT
Deploying and maintaining your software with RPM/APTDeploying and maintaining your software with RPM/APT
Deploying and maintaining your software with RPM/APTJoshua Thijssen
 

Tendances (19)

OSDC 2014 ONIE by Nat Morris
OSDC 2014 ONIE by Nat MorrisOSDC 2014 ONIE by Nat Morris
OSDC 2014 ONIE by Nat Morris
 
Puppet control-repo 
to the next level
Puppet control-repo 
to the next levelPuppet control-repo 
to the next level
Puppet control-repo 
to the next level
 
Prizm Installation Guide
Prizm Installation GuidePrizm Installation Guide
Prizm Installation Guide
 
Python at Facebook
Python at FacebookPython at Facebook
Python at Facebook
 
Presentation1
Presentation1Presentation1
Presentation1
 
Software management in linux
Software management in linuxSoftware management in linux
Software management in linux
 
Lecture1: NGS Analysis on Beocat and an introduction to Perl programming for ...
Lecture1: NGS Analysis on Beocat and an introduction to Perl programming for ...Lecture1: NGS Analysis on Beocat and an introduction to Perl programming for ...
Lecture1: NGS Analysis on Beocat and an introduction to Perl programming for ...
 
Snort296x centos6x 2
Snort296x centos6x 2Snort296x centos6x 2
Snort296x centos6x 2
 
Yocto - Embedded Linux Distribution Maker
Yocto - Embedded Linux Distribution MakerYocto - Embedded Linux Distribution Maker
Yocto - Embedded Linux Distribution Maker
 
Practical SVN for PHP Developers
Practical SVN for PHP DevelopersPractical SVN for PHP Developers
Practical SVN for PHP Developers
 
CMake - Introduction and best practices
CMake - Introduction and best practicesCMake - Introduction and best practices
CMake - Introduction and best practices
 
ONIE / Cumulus Networks Webinar
ONIE / Cumulus Networks WebinarONIE / Cumulus Networks Webinar
ONIE / Cumulus Networks Webinar
 
ONIE LinuxCon 2015
ONIE LinuxCon 2015ONIE LinuxCon 2015
ONIE LinuxCon 2015
 
L.A.M.P Installation Note --- CentOS 6.5
L.A.M.P Installation Note --- CentOS 6.5L.A.M.P Installation Note --- CentOS 6.5
L.A.M.P Installation Note --- CentOS 6.5
 
aptly: Debian repository management tool
aptly: Debian repository management toolaptly: Debian repository management tool
aptly: Debian repository management tool
 
Introduction To Embedding The PH7 PHP Engine in a C/C++ Host Application.
Introduction To Embedding The PH7 PHP Engine in a C/C++ Host Application.Introduction To Embedding The PH7 PHP Engine in a C/C++ Host Application.
Introduction To Embedding The PH7 PHP Engine in a C/C++ Host Application.
 
Operating System Practice : Meeting 7- working with bash shell-a-slide
Operating System Practice : Meeting 7- working with bash shell-a-slideOperating System Practice : Meeting 7- working with bash shell-a-slide
Operating System Practice : Meeting 7- working with bash shell-a-slide
 
Operating System Practice : Meeting 8- bekerja dengan bash shell-b-slide
Operating System Practice :  Meeting 8- bekerja dengan bash shell-b-slideOperating System Practice :  Meeting 8- bekerja dengan bash shell-b-slide
Operating System Practice : Meeting 8- bekerja dengan bash shell-b-slide
 
Deploying and maintaining your software with RPM/APT
Deploying and maintaining your software with RPM/APTDeploying and maintaining your software with RPM/APT
Deploying and maintaining your software with RPM/APT
 

Similaire à Divorcing System

Presentation1
Presentation1Presentation1
Presentation1cedrick
 
Presentation1
Presentation1Presentation1
Presentation1catarino
 
Getting started with PHPUnit
Getting started with PHPUnitGetting started with PHPUnit
Getting started with PHPUnitKhyati Gala
 
PuppetConf 2016: Enjoying the Journey from Puppet 3.x to 4.x – Rob Nelson, AT&T
PuppetConf 2016: Enjoying the Journey from Puppet 3.x to 4.x – Rob Nelson, AT&T PuppetConf 2016: Enjoying the Journey from Puppet 3.x to 4.x – Rob Nelson, AT&T
PuppetConf 2016: Enjoying the Journey from Puppet 3.x to 4.x – Rob Nelson, AT&T Puppet
 
Managing Perl Installations: A SysAdmin's View
Managing Perl Installations: A SysAdmin's ViewManaging Perl Installations: A SysAdmin's View
Managing Perl Installations: A SysAdmin's ViewBaden Hughes
 
Enjoying the Journey from Puppet 3.x to Puppet 4.x (PuppetConf 2016)
Enjoying the Journey from Puppet 3.x to Puppet 4.x (PuppetConf 2016)Enjoying the Journey from Puppet 3.x to Puppet 4.x (PuppetConf 2016)
Enjoying the Journey from Puppet 3.x to Puppet 4.x (PuppetConf 2016)Robert Nelson
 
Dependency management with Composer
Dependency management with ComposerDependency management with Composer
Dependency management with ComposerJason Grimes
 
Enterprise ids-columbus securitysummit-02
Enterprise ids-columbus securitysummit-02Enterprise ids-columbus securitysummit-02
Enterprise ids-columbus securitysummit-02policydoc
 
Piattaforma Web Linux completa dai sorgenti
Piattaforma Web Linux completa dai sorgentiPiattaforma Web Linux completa dai sorgenti
Piattaforma Web Linux completa dai sorgentiGiulio Destri
 
Introduction to linux
Introduction to linuxIntroduction to linux
Introduction to linuxQIANG XU
 
Updating_PHP_on_OS_X_Server
Updating_PHP_on_OS_X_ServerUpdating_PHP_on_OS_X_Server
Updating_PHP_on_OS_X_Servertutorialsruby
 
&lt;img src="../i/r_14.png" />
&lt;img src="../i/r_14.png" />&lt;img src="../i/r_14.png" />
&lt;img src="../i/r_14.png" />tutorialsruby
 
Updating_PHP_on_OS_X_Server
Updating_PHP_on_OS_X_ServerUpdating_PHP_on_OS_X_Server
Updating_PHP_on_OS_X_Servertutorialsruby
 
Linux Kernel - Let's Contribute!
Linux Kernel - Let's Contribute!Linux Kernel - Let's Contribute!
Linux Kernel - Let's Contribute!Levente Kurusa
 

Similaire à Divorcing System (20)

Presentation1
Presentation1Presentation1
Presentation1
 
CentOS
CentOSCentOS
CentOS
 
CentOS
CentOSCentOS
CentOS
 
CentOS
CentOSCentOS
CentOS
 
Presentation1
Presentation1Presentation1
Presentation1
 
Getting started with PHPUnit
Getting started with PHPUnitGetting started with PHPUnit
Getting started with PHPUnit
 
PHP selber bauen
PHP selber bauenPHP selber bauen
PHP selber bauen
 
Unix Administration 2
Unix Administration 2Unix Administration 2
Unix Administration 2
 
PuppetConf 2016: Enjoying the Journey from Puppet 3.x to 4.x – Rob Nelson, AT&T
PuppetConf 2016: Enjoying the Journey from Puppet 3.x to 4.x – Rob Nelson, AT&T PuppetConf 2016: Enjoying the Journey from Puppet 3.x to 4.x – Rob Nelson, AT&T
PuppetConf 2016: Enjoying the Journey from Puppet 3.x to 4.x – Rob Nelson, AT&T
 
Managing Perl Installations: A SysAdmin's View
Managing Perl Installations: A SysAdmin's ViewManaging Perl Installations: A SysAdmin's View
Managing Perl Installations: A SysAdmin's View
 
Enjoying the Journey from Puppet 3.x to Puppet 4.x (PuppetConf 2016)
Enjoying the Journey from Puppet 3.x to Puppet 4.x (PuppetConf 2016)Enjoying the Journey from Puppet 3.x to Puppet 4.x (PuppetConf 2016)
Enjoying the Journey from Puppet 3.x to Puppet 4.x (PuppetConf 2016)
 
Dependency management with Composer
Dependency management with ComposerDependency management with Composer
Dependency management with Composer
 
Enterprise ids-columbus securitysummit-02
Enterprise ids-columbus securitysummit-02Enterprise ids-columbus securitysummit-02
Enterprise ids-columbus securitysummit-02
 
Piattaforma Web Linux completa dai sorgenti
Piattaforma Web Linux completa dai sorgentiPiattaforma Web Linux completa dai sorgenti
Piattaforma Web Linux completa dai sorgenti
 
Introduction to linux
Introduction to linuxIntroduction to linux
Introduction to linux
 
Updating_PHP_on_OS_X_Server
Updating_PHP_on_OS_X_ServerUpdating_PHP_on_OS_X_Server
Updating_PHP_on_OS_X_Server
 
&lt;img src="../i/r_14.png" />
&lt;img src="../i/r_14.png" />&lt;img src="../i/r_14.png" />
&lt;img src="../i/r_14.png" />
 
Updating_PHP_on_OS_X_Server
Updating_PHP_on_OS_X_ServerUpdating_PHP_on_OS_X_Server
Updating_PHP_on_OS_X_Server
 
Linux Kernel - Let's Contribute!
Linux Kernel - Let's Contribute!Linux Kernel - Let's Contribute!
Linux Kernel - Let's Contribute!
 
John's Top PECL Picks
John's Top PECL PicksJohn's Top PECL Picks
John's Top PECL Picks
 

Dernier

Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clashcharlottematthew16
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostLeverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostZilliz
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Mattias Andersson
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationSafe Software
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):comworks
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr BaganFwdays
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenHervé Boutemy
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Mark Simos
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsSergiu Bodiu
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piececharlottematthew16
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupFlorian Wilhelm
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsRizwan Syed
 
The Future of Software Development - Devin AI Innovative Approach.pdf
The Future of Software Development - Devin AI Innovative Approach.pdfThe Future of Software Development - Devin AI Innovative Approach.pdf
The Future of Software Development - Devin AI Innovative Approach.pdfSeasiaInfotech2
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Scott Keck-Warren
 
My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024The Digital Insurer
 
Vector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector DatabasesVector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector DatabasesZilliz
 

Dernier (20)

Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clash
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostLeverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
 
DMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special EditionDMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special Edition
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache Maven
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platforms
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piece
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project Setup
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL Certs
 
The Future of Software Development - Devin AI Innovative Approach.pdf
The Future of Software Development - Devin AI Innovative Approach.pdfThe Future of Software Development - Devin AI Innovative Approach.pdf
The Future of Software Development - Devin AI Innovative Approach.pdf
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024
 
My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024
 
Vector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector DatabasesVector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector Databases
 
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptxE-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
 

Divorcing System

  • 2. - Years ago, perl developers required root access to install modules - Admins reluctant to hand over reins and security policies restricted it - use lib and @inc could get around some problems - perl bundled with OS always lagged behind - enter the tools What? • Removing dependency on root access • providing consistent environments Divorcing System // Toronto Perl Mongers // Shawn Sorichetti
  • 3. - going to start with plenv How to avoid root access • plenv • carton Divorcing System // Toronto Perl Mongers // Shawn Sorichetti
  • 4. - Written Tokuhiro Matsuno - plenv is implemented in bash, and provides simple shell script wrappers (called "shims") for each perl executable files. - perl is installed in user space and doesn't require any special permissions. plenv - perl binary manager https://github.com/tokuhirom/plenv Written by: Tokuhiro Matsuno Divorcing System // Toronto Perl Mongers // Shawn Sorichetti
  • 5. - Taken directly from the GitHub project page - perls are installed in your home directory - implemented in bash with simple shell script wrappers called shims - the shims provide access to perl executable files (carton, cpanm, prove) plenv vs. perlbrew Like perlbrew, plenv installs perls under your home directory and lets you install modules locally, and allows you to switch to arbitrary perl versions on your shell. Unlike perlbrew, plenv is implemented in bash, and provides simple shell script wrappers (called "shims") for each perl executable files. It doesn't export any shell functions that switches PATH before running commands. Unlike perlbrew, plenv allows you to set local perl version per directory, using .perl-version file. Unlike perlbrew, plenv doesn't provide built-in local::lib integrations, but plenv-contrib implements use and lib commands for a replacement Divorcing System // Toronto Perl Mongers // Shawn Sorichetti
  • 6. - there are multiple choices for installation to fit your needs - The installation page goes into detail plenv Installation https://github.com/tokuhirom/plenv#installation • macOS via homebrew brew install plenv perl-build • via git clone git clone https://github.com/tokuhirom/plenv.git ~/.plenv • manual/neckbeard Divorcing System // Toronto Perl Mongers // Shawn Sorichetti
  • 7. - plenv help provides an overview and can provide details per command - We're going to look at some of these commands more in depth plenv help Extensive online help system through plenv Each command has its own help via plenv help <command> Divorcing System // Toronto Perl Mongers // Shawn Sorichetti
  • 8. - You can see here that I have multiple installations of the same version - each of these is a directory that contains everything required for perl to run - the -debug version is built with additional flags, I'll come back to this perl binary manager • Installs perl in ~/.plenv • each directory contains an entire perl installation Divorcing System // Toronto Perl Mongers // Shawn Sorichetti
  • 9. - versions of perl that are available to install - This is a command that I always forget - There are a lot of versions available, including Release Candidates, Trials, cutting edge and ones you really shouldn't be running What versions can I build? plenv install --list lists all versions that can be installed. Divorcing System // Toronto Perl Mongers // Shawn Sorichetti
  • 10. - allows you to create a custom install of perl per project - using the as directive gives the perl installation a custom name - names can be anything, and are useful for matching projects or options specified - if you have modules that need to be installed for a project, using a project specific perl installation will keep the modules separate Custom versions per project The --as directive allows the name of the installed perl to be changed. Divorcing System // Toronto Perl Mongers // Shawn Sorichetti
  • 11. - build options can be passed to install - build in parallel - yes, this project required threads - there's no need to install man pages for all perl versions - unique name to identify Adding options to perl build Add options to the build directly on the command line Divorcing System // Toronto Perl Mongers // Shawn Sorichetti
  • 12. - plenv allows control of perl versions in different scenarios - the scope of use increases through the list - if a version is not set, plenv will default to system perl, which is whatever is installed with the OS - this can lead to undesirable results Selecting a version to use Sub commands for setting perl version: • local • shell • global Divorcing System // Toronto Perl Mongers // Shawn Sorichetti
  • 13. - sets the perl version via .perl- version file in the current directory - simple text file containing the version to use, so automation tools can write it - automatically searches up directory tree, which you can see here with the cd lib In directory tree • uses the local subcommand • also write the .perl-version file manually • specific to the working directory tree Divorcing System // Toronto Perl Mongers // Shawn Sorichetti
  • 14. - sets the version for the current shell - version stays in place until: - shell is closed - new version requested - enter directory with a .perl-version file - or the shell is --unset - as a side note, does not work with fish shell, to get around this set the PLENV_VERSION environment variable - in fact that's how we test with Jenkins Shell • uses the shell subcommand • specific to the current shell • use the --unset option to revert Divorcing System // Toronto Perl Mongers // Shawn Sorichetti
  • 15. - The global setting sets a common perl version to be used when none other is set - To use within cron a login shell is required bash -lc Global • uses the global subcommand • sets the default used for the system • only works in shells that have been initialized with plenv Divorcing System // Toronto Perl Mongers // Shawn Sorichetti
  • 16. - if home directories are an NFS or limited space in partition - overriding the plenv defaults using environment variables - plenv init is called to continue environment setup Change installation directory • Useful if $HOME isn't a good place to store perl installations Divorcing System // Toronto Perl Mongers // Shawn Sorichetti
  • 17. - Modules kept within the perl version's directory - each perl version has its own set of modules Where are the modules stored? Modules are contained along with other perl files Divorcing System // Toronto Perl Mongers // Shawn Sorichetti
  • 18. - plenv has built in support for installing cpanminus - automatically installs and runs plenv rehash CPANMINUS? plenv install-cpanm Divorcing System // Toronto Perl Mongers // Shawn Sorichetti
  • 19. - the plenv which command shows the full path to the script/bin that will be executed. - plenv rehash updates the shims that allow commands to be executed What's rehash? Packages that install scripts or bin/ are also stored by perl version. When new scripts/bins are installed plenv rehash must be run to update the shims. Divorcing System // Toronto Perl Mongers // Shawn Sorichetti
  • 20. - to install a version upgrade, just use plenv install - migrate-modules reads the previous versions module and installs them for the new version. Upgrading Same as installing a new version. migrate-modules re-installs all modules into the new version Divorcing System // Toronto Perl Mongers // Shawn Sorichetti
  • 21. - Handles installation and configuration for all of these environments And while you're managing plenv Why not manage all the envs! anyenv - all in one for **env https://github.com/riywo/anyenv Divorcing System // Toronto Perl Mongers // Shawn Sorichetti
  • 22. Enter CartonDivorcing System // Toronto Perl Mongers // Shawn Sorichetti
  • 23. - maintains a list of required versions and dependencies - allows locking down specific versions of modules - managed through cpanfile Carton Carton - Perl module dependency manager (aka Bundler for Perl) https://github.com/perl-carton/carton Written by: Tatsuhiko Miyagawa Divorcing System // Toronto Perl Mongers // Shawn Sorichetti
  • 24. - installation with cpanm in a fresh install Installing with plenv Divorcing System // Toronto Perl Mongers // Shawn Sorichetti
  • 25. - Another Miyagawa creation - Modules are specified using the requires keyword - optional minimal version numbers can be specified using the => '<version>' construct - version ranges, and exact versions can be specified with operators Version management Modules are managed through a cpanfile. More on cpanfile can be read here https://metacpan.org/pod/cpanfile Divorcing System // Toronto Perl Mongers // Shawn Sorichetti
  • 26. - reads the cpanfile and installs modules and dependencies using cpanm - All modules are installed in local/ directory - After modules are installed carton reads the contents of local/ and writes a cpanfile.snapshot Installing modules carton install reads the cpanfile file and installs modules and dependencies. All modules are installed in the local/ directory. Divorcing System // Toronto Perl Mongers // Shawn Sorichetti
  • 27. - local/ directory is identical to the system directories - bin/ contains scripts and binaries - lib/ standard perl module structure with perl5 directory Contents of local The local/ directory contains subdirectories of module contents. Divorcing System // Toronto Perl Mongers // Shawn Sorichetti
  • 28. - the carton exec command establishes the shell environment for script/command execution - local/bin scripts/commands are in the path and can be called directly - other commands can be executed using perl - it's also possible to carton exec -- bash to set environment within the shell Execution with carton The carton command will also set the shell environment to use the local/ directory. Divorcing System // Toronto Perl Mongers // Shawn Sorichetti
  • 29. - File is automatically generated by carton install - both a blessing and a curse What is the cpanfile.snapshot? Maintains a list of all installed modules, what they provide, versions, and dependencies. Divorcing System // Toronto Perl Mongers // Shawn Sorichetti
  • 30. - extremely useful for maintaining a consistent development environment across developers - maintains versions between development, test, QA and production Locking down versions When installing with the --deployment option, carton installs versions specified in cpanfile.snapshot. Divorcing System // Toronto Perl Mongers // Shawn Sorichetti
  • 31. - there are some difficulties with carton - there used to be more, but when trying to replicate them, they didn't occur again - most gotchas revolve around maintaining the cpanfile.snapshot Gotchas Divorcing System // Toronto Perl Mongers // Shawn Sorichetti
  • 32. - suspect that cpanm is failing to parse META.yml and the result is that the provides includes and undef version number Modules with malformed META.yml or META.json files provides includes an undef version number. Divorcing System // Toronto Perl Mongers // Shawn Sorichetti
  • 33. - Example of cpanfile.snapshot with File::HomeDir that's required by sqitch on Mac, get a diff with it being deleted - In this instance a co-worker installed a new module, but during the scan by carton install the Mac- SystemDirectory module was removed from cpanfile.snapshot - Must be careful when removing modules Module not required Difference between Linux and Mac requirements can cause different cpanfile.snapshot contents. Divorcing System // Toronto Perl Mongers // Shawn Sorichetti
  • 34. - using this method (discovered by Cees) mitigates a lot of issues - First install the versions specified in cpanfile.snapshot - update the cpanfile with the new requirements - Use cpanm to install any modules and dependencies into local/ - run carton install to update the cpanfile.snapshot - the tricky part is the commit, make sure not to include anything that might be updated. - To be thorough, remove rm -fr local/ and run carton install --deployment again Using cpanm to add/update modules Divorcing System // Toronto Perl Mongers // Shawn Sorichetti
  • 35. - Everything is stored in local/ - no breakout by version - adding separation isn't too difficult Upgrading Perl There is no disconnection between local/ directories and perl versions. Carton does not have a concept of perl version, any module that isn't pure perl or is platform dependent requires recompilation. There is a manual solution! Divorcing System // Toronto Perl Mongers // Shawn Sorichetti
  • 36. - move the existing local directory out of the way - plenv version-name returns only the version name - create a symbolic link from the perl version to local - install the new version of perl - set the perl version, install cpanminus, and Carton - create a new versioned local directory - re-point the symbolic link - now install everything else Upgrading Perl Divorcing System // Toronto Perl Mongers // Shawn Sorichetti
  • 37. Questions? Divorcing System // Toronto Perl Mongers // Shawn Sorichetti
  • 38. Slides https://github.com/ssoriche/talks Divorcing System // Toronto Perl Mongers // Shawn Sorichetti