Top Banner
Project Lifecycle
39

F3X12 FLOW3 Project Lifecycle

Dec 18, 2014

Download

Technology

Project Setup, Deplyoment and Maintenance of FLOW3 projects. By Christopher Hlubek - networkteam GmbH.
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: F3X12 FLOW3 Project Lifecycle

Project Lifecycle

Page 2: F3X12 FLOW3 Project Lifecycle

TheProject LifecycleProject Setup, Deplyoment and Maintenance of FLOW3 projects.

Page 3: F3X12 FLOW3 Project Lifecycle

About me

Christopher HlubekCTO networkteam GmbH

FLOW3 & TYPO3 Phoenix Core Team

Page 4: F3X12 FLOW3 Project Lifecycle

SoftwareDevelopmentLifecycle

Requirements

Architecture

Design

ImplementationTest

Deploy

Support

Page 5: F3X12 FLOW3 Project Lifecycle

Architecture Test Deploy Support

SoftwareDevelopmentLifecycle

Code is not everything

Page 6: F3X12 FLOW3 Project Lifecycle

Non-Functional

Project Risks

Framework updates and changes

Bugs in application code

Bugs in framework code

Bugs in 3rd party code

Erroneous deployment ...

Page 7: F3X12 FLOW3 Project Lifecycle

Architecture

Page 8: F3X12 FLOW3 Project Lifecycle

Compositionof a FLOW3 application

Distribution

Configuration

Build Application Packages

Framework Packages

Community Packages

Data

Web

Page 9: F3X12 FLOW3 Project Lifecycle

Project Setup

Page 10: F3X12 FLOW3 Project Lifecycle

Create a distribution

git clone --recursive -o typo3 \ git://git.typo3.org/FLOW3/Distributions/Base.git MyDistribution

git remote add origin ssh://myrepo.local/path/to/distribution.git

Page 11: F3X12 FLOW3 Project Lifecycle

Versioning with Git

Your Git Server

Distribution

Application Packages

TYPO3 Git Server

Community PackagesTYPO3 / Community Git Server

Framework Packages

simple

Page 12: F3X12 FLOW3 Project Lifecycle

Emergency Hotfix - or -

Core Hacks

Page 13: F3X12 FLOW3 Project Lifecycle

Your Git Server

Distribution

Application Packages

TYPO3 Git Server

Community PackagesTYPO3 / Community Git Server

Framework Packages

more flexibleVersioning with Git

Page 14: F3X12 FLOW3 Project Lifecycle

Package Repository

Git Vendor Branching

[TASK] Lorem ipsum ...[BUGFIX] Some bugfix ...[FEATURE] Some feature ...

[TASK] Latest ...vendor/masterorigin/masterSubmodule

Pointer

Page 15: F3X12 FLOW3 Project Lifecycle

git checkout master

git commit ...

git push origin master

Create a hotfix

Page 16: F3X12 FLOW3 Project Lifecycle

Package Repository

Git Vendor Branching

[TASK] Lorem ipsum ...[BUGFIX] Some bugfix ...[FEATURE] Some feature ...

[TASK] Latest ...vendor/master

SubmodulePointer [HOTFIX] Custom patchorigin/master

Page 17: F3X12 FLOW3 Project Lifecycle

git fetch vendor

git merge vendor/master master

git push origin master

Update the Package

Page 18: F3X12 FLOW3 Project Lifecycle

Package Repository

Git Vendor Branching

[TASK] Lorem ipsum ...[BUGFIX] Some bugfix ...[FEATURE] Some feature ...

[TASK] Latest ...

[HOTFIX] Custom patch

origin/masterSubmodule

Pointer Merge remote-tracking ...

[TASK] New change ...vendor/master

Page 19: F3X12 FLOW3 Project Lifecycle

Test

Page 20: F3X12 FLOW3 Project Lifecycle

Unit Tests vs. Functional Tests

FLOW3 Framework

Application Package

Application Class / Unit

Database

Functional Test

Unit Test}

Page 21: F3X12 FLOW3 Project Lifecycle

Unit Tests

Test complex logic in isolation

Find the source of a problem

Should test a restricted set of classes

