Upgrade to Pro — share decks privately, control downloads, hide ads and more …

FLOW & TYPO3 Deployment with Surf

2a244c5ed94d92d288444604360a919a?s=47 hlubek
October 05, 2012

FLOW & TYPO3 Deployment with Surf

Deployment with TYPO3 Surf at T3CON12 in Stuttgart. Surf is a new deployment tool built on top of the Flow PHP framework.

2a244c5ed94d92d288444604360a919a?s=128

hlubek

October 05, 2012
Tweet

Transcript

  1. FLOW & TYPO3 Deployment with

  2. Christopher Hlubek Tobias Liebig networkteam.com etobi.de Your Speakers

  3. How to deploy your code ?

  4. Manual Deployment

  5. Manual deployment # ssh testuser@my-staging-server.example.com user123 $ cd /var/www/project user123

    $ git pull --rebase user123 $ git submodule init user123 $ git submodule update user123 $ rm -rf Data/Temporary/Production user123 $ ./flow3 doctrine:migrate user123 $ ./flow3 cache:warmup # ssh user123@my-live-server1.example.com user123 $ cd /home/myproject/public_html user123 $ git pull --rebase user123 $ git submodule init user123 $ git submodule update user123 $ rm -rf Data/Temporary/Production user123 $ ./flow3 doctrine:migrate user123 $ ./flow3 cache:warmup # ssh user123@my-live-server2.example.com user123 $ cd /home/myproject/public_html user123 $ git pull --rebase user123 $ git submodule init user123 $ git submodule update user123 $ rm -rf Data/Temporary/Production user123 $ ./flow3 doctrine:migrate user123 $ ./flow3 cache:warmup Lot of work Erroneous
  6. Automated Deployment

  7. Possible solutions PHP? Bash Script Phing Script Capistrano Ant Script

    ...
  8. Environments Live Staging Integration Load-Testing Development Development

  9. Requirements Multiple Environments Rollback Extensibility Clustering Smoke Tests ...

  10. Meet

  11. Where‘s the wave Continuous Integration Infrastructure Surf TODO Add wave

    illustration Development
  12. Ride the wave Code Assets Configuration Your application Your Server

    Surf TODO Add wave illustration Deployment SSH Git Repository
  13. A simple deployment Build/Surf/planetflow3.php <?php $workflow = new \TYPO3\Surf\Domain\Model\SimpleWorkflow(); $deployment->setWorkflow($workflow);

    $application = new \TYPO3\Surf\Application\FLOW3(); $application->setDeploymentPath('/var/www/planetflow3-Integration'); $application->setOption('repositoryUrl', 'git://github.com/chlu/Planetflow3-Distribution.git'); $node = new \TYPO3\Surf\Domain\Model\Node('integration-server'); $node->setHostname('planetflow3-integration.example.com'); $application->addNode($node);
  14. Running the deployment

  15. Surf Architecture Flow Surf Packages Your package Standalone or Included

  16. The Surf Model Server Node Code / Assets Application Node

    Deployment Environments Deployment Workflow
  17. Workflow initialize update migrate finalize test switch cleanup Create release

    structure Code update (e.g. Git) Migration (e.g. Doctrine) Finalize release (cache warmup) Test release (smoke test) Publish release to live state Cleanup old releases Stages
  18. Tasks initialize update Workflow Base Application migrate switch cleanup ...

    Create Directories Create Symlinks Git Checkout Switch Symlinks Remove Releases Switch Symlinks
  19. Adding Tasks initialize Create Directories update Create Symlinks Workflow migrate

    Flow Migrate switch Switch Symlinks cleanup Remove Releases ... Git Checkout Flow Application
  20. execute(...) rollback(...) Task Task

  21. Rollback initialize update Workflow Base Application migrate switch cleanup ...

    Create Directories Create Symlinks Git Checkout Switch Symlinks Remove Releases Flow Migrate Flow Migrate
  22. The Node view myserver1.example.com Apache www.example.com VHosts

  23. The Node view myserver1.example.com Apache www.example.com VHosts Deployment path ├──

    cache ├── releases └── shared initialize
  24. The Node view myserver1.example.com Apache www.example.com next.example.com VHosts Deployment path

    ├── cache ├── releases │ ├── 20120101111100 │ └── next └── shared initialize update
  25. The Node view myserver1.example.com Apache www.example.com next.example.com VHosts Deployment path

    initialize update switch ... ├── cache ├── releases │ ├── 20120101111100 │ └── next └── shared ├── cache ├── releases │ ├── 20120101111100 │ └── current └── shared
  26. The Node view myserver1.example.com Apache www.example.com next.example.com VHosts Deployment path

    ├── cache ├── releases │ ├── 20120101111100 │ └── current └── shared Next release
  27. The Node view myserver1.example.com Apache www.example.com next.example.com VHosts Deployment path

    initialize ├── cache ├── releases │ ├── 20120101111100 │ └── current └── shared
  28. The Node view myserver1.example.com Apache www.example.com next.example.com VHosts Deployment path

    initialize update ├── cache ├── releases │ ├── 20120101111100 │ ├── 20120102122200 │ └── current └── shared
  29. The Node view myserver1.example.com Apache www.example.com next.example.com VHosts Deployment path

    initialize update ├── cache ├── releases │ ├── 20120101111100 │ ├── 20120102122200 │ ├── current │ └── next └── shared ...
  30. The Node view myserver1.example.com Apache www.example.com next.example.com VHosts Deployment path

    initialize update switch ... ├── cache ├── releases │ ├── 20120101111100 │ ├── 20120102122200 │ ├── current │ └── next └── shared
  31. The Node view myserver1.example.com Apache www.example.com next.example.com VHosts Deployment path

    initialize ├── cache ├── releases │ ├── 20120101111100 │ ├── 20120102122200 │ ├── previous │ └── current └── shared update switch ...
  32. Multiple Nodes myserver1 initialize update switch ... myserver2 myserver3 initialize

    initialize update update ... ... Workflow switch switch cleanup cleanup cleanup
  33. Further Features Multi application Simulate Deployments Smoke tests Custom tasks

  34. Application

  35. Deploying a Flow Application Flow Application Template Symlink Data Migrate

    Doctrine Composer install Create Directories ...
  36. Application TYPO3

  37. Deploying a TYPO3 CMS Challenges typo3_src uploads fileadmin Configuration Assets

    Templates git submodule Extension Symlink into „share“ Special Tasks
  38. Deploying a TYPO3 CMS Special Tasks Clear Caches (all, pages,

    configuration) Delete files in typo3temp Compare Database Tool Extension UPDATE function Set configuration Refresh extension list Run Unittests (EXT:phpunit) Create sys_news record Execute reports Add (de-)activate scheduler tasks Run SQL EXT:coreapi http://forge.typo3.org/projects/show/extension-coreapi
  39. Project Deployment Best Practice TYPO3 Surf EXT:coreapi ...

  40. Budget application for sprints pending.

  41. Join the discussion on forge.

  42. Additional Sponsoring needed.

  43. Talk to me.

  44. Project Deployment Best Practice TYPO3 Surf EXT:coreapi ...

  45. Deploying a TYPO3 CMS TYPO3CMS Application Template Symlink Data Execute

    EXT:coreapi Create Directories ...
  46. Current State Git is favored Flexible update planned SVN, rsync,

    Tar In daily use for production But in Beta state Stable release in Early 2013
  47. Questions ?