SlideShare uma empresa Scribd logo
1 de 35
Baixar para ler offline
PHP Deployment with
Subversion
 Lorna Mitchell



                       Ibuildings
                  The PHP Professionals




                                          Ibuildings
About Me
•   Lorna Mitchell
•   PHP Developer/Consultant/Trainer with Ibuildings
•   ZCE
•   Member of http://www.phpwomen.org
•   Personal blog at http://www.lornajane.net




                                                       2
SVN and Deployment
 •   Deployment process
 •   Deployment mechanism
 •   Subversion
 •   Other tools




                            3
In The Beginning

 •   One Developer
 •   Code on PC
 •   FTP / SCP / Upload to live server
 •   It works!




                                         4
Early Development Team

 • More developers
 • Development server
 • Ideally one copy per developer, a testing/staging
   server and a live platform

                                                    Dev
                      LIVE                          area


                                             Dev
                                    Dev
                                             area
                                    area
       Staging
                                      Dev      Dev
                                      area     area


                                                           5
Deployment Considerations

 • Multiple platforms prompt context-aware
   configuration
 • File permissions may need checking, for example
   on cache directories
 • If the live site has uploaded files stored in the file
   system, need to preserve this content
 • Compile step for initialising compiled templates or
   populating caches




                                                            6
Deployment Plan

 • A deployment plan is a recipe for moving code
 • Step-by-step instructions for setting up a new
   version of code
 • Must always be accompanied by a rollback plan
 • This process should be as automated as possible




                                                     7
Example Deployment Plan

 • Avoid missing steps when putting live

             Export from repository
             Tar




                           Upload




             Untar
             Set permissions
             Switch symlinks



                                           8
Symlinks

                       Live-site (symlink)




  Existing live code                    New code version




  existing                              ready
                                        preparing



                                                           9
Code Transport

 •   Copy development code to live
 •   Rsync development code to live
 •   Check out to live and update
 •   Export to live
 •   Patch changes from last live version only – requires
     version meta-data




                                                       10
Commit Hooks
 • Subversion can run scripts on given events, called
   “commit hooks”
      Pre-commit
      Post-commit
 •   Run test suite
 •   Coding standards conformance
 •   Syntax check
 •   No “forgetting” any steps




                                                    11
Notifications
 • Can use the commit hooks to trigger information
 • Email team
    Diff
    Changes
    Test coverage/outcomes
 • Ticker/big screen
 • Nabaztag




                                                     12
Source Control Packages
 •   Subversion http://subversion.tigris.org
 •   CVS http://www.cvshome.org
 •   GIT http://git.or.cz
 •   Bazaar http://bazaar-vcs.org
 •   Visual Source Safe




                                               13
Source Control Clients

 •   Command line tools
 •   TortoiseSVN: http://tortoise.tigris.org
 •   IDE Plugins: for Zend Studio, Komodo, etc
 •   WebSVN: http://websvn.tigris.org
      SFM (Safe For Managers)
 • Trac: http://trac.edgewall.org/




                                                 14
Source Control Concepts

 •   Individuals communicate with repository
 •   Keeping place
 •   Collaboration tool
 •   Historic versions




                                               15
Collaboration
 • Two people operate on different files
     Changes are combined
 • Two people change the same file
     Changes are merged if changes don't overlap
 • Allows teams to easily work on different parts of
   the system




                                                       16
Collaboration Example

                $greeting = 'hello world';
                echo $greeting;




  $greeting = 'hey people';     $greeting = 'hello world';
  echo $greeting;               print $greeting;




                   $greeting = 'hey people';
                   print $greeting;

                                                             17
Conflicts

 • Two people edit the same part of the same file
     Includes both adding a new method to the end of a class
 • Subversion will notify you of the conflict and
   provide:
     Your most recent version
     The version from the repository
     Its best guess at a merge with some notation for where
      the overlaps are




                                                               18
Conflict Example

                $greeting = 'hello world';
                echo $greeting;


  $greeting = 'hey people';   $greeting = 'hi universe';
  echo $greeting;             echo $greeting;




         $greeting = 'hey people';
         echo $greeting;




                                                           19