Page 22: F3X12 FLOW3 Project Lifecycle

Functional Tests

Test code with the framework and database

Check that a feature works

Isolation is difficult

Use mocks or fixtures for data or external services

Page 23: F3X12 FLOW3 Project Lifecycle

Where to test? High risk of failure

High complexity

Hard to test manually

More TestsLess Tests

Page 24: F3X12 FLOW3 Project Lifecycle

Test strategies

101

Page 25: F3X12 FLOW3 Project Lifecycle

Don‘t test everythingTest the important stuff

Page 26: F3X12 FLOW3 Project Lifecycle

Test every feature with one functional test

(at least)

Page 27: F3X12 FLOW3 Project Lifecycle

Reproduce bugswith tests

(they won‘t come back)

Page 28: F3X12 FLOW3 Project Lifecycle

Deployment

Deployment Deployment

Deployment Deployment Deployment

Page 29: F3X12 FLOW3 Project Lifecycle

Environments

Live Staging

Integration Load-Testing

DevelopmentDevelopment

Page 30: F3X12 FLOW3 Project Lifecycle

Manual deployment# ssh [email protected] $ cd /var/www/projectuser123 $ git pull --rebaseuser123 $ git submodule inituser123 $ git submodule updateuser123 $ rm -rf Data/Temporary/Productionuser123 $ ./flow3 doctrine:migrateuser123 $ ./flow3 cache:warmup

# ssh [email protected] $ cd /home/myproject/public_htmluser123 $ git pull --rebaseuser123 $ git submodule inituser123 $ git submodule updateuser123 $ rm -rf Data/Temporary/Productionuser123 $ ./flow3 doctrine:migrateuser123 $ ./flow3 cache:warmup

# ssh [email protected] $ cd /home/myproject/public_htmluser123 $ git pull --rebaseuser123 $ git submodule inituser123 $ git submodule updateuser123 $ rm -rf Data/Temporary/Productionuser123 $ ./flow3 doctrine:migrateuser123 $ ./flow3 cache:warmup

Lot of workErroneous

Page 31: F3X12 FLOW3 Project Lifecycle

Automated deployment

A custom script?

Rollback on errors?

Distributed deployment?

Page 32: F3X12 FLOW3 Project Lifecycle

Meet Surf

Page 33: F3X12 FLOW3 Project Lifecycle

Deployment with Surf

SSH

CI Server /Dev Host

Surf

Node

Node

Git Repositories Git

Page 34: F3X12 FLOW3 Project Lifecycle

The Surf Model

ServerNode

Code / ArtifactsApplication

Node

Deployment EnvironmentsDeployment

Wor

kflo

w

Page 35: F3X12 FLOW3 Project Lifecycle

Deployment process

initialize

update

migrate

finalize

test

switch

cleanup

Create release structure

Git update

Migration (e.g. Doctrine)

Finalize release

Test release (smoke test)

Publish release to live state

Cleanup old releases

Stages

Page 36: F3X12 FLOW3 Project Lifecycle

