Zero to Hero [en]

Zero to Hero [en]

Fully Automated Web App Setups (using Ansible and Phing) - @bephpug 2014-11-04

6e15b56fcb16fae0747810827be8ce8f?s=128

Christoph Lühr

November 04, 2014
Tweet

Transcript

  1. 1.

    Christoph Lühr @chluehr / bephpug 2014-11 Case study / Demo

    Zero to Hero "Fully Automated Web App Setups"
  2. 4.
  3. 8.
  4. 9.
  5. 11.
  6. 12.
  7. 13.

    ?

  8. 14.
  9. 18.
  10. 19.

    FAQ

  11. 20.
  12. 24.
  13. 25.
  14. 26.
  15. 30.

    ?

  16. 33.
  17. 34.

    FAQ

  18. 36.
  19. 41.

    ?

  20. 42.
  21. 44.
  22. 45.
  23. 46.
  24. 47.
  25. 48.
  26. 50.

    VM

  27. 54.
  28. 56.
  29. 57.
  30. 60.
  31. 61.
  32. 64.

    $ phing serversetup Buildfile:build.xml project > serversetup: Create JiffyBox automatically

    via API (Y,N) [Y]? Y Enter your Kassandra-API token: 5e#XhF8tHGr9^dWffq2pDT5Q [echo] Generating root password [echo] Root password is: 2baf4503a861448ca109 [echo] Creating JiffyBox via Kassandra API (ID/IP) - please wait ... [echo] JiffyBox is created, ID: 105754 IP: 134.119.20.131 [echo] Retrieving project repository url and name via git [exec] git@git.githost.de:basilicom-de/bas-test.git [echo] Updating ansible inventory-production file [echo] Updating local ssh known_hosts file
  33. 65.

    [echo] Setting up remote host os/software via ansible, this will

    take a couple of minutes, please wait ... [exec] PLAY [Install LAMP Stack with PHP 5.5 and MySQL] [exec] TASK: [upgrade | Running apt-get update] [exec] TASK: [upgrade | Running apt-get upgrade] [exec] TASK: [common | Common software] [exec] changed: [134.119.20.131] => (item=python-software-properties, build-essential,curl,screen,vim,ntp,jpegoptim, pngcrush,git-core,ufw)
  34. 66.

    [exec] TASK: [common | Set default locale] [exec] TASK: [ffmpeg

    | Download static FFMPEG binaries] [exec] TASK: [ffmpeg | Extract static FFMPEG binaries] [exec] TASK: [apache | Install Apache] [exec] TASK: [apache | Enable Apache2 rewrite module] ... [exec] TASK: [apache | Disable server signature] [exec] TASK: [apache | Disable server tokens] [exec] TASK: [apache | Set max request workers to 60] [exec] TASK: [pagespeed | Download mod_pagespeed] [exec] TASK: [pagespeed | Install mod_pagespeed] [exec] TASK: [mysql | Install MySQL server] [exec] TASK: [memcached | Memcached] [exec] TASK: [mongodb | MongoDB]
  35. 67.

    [exec] TASK: [php | Install PHP5] [exec] changed: [134.119.20.131] =>

    (item=php5-common,php5-mysqlnd, php5-xmlrpc,php5-mcrypt,php5-curl,php5-gd,php5-cli, php-pear,php5-dev,php5-imap,php5-imagick,php5-memcache, php5-mongo,libapache2-mod-php5) [exec] TASK: [php | Enable PHP5 opcode cache] [exec] TASK: [php | Enable PHP5 mcrypt] [exec] TASK: [php | Raise PHP memory Limit for Apache] [exec] TASK: [php | Allow short open tags for Apache PHP] [exec] TASK: [php | 8MB max upload size] [exec] TASK: [composer | Add Composer PPA] [exec] TASK: [composer | Install Composer]
  36. 68.

    [exec] TASK: [shell-access | Set the hostname] [exec] TASK: [shell-access

    | Set IP in hosts file for hostname] [exec] TASK: [shell-access | SSH Key-Pair for www-data] [exec] TASK: [shell-access | Create authorized_keys file] [exec] TASK: [shell-access | Create ssh config file] [exec] NOTIFIED: [apache | restart apache2] [exec] NOTIFIED: [beanstalkd | restart beanstalkd] [exec] [exec] PLAY RECAP ******************************************************************** [exec] 134.119.20.131 ok=59 changed=53 unreachable=0 failed=0
  37. 69.

    [echo] Retrieving remote ssh-key for deployment [echo] Adding deployment ssh-key

    to bitbucket repository via Kassandra API [echo] Installing project on remote host via ansible/phing, this will take a couple of minutes, please wait ... [exec] TASK: [clone-git | clone Project]
  38. 70.

    [exec] TASK: [pimcore | Pimcore setup] [exec] ok: [134.119.20.131] =>

    { [exec] "pimcoresetup.stdout_lines": [ [exec] "project > setup:", [exec] " [echo] PHING PROJECT SETUP - installing on: local " [exec] "project > dbcreate:", [exec] " [echo] Creating Database / Access - [dbcreate]", [exec] "project > pimcoremerge:", [exec] " [echo] Download and unpack pimcore distribution ", [exec] "project > pimcoreinstall:", [exec] " [echo] Installing Pimcore - [pimcoreinstall]", [exec] "project > configcreate:", [exec] " [echo] Creating set of configs in var/build", [exec] "project > apacheconfig:", [exec] " [echo] Configure Apache - [apacheconfig]", [exec] " [exec] Enabling site bas_pimtest.", [exec] " [exec] service apache2 reload", [exec] "project > installcron:", [exec] " [echo] Installing pimcore maintenance cron job", [exec] "BUILD FINISHED", [exec] ] [exec] }
  39. 71.

    [echo] Creating DNS Record via Kassandra API: A bas-test.appr.info 134.119.20.131

    TTL 300 [echo] Finally rebooting remote host [echo] ---------------------------------------------------------- [echo] PHING SERVER PROJECT SETUP - DONE [echo] ========================================================== BUILD FINISHED Total time: 7 minutes 2.14 seconds
  40. 73.
  41. 81.

    • Phing http://www.phing.info/ • Ansible http://www.ansible.com/ • Sample Vagrant, Phing

    & Ansible project setup http://bit.ly/basilicom-pimcore-setup-blog