Conflict Example

  greeting.php                 greeting.php.r365
  <<<<<<< .mine                $greeting = 'hello world';
  $greeting = 'hi universe';   echo $greeting;
  =======
  $greeting = 'hey people';
  >>>>>>> .r366
  echo $greeting;


  greeting.php.mine            greeting.php.r366
  $greeting = 'hi universe';   $greeting = 'hey people';
  echo $greeting;              echo $greeting;


 • Correct greeting.php and then let Subversion know
   you have resolved the conflict

                                                            20
Branching




            21
Branching Example

                              trunk
                version 1.1
                                      Development done,
                                       merge in changes
                version 1.2

                                           development branch

      bug fix




                                               Delete extra
                                                 branch
   bug fix
   backport

                                                                22
Tagging Versions
 • Source control tools allow you to label releases,
   called “tags”
 • Subversion has one revision number for a whole
   repository, incrementing on every commit
 • CVS has one revision number per file
 • In either case its nice to have “client preview” or
   “release 4.11” as human readable markers




                                                         23
Repository Structure

 •   Repository layout choices
 •   Deployment point choices
 •   Affected by process
 •   Dependent on product type




                                 24
Cyclic Releases

 •   Periodic release cycle
 •   Need to maintain existing version
 •   Start developing new version
 •   May need to fix bugs in both versions
 •   Use branching




                                             25
Continuous Releases
 • Changes to branch
 • Branch merged to trunk
 • Can patch changes from branch to trunk for bug
   fixes
 • Deployment from trunk




                                                    26
Branch Deployment

                       trunk
         version 1.1

                       development branch

         version 1.2




                        testing


                                       deployment!




                                                     27
Live Branch

 •   Changes to branch
 •   Branch merged to trunk
 •   Testing performed on trunk
 •   Changes then patched to live branch
 •   Deployment from live branch




                                           28
Live Branch Deployment

          trunk          live branch


          development branch




           testing
                                       deployment!



                     approved
                      changes
                                               29
Database Versioning
 • Copying exported versions around
    Risk losing live data
 • Make structure changes to all platforms
    Put objects in scripts
 • Simple patching strategy
       No direct database operations
   
       Numbered patch files in subversion
   
       Include patches in script
   
       Give database awareness of current patch level
   
       Keep an installation script updated with all changes
   




                                                              30
Database Rollback
 • Write patch file
 • Also write undo file

 -- release.2.0.sql
 create table friends(
  user_id int not null
  friend_user_id int not null
  created_date timestamp default current_timestamp not null
 );


 -- release.2.0.undo.sql
 drop table friends;




                                                          31
DbMorph

 • Tool developed by Maggie Nelson
 • DbMorph, very early version http://sourceforge.net/
   projects/dbmorph
 • Also see Maggie's homepage
   http://objectivelyoriented.com
 • Slides from her talk at php|tek “Keeping Your
   Database and PHP in Sync”




                                                    32
Other Tools
 • Phing http://phing.info
        Project build system based on Apache Ant
    
        XML configuration
    
        Integration with SVN
    
        Available through PEAR
    
 • Phar http://pecl.php.net/package/phar
        Package management for PHP
    
        Like JAR for Java
    
        Self-extracting option
    
        PECL module
    




                                                   33
SVN and Deployment
 •   Deployment process
 •   Deployment mechanism
 •   Subversion
 •   Other tools




                            34
Questions?

  Lorna Mitchell - lorna@ibuildings.com




                                          Ibuildings

Mais conteúdo relacionado

Mais procurados

SVN Usage & Best Practices
SVN Usage & Best PracticesSVN Usage & Best Practices
SVN Usage & Best PracticesAshraf Fouad
 
SVN Best Practices
SVN Best PracticesSVN Best Practices
SVN Best Practicesabackstrom
 
Codecoon - A technical Case Study
Codecoon - A technical Case StudyCodecoon - A technical Case Study
Codecoon - A technical Case StudyMichael Lihs
 
Continuous delivery with jenkins, docker and exoscale
Continuous delivery with jenkins, docker and exoscaleContinuous delivery with jenkins, docker and exoscale
Continuous delivery with jenkins, docker and exoscaleJulia Mateo
 