INFO Deploying vagrantINFO Using workflow "Simple workflow"DEBUG ====== Stage initialize ======DEBUG **** Node vagrant ****DEBUG * Application FLOW3 *DEBUG Executing stage "initialize" on "vagrant" for application FLOW3DEBUG Execute task "typo3.surf:createdirectories" on "vagrant" for application "FLOW3"DEBUG $vagrant: "test -d /home/planetflow3/deploy"DEBUG $vagrant: "mkdir -p /home/planetflow3/deploy/releases;mkdir -p /home/planetflow3/deploy/shared;mkdir -p /home/planetflow3/deploy/releases/20120331105449;cd /home/planetflow3/deploy/releases;ln -snf ./20120331105449 next"DEBUG Execute task "typo3.surf:flow3:createdirectories" on "vagrant" for application "FLOW3"DEBUG $vagrant: "mkdir -p /home/planetflow3/deploy/shared/Data/Logs;mkdir -p /home/planetflow3/deploy/shared/Data/Persistent;mkdir -p /home/planetflow3/deploy/shared/Configuration"DEBUG ====== Stage update ======DEBUG **** Node vagrant ****DEBUG * Application FLOW3 *DEBUG Executing stage "update" on "vagrant" for application FLOW3DEBUG Execute task "typo3.surf:gitcheckout" on "vagrant" for application "FLOW3"DEBUG $vagrant: "git ls-remote git://github.com/chlu/Planetflow3-Distribution.git refs/heads/master | awk '{print $1 }'"INFO > 7662553d5e666261a3a5bc2d6122096e7e21e40aDEBUG $vagrant: "if [ -d /home/planetflow3/deploy/cache/localgitclone ]; then cd /home/planetflow3/deploy/cache/localgitclone && git fetch -q origin && git reset -q --hard 7662553d5e666261a3a5bc2d6122096e7e21e40a && git submodule -q init && for mod in `git submodule status | awk '{ print $2 }'`; do git config -f .git/config submodule.${mod}.url `git config -f .gitmodules --get submodule.${mod}.url` && echo synced $mod; done && git submodule -q sync && git submodule -q update && git clean -q -d -x -ff; else git clone -q git://github.com/chlu/Planetflow3-Distribution.git /home/planetflow3/deploy/cache/localgitclone && cd /home/planetflow3/deploy/cache/localgitclone && git checkout -q -b deploy 7662553d5e666261a3a5bc2d6122096e7e21e40a && git submodule -q init && git submodule -q sync && git submodule -q update; fi"INFO > synced Build/CommonINFO > synced Packages/Application/LibtextcatINFO > synced Packages/Application/Planetflow3INFO > synced Packages/Framework/Doctrine.CommonINFO > synced Packages/Framework/Doctrine.DBALINFO > synced Packages/Framework/Doctrine.ORMINFO > synced Packages/Framework/Symfony.Component.YamlINFO > synced Packages/Framework/TYPO3.FLOW3INFO > synced Packages/Framework/TYPO3.FluidINFO > synced Packages/Framework/TYPO3.PartyDEBUG $vagrant: "cp -RPp /home/planetflow3/deploy/cache/localgitclone/. /home/planetflow3/deploy/releases/20120331105449 && (echo 7662553d5e666261a3a5bc2d6122096e7e21e40a > /home/planetflow3/deploy/releases/20120331105449REVISION)"DEBUG Task "typo3.surf:flow3:symlinkdata" after "typo3.surf:gitcheckout" for application FLOW3DEBUG Execute task "typo3.surf:flow3:symlinkdata" on "vagrant" for application "FLOW3"DEBUG $vagrant: "mkdir -p /home/planetflow3/deploy/releases/20120331105449/Data;cd /home/planetflow3/deploy/releases/20120331105449;ln -sf ../../../shared/Data/Logs ./Data/Logs;ln -sf ../../../shared/Data/Persistent ./Data/Persistent"DEBUG Task "typo3.surf:flow3:symlinkconfiguration" after "typo3.surf:gitcheckout" for application FLOW3DEBUG Execute task "typo3.surf:flow3:symlinkconfiguration" on "vagrant" for application "FLOW3"DEBUG $vagrant: "cd /home/planetflow3/deploy/releases/20120331105449/Configuration;rm -f Production/*;rmdir Production;mkdir -p ../../../shared/Configuration/Production;ln -snf ../../../shared/Configuration/Production Production"INFO > rmdir: failed to remove `Production': No such file or directoryDEBUG ====== Stage migrate ======DEBUG **** Node vagrant ****DEBUG * Application FLOW3 *DEBUG Executing stage "migrate" on "vagrant" for application FLOW3DEBUG Execute task "typo3.surf:flow3:migrate" on "vagrant" for application "FLOW3"DEBUG $vagrant: "cd /home/planetflow3/deploy/releases/20120331105449 && FLOW3_CONTEXT=Production ./flow3 typo3.flow3:doctrine:migrate"

Page 37: F3X12 FLOW3 Project Lifecycle

Deployment structure

< Document Root

Page 38: F3X12 FLOW3 Project Lifecycle

Deployment Features

Clustered deployment

Configuration overrides

Smoke tests

Custom tasks

Flexible workflows

Page 39: F3X12 FLOW3 Project Lifecycle

Questions?

?