Scalable Deployment Architectures with TYPO3 Surf, Git and Jenkins

7,835 views

Published on

Slides of my presentation at the Inspiring Flow conference (http://www.inspiring-flow.de) in Kolbermoor on April 20th, 2013.

Published in: Technology, Business
0 Comments
15 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
7,835
On SlideShare
0
From Embeds
0
Number of Embeds
280
Actions
Shares
0
Downloads
66
Comments
0
Likes
15
Embeds 0
No embeds

No notes for slide

Scalable Deployment Architectures with TYPO3 Surf, Git and Jenkins

  1. 1. Scalable
  2. 2.  Deployment
  3. 3.  Architectureswith
  4. 4.  TYPO3
  5. 5.  Surf,
  6. 6.  Git
  7. 7.  and
  8. 8.  JenkinsInspiring
  9. 9.  FLOW
  10. 10.  Conference,
  11. 11.  
  12. 12.  April
  13. 13.  20th
  14. 14.  2013Martin
  15. 15.  Helmich,
  16. 16.  Mittwald
  17. 17.  CM
  18. 18.  Servicem.helmich@mittwald.de
  19. 19. YOUR SPEAKERMartin
  20. 20.  HelmichSoftware
  21. 21.  Developer/Architectat
  22. 22.  MittwaldTYPO3
  23. 23.  addicted
  24. 24.  since
  25. 25.  2004Caffeine
  26. 26.  addicted
  27. 27.  since
  28. 28.  2007
  29. 29. LAST
  30. 30.  YEAR‘SFLOW3
  31. 31.  EXPERIENCEhttp://www.flickr.com/photos/techdivision/7038633581
  32. 32. Software
  33. 33.  deployment
  34. 34.  is
  35. 35.  all
  36. 36.  of
  37. 37.  the
  38. 38.  activities
  39. 39.  that
  40. 40.  make
  41. 41.  a
  42. 42.  software
  43. 43.  system
  44. 44.  available
  45. 45.  for
  46. 46.  use.„http://en.wikipedia.org/wiki/Software_deployment
  47. 47. Manual
  48. 48.  Deployment,
  49. 49.  Take
  50. 50.  #1CLICKDROPDRAG
  51. 51. COMMON
  52. 52.  PITFALLSWhat
  53. 53.  if...you
  54. 54.  don‘t
  55. 55.  know
  56. 56.  (or
  57. 57.  have
  58. 58.  forgotten)which
  59. 59.  files
  60. 60.  have
  61. 61.  changed
  62. 62.  since
  63. 63.  the
  64. 64.  last
  65. 65.  deployment?you
  66. 66.  want
  67. 67.  to
  68. 68.  roll
  69. 69.  back
  70. 70.  to
  71. 71.  a
  72. 72.  previous
  73. 73.  version?you
  74. 74.  want
  75. 75.  to
  76. 76.  know
  77. 77.  which
  78. 78.  version
  79. 79.  you
  80. 80.  are
  81. 81.  currently
  82. 82.  running?Manual
  83. 83.  Deployment,
  84. 84.  Take
  85. 85.  #1???
  86. 86. martin@mybox:~ ssh myserver.demartin@myserver:~ cd my_appmartin@myserver:~/my_app git fetch originmartin@myserver:~/my_app git reset --hard origin/mastermartin@myserver:~/my_app git submodule update --initmartin@myserver:~/my_app ./flow doctrine:migratemartin@myserver:~/my_app ./flow cache:flushManual
  87. 87.  Deployment,
  88. 88.  Take
  89. 89.  #2
  90. 90. martin@mybox:~ ssh myserver.demartin@myserver:~ cd my_appmartin@myserver:~/my_app git fetch originmartin@myserver:~/my_app git reset --hard origin/mastermartin@myserver:~/my_app git submodule update --initmartin@myserver:~/my_app ./flow doctrine:migratemartin@myserver:~/my_app ./flow cache:flushVERSION
  91. 91.  CONTROL is
  92. 92.  great!
  93. 93.  But
  94. 94.  what
  95. 95.  if...you
  96. 96.  forget
  97. 97.  one
  98. 98.  of
  99. 99.  these
  100. 100.  steps?there
  101. 101.  are
  102. 102.  ten
  103. 103.  servers
  104. 104.  (or
  105. 105.  100)instead
  106. 106.  of
  107. 107.  one??Manual
  108. 108.  Deployment,
  109. 109.  Take
  110. 110.  #2?
  111. 111. HERE:
  112. 112.  USING
  113. 113.  APACHE
  114. 114.  ANTAutomated
  115. 115.  Deployment
  116. 116. HERE:
  117. 117.  USING
  118. 118.  APACHE
  119. 119.  ANTAutomated
  120. 120.  Deploymentproject name=“my-app“ default=“deploy“!-- ... --target name=“git-fetch“exec executable=“git“arg line=“fetch origin“ //execexec executable=“git“arg line=“reset --hard origin/master“ //exec/targettarget name=“migrate“ depends=“git-fetch“ flow-migrate /flow-cache-flush //target/projectSEE
  121. 121.  https://github.com/martin-helmich/ant-typo3flow
  122. 122. TYPO3
  123. 123.  Surf
  124. 124. TYPO3
  125. 125.  SurfWHAT
  126. 126.  DOES
  127. 127.  IT
  128. 128.  DO?├── cache│   └── localgitclone├── releases│   ├── 20130324175345│   └── current - ./20130324175345└── sharedBEFORE
  129. 129. ├── cache│   └── localgitclone├── releases│   ├── 20130324175345│   └── current - ./20130324175345└── sharedBEFORE├── cache│   └── localgitclone├── releases│   ├── 20130324175345│   ├── 20130329184503│   ├── previous - ./20130324175345│   └── current - ./20130329184503└── sharedAFTERTYPO3
  130. 130.  SurfWHAT
  131. 131.  DOES
  132. 132.  IT
  133. 133.  DO?
  134. 134. TYPO3
  135. 135.  Surf├── cache│   └── localgitclone├── releases│   ├── 20130324175345│   ├── 20130329184503│   ├── previous - ./20130324175345│   └── current - ./20130329184503└── sharedPoint
  136. 136.  your
  137. 137.  document
  138. 138.  root
  139. 139.  HERE.Something
  140. 140.  goes
  141. 141.  wrong
  142. 142.  badly,
  143. 143.  simply
  144. 144.  RESET
  145. 145.  THE
  146. 146.  SYMLINK
  147. 147.  to
  148. 148.  the
  149. 149.  previous
  150. 150.  target.WHAT
  151. 151.  DOES
  152. 152.  IT
  153. 153.  DO?
  154. 154. Install
  155. 155.  using
  156. 156.  GIT: git clone git://git.typo3.org/FLOW3/Packages/TYPO3.Surf.git Packages/Application/TYPO3.Surf ./flow package:activate TYPO3.SurfInstall
  157. 157.  using
  158. 158.  Composer: ./composer.phar require typo3/surf=dev-master ./flow package:activate TYPO3.Surf
  159. 159. INITIALIZEUPDATEMIGRATEFINALIZETESTSWITCHCLEANUPSURF
  160. 160.  DEFAULTWORKFLOWThis
  161. 161.  is
  162. 162.  just
  163. 163.  the
  164. 164.  default
  165. 165.  workflow
  166. 166.  (called
  167. 167.  „SimpleWorkflow“).You
  168. 168.  can
  169. 169.  customize
  170. 170.  it
  171. 171.  as
  172. 172.  you
  173. 173.  like
  174. 174.  or
  175. 175.  even
  176. 176.  define
  177. 177.  entirely
  178. 178.  new
  179. 179.  workflows.
  180. 180. Use
  181. 181.  Jenkins
  182. 182.  to
  183. 183.  optimizeyour
  184. 184.  TYPO3
  185. 185.  Surf
  186. 186.  deployments#1:
  187. 187.  AUTOMATE
  188. 188. JENKINS MainBuildDeploymentBuildAuxiliaryBuildTYPO3
  189. 189.  SurfcallsGITtriggersnotifies
  190. 190.  viapost-receivehookgit
  191. 191.  pullDeveloperpushes
  192. 192.  to
  193. 193.  gitUpdate
  194. 194.  submodulesCompile/TranspileRun
  195. 195.  testsPacketizeGenerate
  196. 196.  documentationGenerate
  197. 197.  code
  198. 198.  metrics
  199. 199. Use
  200. 200.  Jenkins
  201. 201.  to
  202. 202.  optimizeyour
  203. 203.  TYPO3
  204. 204.  Surf
  205. 205.  deployments#2:
  206. 206.  PARALLELIZE
  207. 207. INITIALIZE
  208. 208.  
  209. 209.  UPDATE
  210. 210.  NODES
  211. 211.  N1..Nn SWITCHtimeN1 N2 N3 N4
  212. 212. N2 N3 N4N1N2N3N4INIT
  213. 213.  UPDATESWITCHtimeWOW!
  214. 214.  That‘s
  215. 215.  so
  216. 216.  much
  217. 217.  faster!But
  218. 218.  where
  219. 219.  is
  220. 220.  the
  221. 221.  catch
  222. 222.  in
  223. 223.  this...?
  224. 224. Execute
  225. 225.  deployments
  226. 226.  in
  227. 227.  parallel
  228. 228.  usingJenkin‘s
  229. 229.  multi-configuration
  230. 230.  builds.
  231. 231. ?php/** @var $deployment TYPO3SurfDomainModelDeployment */$workflow = new TYPO3SurfDomainModelSimpleWorkflow();$application = new TYPO3SurfApplicationBaseApplication(MyApplication);// ...$deployment-setWorkflow($workflow);$deployment-addApplication($application);if (getenv(BUILD_TARGET) !== FALSE) {    $node = new TYPO3SurfDomainModelNode(node- . getenv(BUILD_TARGET));    $node-setHostname(getenv(BUILD_TARGET));    $node-setOptions(array(        username = surf    ));    $application-addNode($node);} else {    foreach (array(www01,www02,www03) as $node) {        $node = new TYPO3SurfDomainModelNode(node- . $node);        $node-setHostname($node);        $node-setOptions(array(            username = surf        ));        $application-addNode($node);    }}
  232. 232. ?php/** @var $deployment TYPO3SurfDomainModelDeployment */$workflow = new TYPO3SurfDomainModelSimpleWorkflow();$application = new TYPO3SurfApplicationBaseApplication(MyApplication);// ...$deployment-setWorkflow($workflow);$deployment-addApplication($application);if (getenv(BUILD_TARGET) !== FALSE) {    $node = new TYPO3SurfDomainModelNode(node- . getenv(BUILD_TARGET));    $node-setHostname(getenv(BUILD_TARGET));    $node-setOptions(array(        username = surf    ));    $application-addNode($node);} else {    foreach (array(www01,www02,www03) as $node) {        $node = new TYPO3SurfDomainModelNode(node- . $node);        $node-setHostname($node);        $node-setOptions(array(            username = surf        ));        $application-addNode($node);    }}
  233. 233. ?php/** @var $deployment TYPO3SurfDomainModelDeployment */$workflow = new TYPO3SurfDomainModelSimpleWorkflow();$application = new TYPO3SurfApplicationBaseApplication(MyApplication);// ...$deployment-setWorkflow($workflow);$deployment-addApplication($application);if (getenv(BUILD_TARGET) !== FALSE) {    $node = new TYPO3SurfDomainModelNode(node- . getenv(BUILD_TARGET));    $node-setHostname(getenv(BUILD_TARGET));    $node-setOptions(array(        username = surf    ));    $application-addNode($node);} else {    foreach (array(www01,www02,www03) as $node) {        $node = new TYPO3SurfDomainModelNode(node- . $node);        $node-setHostname($node);        $node-setOptions(array(            username = surf        ));        $application-addNode($node);    }}
  234. 234. DeploymentBuildDeploy
  235. 235.  toNode
  236. 236.  N2Deploy
  237. 237.  toNode
  238. 238.  N3Deploy
  239. 239.  toNode
  240. 240.  N4Deploy
  241. 241.  toNode
  242. 242.  N1What
  243. 243.  happens
  244. 244.  when
  245. 245.  an
  246. 246.  erroroccurs
  247. 247.  on
  248. 248.  a
  249. 249.  specific
  250. 250.  node?
  251. 251. DeploymentBuildDeploy
  252. 252.  toNode
  253. 253.  N2Deploy
  254. 254.  toNode
  255. 255.  N3Deploy
  256. 256.  toNode
  257. 257.  N4Deploy
  258. 258.  toNode
  259. 259.  N1BuildFAILThe
  260. 260.  deployment
  261. 261.  buildfails,
  262. 262.  but
  263. 263.  there
  264. 264.  is
  265. 265.  no
  266. 266.  rollback
  267. 267.  on
  268. 268.  the
  269. 269.  other
  270. 270.  nodes!
  271. 271. „Update“BuildN1N2N3N4ON
  272. 272.  FAILURE„Switch“BuildPOSSIBLE
  273. 273.  SOLUTION
  274. 274.  (?)Split
  275. 275.  the
  276. 276.  deployment
  277. 277.  stages
  278. 278.  into
  279. 279.  two
  280. 280.  separate
  281. 281.  deployments
  282. 282.  with
  283. 283.  separate
  284. 284.  builds.ON
  285. 285.  SUCCESS„Rollback“BuildYou‘ll
  286. 286.  need
  287. 287.  the
  288. 288.  Build
  289. 289.  Result
  290. 290.  Trigger
  291. 291.  plugin
  292. 292.  for
  293. 293.  this.
  294. 294. Use
  295. 295.  Jenkins
  296. 296.  to
  297. 297.  optimizeyour
  298. 298.  TYPO3
  299. 299.  Surf
  300. 300.  deployments#3:
  301. 301.  FEEDBACK
  302. 302. Use
  303. 303.  glowing
  304. 304.  bears
  305. 305.  to
  306. 306.  inform
  307. 307.  you
  308. 308.  about
  309. 309.  your
  310. 310.  build
  311. 311.  and
  312. 312.  deployment
  313. 313.  status.https://wiki.jenkins-ci.org/pages/viewpage.action?pageId=20250625
  314. 314. Use
  315. 315.  glowing
  316. 316.  bears
  317. 317.  to
  318. 318.  inform
  319. 319.  you
  320. 320.  about
  321. 321.  your
  322. 322.  build
  323. 323.  and
  324. 324.  deployment
  325. 325.  status.https://wiki.jenkins-ci.org/pages/viewpage.action?pageId=20250625(If
  326. 326.  you
  327. 327.  don‘t
  328. 328.  have
  329. 329.  any
  330. 330.  glowing
  331. 331.  bears,
  332. 332.  you
  333. 333.  can
  334. 334.  use
  335. 335.  plugins
  336. 336.  like
  337. 337.  the
  338. 338.  Extreme
  339. 339.  Feedback
  340. 340.  plugin).https://wiki.jenkins-ci.org/display/JENKINS/eXtreme+Feedback+Panel+Plugin
  341. 341. GITPRIMARYGIT2NDARYGERRITJENKINSMASTER-1JENKINSMASTER-2BUILDNODESBUILDNODESDEVDEVINTDEVDEVQADEVDEVLIVETYPO3SURFTYPO3SURFDeployment
  342. 342.  architectureat
  343. 343.  MittwaldSVNTHEWORLDDEVDEVDEV
  344. 344. TYPO3
  345. 345.  Surf
  346. 346.  is
  347. 347.  optimized
  348. 348.  for
  349. 349.  the
  350. 350.  deployment
  351. 351.  of
  352. 352.  TYPO3
  353. 353.  {FLOW,Neos}
  354. 354.  applications,
  355. 355. TYPO3
  356. 356.  Surf
  357. 357.  is
  358. 358.  optimized
  359. 359.  for
  360. 360.  the
  361. 361.  deployment
  362. 362.  of
  363. 363.  TYPO3
  364. 364.  {FLOW,Neos}
  365. 365.  applications,BUT
  366. 366. TYPO3
  367. 367.  Surf
  368. 368.  is
  369. 369.  optimized
  370. 370.  for
  371. 371.  the
  372. 372.  deployment
  373. 373.  of
  374. 374.  TYPO3
  375. 375.  {FLOW,Neos}
  376. 376.  applications,BUTYou
  377. 377.  can
  378. 378.  use
  379. 379.  it
  380. 380.  for
  381. 381.  virtually
  382. 382.  anything:TYPO3
  383. 383.  CMSWordpressAnything
  384. 384.  that
  385. 385.  fits
  386. 386.  into
  387. 387.  a
  388. 388.  Git
  389. 389.  repositoryAnd
  390. 390.  maybe
  391. 391.  even
  392. 392.  Joomla!
  393. 393. USEFUL
  394. 394.  JENKINS/HUDSON
  395. 395.  PLUGINSGIT
  396. 396.  Pluginhttps://wiki.jenkins-ci.org/display/JENKINS/Git+PluginGerrit
  397. 397.  Triggerhttps://wiki.jenkins-ci.org/display/JENKINS/Gerrit+TriggerBuild
  398. 398.  Result
  399. 399.  Triggerhttps://wiki.jenkins-ci.org/display/JENKINS/BuildResultTrigger+PluginTYPO3
  400. 400.  Surf
  401. 401.  Builderhttps://github.com/martin-helmich/jenkins-typo3flow-pluginHIGHLY
  402. 402.  EXPERIMENTAL!Use
  403. 403.  at
  404. 404.  own
  405. 405.  risk!
  406. 406. •http://jenkins-ci.org•http://forge.typo3.org/projects/package-typo3-surf•http://git-scm.org•https://github.com/martin-helmich/ant-typo3flow•https://github.com/martin-helmich/jenkins-typo3surf-plugin•http://etobi.de/blog/2012/05/deployment-setup-typo3-surf/•http://de.slideshare.net/etobide/t3con12-flow-and-typo3-deployment-with-surf•https://git.typo3.org/FLOW3/Packages/TYPO3.Surf.git/blob/master:/Documentation/Guide/Index.rst•Duvall,
  407. 407.  Paul
  408. 408.  M:
  409. 409.  Continous
  410. 410.  Integration,
  411. 411.  published
  412. 412.  by
  413. 413.  Addison-Wesley•Wiest,
  414. 414.  Simon:
  415. 415.  Continuous
  416. 416.  Integration
  417. 417.  mit
  418. 418.  Hudson/Jenkins,
  419. 419.  published
  420. 420.  by
  421. 421.  dpunkt.•http://nvie.com/posts/a-successful-git-branching-model/
  422. 422.  
  423. 423.  
  424. 424.  READINGUseful
  425. 425.  ResourcesSOFTWARE
  426. 426.  
  427. 427.  
  428. 428.  
  429. 429. Questions?
  430. 430. Image
  431. 431.  SourcesHani
  432. 432.  Amirhttp://www.flickr.com/photos/haniamir/2377822286/Yaniv
  433. 433.  Golanhttp://www.flickr.com/photos/yanivg/131377774/David
  434. 434.  Tomichttp://www.flickr.com/photos/young_einstein/138800557/http://commons.wikimedia.org/wiki/File:CD_stack.jpghttp://www.flickr.com/photos/j1x4r/4313734090/Pedro
  435. 435.  Szekelyhttp://commons.wikimedia.org/wiki/File:Huntington_Beach_US_Surfing_Open_(6095230893).jpgKenny
  436. 436.  Louiehttp://en.wikipedia.org/wiki/File:Highway_401_Night_Lapse_Busy.jpghttp://commons.wikimedia.org/wiki/File:Arc-welding.jpg?uselang=de
  437. 437. Image
  438. 438.  Sources,
  439. 439.  #2Horia
  440. 440.  Varlanhttp://www.flickr.com/photos/horiavarlan/4747872021/

×