It Works On My Machine: Vagrant for Software Development
It Works On My Machine: Vagrant for Software DevelopmentIt Works On My Machine: Vagrant for Software Development
It Works On My Machine: Vagrant for Software DevelopmentCarlos Perez
 
Subversion Best Practices
Subversion Best PracticesSubversion Best Practices
Subversion Best PracticesMatt Wood
 
Symfony Under Control by Maxim Romanovsky
Symfony Under Control by Maxim RomanovskySymfony Under Control by Maxim Romanovsky
Symfony Under Control by Maxim Romanovskyphp-user-group-minsk
 
Jenkins Pipeline Tutorial | Continuous Delivery Pipeline Using Jenkins | DevO...
Jenkins Pipeline Tutorial | Continuous Delivery Pipeline Using Jenkins | DevO...Jenkins Pipeline Tutorial | Continuous Delivery Pipeline Using Jenkins | DevO...
Jenkins Pipeline Tutorial | Continuous Delivery Pipeline Using Jenkins | DevO...Edureka!
 
How to write a Dockerfile
How to write a DockerfileHow to write a Dockerfile
How to write a DockerfileKnoldus Inc.
 
Pipeline as code - new feature in Jenkins 2
Pipeline as code - new feature in Jenkins 2Pipeline as code - new feature in Jenkins 2
Pipeline as code - new feature in Jenkins 2Michal Ziarnik
 
7 Habits of Highly Effective Jenkins Users
7 Habits of Highly Effective Jenkins Users7 Habits of Highly Effective Jenkins Users
7 Habits of Highly Effective Jenkins UsersJules Pierre-Louis
 
Brujug Jenkins pipeline scalability
Brujug Jenkins pipeline scalabilityBrujug Jenkins pipeline scalability
Brujug Jenkins pipeline scalabilityDamien Coraboeuf
 
Powering Development and Testing Environments with Vagrant
Powering Development and Testing Environments with VagrantPowering Development and Testing Environments with Vagrant
Powering Development and Testing Environments with VagrantCoen Jacobs
 
Continuous Delivery and Infrastructure as Code
Continuous Delivery and Infrastructure as CodeContinuous Delivery and Infrastructure as Code
Continuous Delivery and Infrastructure as CodeSascha Möllering
 

Mais procurados (19)

SVN Usage & Best Practices
SVN Usage & Best PracticesSVN Usage & Best Practices
SVN Usage & Best Practices
 
SVN Basics
SVN BasicsSVN Basics
SVN Basics
 
SVN Best Practices
SVN Best PracticesSVN Best Practices
SVN Best Practices
 
Svn Basic Tutorial
Svn Basic TutorialSvn Basic Tutorial
Svn Basic Tutorial
 
Codecoon - A technical Case Study
Codecoon - A technical Case StudyCodecoon - A technical Case Study
Codecoon - A technical Case Study
 
Continuous delivery with jenkins, docker and exoscale
Continuous delivery with jenkins, docker and exoscaleContinuous delivery with jenkins, docker and exoscale
Continuous delivery with jenkins, docker and exoscale
 
It Works On My Machine: Vagrant for Software Development
It Works On My Machine: Vagrant for Software DevelopmentIt Works On My Machine: Vagrant for Software Development
It Works On My Machine: Vagrant for Software Development
 
Subversion Best Practices
Subversion Best PracticesSubversion Best Practices
Subversion Best Practices
 
Perlbrew
PerlbrewPerlbrew
Perlbrew
 
Symfony Under Control by Maxim Romanovsky
Symfony Under Control by Maxim RomanovskySymfony Under Control by Maxim Romanovsky
Symfony Under Control by Maxim Romanovsky
 
Jenkins Pipeline Tutorial | Continuous Delivery Pipeline Using Jenkins | DevO...
Jenkins Pipeline Tutorial | Continuous Delivery Pipeline Using Jenkins | DevO...Jenkins Pipeline Tutorial | Continuous Delivery Pipeline Using Jenkins | DevO...
Jenkins Pipeline Tutorial | Continuous Delivery Pipeline Using Jenkins | DevO...
 
How to write a Dockerfile
How to write a DockerfileHow to write a Dockerfile
How to write a Dockerfile
 
Instant ColdFusion with Vagrant
Instant ColdFusion with VagrantInstant ColdFusion with Vagrant
Instant ColdFusion with Vagrant
 
Pipeline as code - new feature in Jenkins 2
Pipeline as code - new feature in Jenkins 2Pipeline as code - new feature in Jenkins 2
Pipeline as code - new feature in Jenkins 2
 
7 Habits of Highly Effective Jenkins Users
7 Habits of Highly Effective Jenkins Users7 Habits of Highly Effective Jenkins Users
7 Habits of Highly Effective Jenkins Users
 
Brujug Jenkins pipeline scalability
Brujug Jenkins pipeline scalabilityBrujug Jenkins pipeline scalability
Brujug Jenkins pipeline scalability
 
Powering Development and Testing Environments with Vagrant
Powering Development and Testing Environments with VagrantPowering Development and Testing Environments with Vagrant
Powering Development and Testing Environments with Vagrant
 
Docker
DockerDocker
Docker
 
Continuous Delivery and Infrastructure as Code
Continuous Delivery and Infrastructure as CodeContinuous Delivery and Infrastructure as Code
Continuous Delivery and Infrastructure as Code
 

Semelhante a PHP Deployment With SVN

Deployment With Subversion - Lorna Mitchell
Deployment With Subversion - Lorna MitchellDeployment With Subversion - Lorna Mitchell
Deployment With Subversion - Lorna Mitchelldpc
 
Version Control with SVN
Version Control with SVNVersion Control with SVN
Version Control with SVNPHPBelgium
 
An Infrastructure for Team Development - Gaylord Aulke
An Infrastructure for Team Development - Gaylord AulkeAn Infrastructure for Team Development - Gaylord Aulke
An Infrastructure for Team Development - Gaylord Aulkedpc
 
Virtualize and automate your development environment for fun and profit
Virtualize and automate your development environment for fun and profitVirtualize and automate your development environment for fun and profit
Virtualize and automate your development environment for fun and profitAndreas Heim
 
Continuous Integration Step-by-step
Continuous Integration Step-by-stepContinuous Integration Step-by-step
Continuous Integration Step-by-stepMichelangelo van Dam
 
Working With People Adl Uni
Working With People Adl UniWorking With People Adl Uni
Working With People Adl UniMatthew Landauer
 
Improving Application Installation Ux In Windows 7
Improving Application Installation Ux In Windows 7Improving Application Installation Ux In Windows 7
Improving Application Installation Ux In Windows 7Vijay Raj
 
JavaEdge 2008: Your next version control system
JavaEdge 2008: Your next version control systemJavaEdge 2008: Your next version control system
JavaEdge 2008: Your next version control systemGilad Garon
 
symfony: An Open-Source Framework for Professionals (Dutch Php Conference 2008)
symfony: An Open-Source Framework for Professionals (Dutch Php Conference 2008)symfony: An Open-Source Framework for Professionals (Dutch Php Conference 2008)
symfony: An Open-Source Framework for Professionals (Dutch Php Conference 2008)Fabien Potencier
 
[AMD] Novel Use of Perforce for Software Auto-updates and File Transfer
[AMD] Novel Use of Perforce for Software Auto-updates and File Transfer[AMD] Novel Use of Perforce for Software Auto-updates and File Transfer
[AMD] Novel Use of Perforce for Software Auto-updates and File TransferPerforce
 
Distributed Versioning Tools, BeJUG 2010
Distributed Versioning Tools, BeJUG 2010Distributed Versioning Tools, BeJUG 2010
Distributed Versioning Tools, BeJUG 2010Pursuit Consulting
 
Dvcs With Mercurial (No Notes)
Dvcs With Mercurial (No Notes)Dvcs With Mercurial (No Notes)
Dvcs With Mercurial (No Notes)Ted Naleid
 
Subversion Clients for the Mac - svnX
Subversion Clients  for the Mac - svnXSubversion Clients  for the Mac - svnX
Subversion Clients for the Mac - svnXBen MacNeill
 
WordPress Development Environments
WordPress Development Environments WordPress Development Environments
WordPress Development Environments Ohad Raz
 
Revision Control DrupalCampLA
Revision Control DrupalCampLARevision Control DrupalCampLA
Revision Control DrupalCampLATom Friedhof
 
symfony: An Open-Source Framework for Professionals (PHP Day 2008)
symfony: An Open-Source Framework for Professionals (PHP Day 2008)symfony: An Open-Source Framework for Professionals (PHP Day 2008)
symfony: An Open-Source Framework for Professionals (PHP Day 2008)Fabien Potencier
 
Drupal Version Control & File System Basics
Drupal Version Control & File System BasicsDrupal Version Control & File System Basics
Drupal Version Control & File System BasicsJulia Kulla-Mader
 
The Modern Developer Toolbox
The Modern Developer ToolboxThe Modern Developer Toolbox
The Modern Developer ToolboxPablo Godel
 
Source version control using subversion
Source version control using subversionSource version control using subversion
Source version control using subversionMangesh Bhujbal
 

Semelhante a PHP Deployment With SVN (20)

Deployment With Subversion - Lorna Mitchell
Deployment With Subversion - Lorna MitchellDeployment With Subversion - Lorna Mitchell
Deployment With Subversion - Lorna Mitchell
 
Version Control with SVN
Version Control with SVNVersion Control with SVN
Version Control with SVN
 
An Infrastructure for Team Development - Gaylord Aulke
An Infrastructure for Team Development - Gaylord AulkeAn Infrastructure for Team Development - Gaylord Aulke
An Infrastructure for Team Development - Gaylord Aulke
 
Virtualize and automate your development environment for fun and profit
Virtualize and automate your development environment for fun and profitVirtualize and automate your development environment for fun and profit
Virtualize and automate your development environment for fun and profit
 
Version Management with CVS
Version Management with CVSVersion Management with CVS
Version Management with CVS
 
Continuous Integration Step-by-step
Continuous Integration Step-by-stepContinuous Integration Step-by-step
Continuous Integration Step-by-step
 
Working With People Adl Uni
Working With People Adl UniWorking With People Adl Uni
Working With People Adl Uni
 
Improving Application Installation Ux In Windows 7
Improving Application Installation Ux In Windows 7Improving Application Installation Ux In Windows 7
Improving Application Installation Ux In Windows 7
 
JavaEdge 2008: Your next version control system
JavaEdge 2008: Your next version control systemJavaEdge 2008: Your next version control system
JavaEdge 2008: Your next version control system
 
symfony: An Open-Source Framework for Professionals (Dutch Php Conference 2008)
symfony: An Open-Source Framework for Professionals (Dutch Php Conference 2008)symfony: An Open-Source Framework for Professionals (Dutch Php Conference 2008)
symfony: An Open-Source Framework for Professionals (Dutch Php Conference 2008)
 
[AMD] Novel Use of Perforce for Software Auto-updates and File Transfer
[AMD] Novel Use of Perforce for Software Auto-updates and File Transfer[AMD] Novel Use of Perforce for Software Auto-updates and File Transfer
[AMD] Novel Use of Perforce for Software Auto-updates and File Transfer
 
Distributed Versioning Tools, BeJUG 2010
Distributed Versioning Tools, BeJUG 2010Distributed Versioning Tools, BeJUG 2010
Distributed Versioning Tools, BeJUG 2010
 
Dvcs With Mercurial (No Notes)
Dvcs With Mercurial (No Notes)Dvcs With Mercurial (No Notes)
Dvcs With Mercurial (No Notes)
 
Subversion Clients for the Mac - svnX
Subversion Clients  for the Mac - svnXSubversion Clients  for the Mac - svnX
Subversion Clients for the Mac - svnX
 
WordPress Development Environments
WordPress Development Environments WordPress Development Environments
WordPress Development Environments
 
Revision Control DrupalCampLA
Revision Control DrupalCampLARevision Control DrupalCampLA
Revision Control DrupalCampLA
 
symfony: An Open-Source Framework for Professionals (PHP Day 2008)
symfony: An Open-Source Framework for Professionals (PHP Day 2008)symfony: An Open-Source Framework for Professionals (PHP Day 2008)
symfony: An Open-Source Framework for Professionals (PHP Day 2008)
 
Drupal Version Control & File System Basics
Drupal Version Control & File System BasicsDrupal Version Control & File System Basics
Drupal Version Control & File System Basics
 
The Modern Developer Toolbox
The Modern Developer ToolboxThe Modern Developer Toolbox
The Modern Developer Toolbox
 
Source version control using subversion
Source version control using subversionSource version control using subversion
Source version control using subversion
 

Mais de Lorna Mitchell

Web Services PHP Tutorial
Web Services PHP TutorialWeb Services PHP Tutorial
Web Services PHP TutorialLorna Mitchell
 
Best Practice in API Design
Best Practice in API DesignBest Practice in API Design
Best Practice in API DesignLorna Mitchell
 
Git, GitHub and Open Source
Git, GitHub and Open SourceGit, GitHub and Open Source
Git, GitHub and Open SourceLorna Mitchell
 
Business 101 for Developers: Time and Money
Business 101 for Developers: Time and MoneyBusiness 101 for Developers: Time and Money
Business 101 for Developers: Time and MoneyLorna Mitchell
 
Things I wish web graduates knew
Things I wish web graduates knewThings I wish web graduates knew
Things I wish web graduates knewLorna Mitchell
 
Teach a Man To Fish (phpconpl edition)
Teach a Man To Fish (phpconpl edition)Teach a Man To Fish (phpconpl edition)
Teach a Man To Fish (phpconpl edition)Lorna Mitchell
 
Tool Up Your LAMP Stack
Tool Up Your LAMP StackTool Up Your LAMP Stack
Tool Up Your LAMP StackLorna Mitchell
 
Understanding Distributed Source Control
Understanding Distributed Source ControlUnderstanding Distributed Source Control
Understanding Distributed Source ControlLorna Mitchell
 
Best Practice in Web Service Design
Best Practice in Web Service DesignBest Practice in Web Service Design
Best Practice in Web Service DesignLorna Mitchell
 
Coaching Development Teams: Teach A Man To Fish
Coaching Development Teams: Teach A Man To FishCoaching Development Teams: Teach A Man To Fish
Coaching Development Teams: Teach A Man To FishLorna Mitchell
 
Zend Certification Preparation Tutorial
Zend Certification Preparation TutorialZend Certification Preparation Tutorial
Zend Certification Preparation TutorialLorna Mitchell
 
Implementing OAuth with PHP
Implementing OAuth with PHPImplementing OAuth with PHP
Implementing OAuth with PHPLorna Mitchell
 
Object Oriented Programming in PHP
Object Oriented Programming in PHPObject Oriented Programming in PHP
Object Oriented Programming in PHPLorna Mitchell
 
Could You Telecommute?
Could You Telecommute?Could You Telecommute?
Could You Telecommute?Lorna Mitchell
 

Mais de Lorna Mitchell (20)

OAuth: Trust Issues
OAuth: Trust IssuesOAuth: Trust Issues
OAuth: Trust Issues
 
Web Services PHP Tutorial
Web Services PHP TutorialWeb Services PHP Tutorial
Web Services PHP Tutorial
 
Best Practice in API Design
Best Practice in API DesignBest Practice in API Design
Best Practice in API Design
 
Git, GitHub and Open Source
Git, GitHub and Open SourceGit, GitHub and Open Source
Git, GitHub and Open Source
 
Business 101 for Developers: Time and Money
Business 101 for Developers: Time and MoneyBusiness 101 for Developers: Time and Money
Business 101 for Developers: Time and Money
 
Things I wish web graduates knew
Things I wish web graduates knewThings I wish web graduates knew
Things I wish web graduates knew
 
Teach a Man To Fish (phpconpl edition)
Teach a Man To Fish (phpconpl edition)Teach a Man To Fish (phpconpl edition)
Teach a Man To Fish (phpconpl edition)
 
Web services tutorial
Web services tutorialWeb services tutorial
Web services tutorial
 
Join In With Joind.In
Join In With Joind.InJoin In With Joind.In
Join In With Joind.In
 
Tool Up Your LAMP Stack
Tool Up Your LAMP StackTool Up Your LAMP Stack
Tool Up Your LAMP Stack
 
Going Freelance
Going FreelanceGoing Freelance
Going Freelance
 
Understanding Distributed Source Control
Understanding Distributed Source ControlUnderstanding Distributed Source Control
Understanding Distributed Source Control
 
Best Practice in Web Service Design
Best Practice in Web Service DesignBest Practice in Web Service Design
Best Practice in Web Service Design
 
Coaching Development Teams: Teach A Man To Fish
Coaching Development Teams: Teach A Man To FishCoaching Development Teams: Teach A Man To Fish
Coaching Development Teams: Teach A Man To Fish
 
Zend Certification Preparation Tutorial
Zend Certification Preparation TutorialZend Certification Preparation Tutorial
Zend Certification Preparation Tutorial
 
Implementing OAuth with PHP
Implementing OAuth with PHPImplementing OAuth with PHP
Implementing OAuth with PHP
 
Web Services Tutorial
Web Services TutorialWeb Services Tutorial
Web Services Tutorial
 
Object Oriented Programming in PHP
Object Oriented Programming in PHPObject Oriented Programming in PHP
Object Oriented Programming in PHP
 
Example Presentation
Example PresentationExample Presentation
Example Presentation
 
Could You Telecommute?
Could You Telecommute?Could You Telecommute?
Could You Telecommute?
 

Último

ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProduct Anonymous
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAndrey Devyatkin
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherRemote DBA Services
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingEdi Saputra
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
HTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesHTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesBoston Institute of Analytics
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyKhushali Kathiriya
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 
Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024SynarionITSolutions
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)wesley chun
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024The Digital Insurer
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?Igalia
 

Último (20)

ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
HTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesHTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation Strategies
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 

PHP Deployment With SVN

  • 1. PHP Deployment with Subversion Lorna Mitchell Ibuildings The PHP Professionals Ibuildings
  • 2. About Me • Lorna Mitchell • PHP Developer/Consultant/Trainer with Ibuildings • ZCE • Member of http://www.phpwomen.org • Personal blog at http://www.lornajane.net 2
  • 3. SVN and Deployment • Deployment process • Deployment mechanism • Subversion • Other tools 3
  • 4. In The Beginning • One Developer • Code on PC • FTP / SCP / Upload to live server • It works! 4
  • 5. Early Development Team • More developers • Development server • Ideally one copy per developer, a testing/staging server and a live platform Dev LIVE area Dev Dev area area Staging Dev Dev area area 5
  • 6. Deployment Considerations • Multiple platforms prompt context-aware configuration • File permissions may need checking, for example on cache directories • If the live site has uploaded files stored in the file system, need to preserve this content • Compile step for initialising compiled templates or populating caches 6
  • 7. Deployment Plan • A deployment plan is a recipe for moving code • Step-by-step instructions for setting up a new version of code • Must always be accompanied by a rollback plan • This process should be as automated as possible 7
  • 8. Example Deployment Plan • Avoid missing steps when putting live Export from repository Tar Upload Untar Set permissions Switch symlinks 8
  • 9. Symlinks Live-site (symlink) Existing live code New code version existing ready preparing 9
  • 10. Code Transport • Copy development code to live • Rsync development code to live • Check out to live and update • Export to live • Patch changes from last live version only – requires version meta-data 10
  • 11. Commit Hooks • Subversion can run scripts on given events, called “commit hooks”  Pre-commit  Post-commit • Run test suite • Coding standards conformance • Syntax check • No “forgetting” any steps 11
  • 12. Notifications • Can use the commit hooks to trigger information • Email team  Diff  Changes  Test coverage/outcomes • Ticker/big screen • Nabaztag 12
  • 13. Source Control Packages • Subversion http://subversion.tigris.org • CVS http://www.cvshome.org • GIT http://git.or.cz • Bazaar http://bazaar-vcs.org • Visual Source Safe 13
  • 14. Source Control Clients • Command line tools • TortoiseSVN: http://tortoise.tigris.org • IDE Plugins: for Zend Studio, Komodo, etc • WebSVN: http://websvn.tigris.org  SFM (Safe For Managers) • Trac: http://trac.edgewall.org/ 14
  • 15. Source Control Concepts • Individuals communicate with repository • Keeping place • Collaboration tool • Historic versions 15
  • 16. Collaboration • Two people operate on different files  Changes are combined • Two people change the same file  Changes are merged if changes don't overlap • Allows teams to easily work on different parts of the system 16
  • 17. Collaboration Example $greeting = 'hello world'; echo $greeting; $greeting = 'hey people'; $greeting = 'hello world'; echo $greeting; print $greeting; $greeting = 'hey people'; print $greeting; 17
  • 18. Conflicts • Two people edit the same part of the same file  Includes both adding a new method to the end of a class • Subversion will notify you of the conflict and provide:  Your most recent version  The version from the repository  Its best guess at a merge with some notation for where the overlaps are 18
  • 19. Conflict Example $greeting = 'hello world'; echo $greeting; $greeting = 'hey people'; $greeting = 'hi universe'; echo $greeting; echo $greeting; $greeting = 'hey people'; echo $greeting; 19
  • 20. Conflict Example greeting.php greeting.php.r365 <<<<<<< .mine $greeting = 'hello world'; $greeting = 'hi universe'; echo $greeting; ======= $greeting = 'hey people'; >>>>>>> .r366 echo $greeting; greeting.php.mine greeting.php.r366 $greeting = 'hi universe'; $greeting = 'hey people'; echo $greeting; echo $greeting; • Correct greeting.php and then let Subversion know you have resolved the conflict 20
  • 22. Branching Example trunk version 1.1 Development done, merge in changes version 1.2 development branch bug fix Delete extra branch bug fix backport 22
  • 23. Tagging Versions • Source control tools allow you to label releases, called “tags” • Subversion has one revision number for a whole repository, incrementing on every commit • CVS has one revision number per file • In either case its nice to have “client preview” or “release 4.11” as human readable markers 23
  • 24. Repository Structure • Repository layout choices • Deployment point choices • Affected by process • Dependent on product type 24
  • 25. Cyclic Releases • Periodic release cycle • Need to maintain existing version • Start developing new version • May need to fix bugs in both versions • Use branching 25
  • 26. Continuous Releases • Changes to branch • Branch merged to trunk • Can patch changes from branch to trunk for bug fixes • Deployment from trunk 26
  • 27. Branch Deployment trunk version 1.1 development branch version 1.2 testing deployment! 27
  • 28. Live Branch • Changes to branch • Branch merged to trunk • Testing performed on trunk • Changes then patched to live branch • Deployment from live branch 28
  • 29. Live Branch Deployment trunk live branch development branch testing deployment! approved changes 29
  • 30. Database Versioning • Copying exported versions around  Risk losing live data • Make structure changes to all platforms  Put objects in scripts • Simple patching strategy No direct database operations  Numbered patch files in subversion  Include patches in script  Give database awareness of current patch level  Keep an installation script updated with all changes  30
  • 31. Database Rollback • Write patch file • Also write undo file -- release.2.0.sql create table friends( user_id int not null friend_user_id int not null created_date timestamp default current_timestamp not null ); -- release.2.0.undo.sql drop table friends; 31
  • 32. DbMorph • Tool developed by Maggie Nelson • DbMorph, very early version http://sourceforge.net/ projects/dbmorph • Also see Maggie's homepage http://objectivelyoriented.com • Slides from her talk at php|tek “Keeping Your Database and PHP in Sync” 32
  • 33. Other Tools • Phing http://phing.info Project build system based on Apache Ant  XML configuration  Integration with SVN  Available through PEAR  • Phar http://pecl.php.net/package/phar Package management for PHP  Like JAR for Java  Self-extracting option  PECL module  33
  • 34. SVN and Deployment • Deployment process • Deployment mechanism • Subversion • Other tools 34
  • 35. Questions? Lorna Mitchell - lorna@ibuildings.com Ibuildings