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

Zero to Hero [en]

Zero to Hero [en]

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

Christoph Lühr

November 04, 2014
Tweet

More Decks by Christoph Lühr

Other Decks in Programming

Transcript

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

    Zero to Hero "Fully Automated Web App Setups"
  2. ?

  3. FAQ

  4. ?

  5. FAQ

  6. ?

  7. VM

  8. $ 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] [email protected]:basilicom-de/bas-test.git [echo] Updating ansible inventory-production file [echo] Updating local ssh known_hosts file
  9. [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)
  10. [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]
  11. [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]
  12. [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
  13. [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]
  14. [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] }
  15. [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
  16. • Phing http://www.phing.info/ • Ansible http://www.ansible.com/ • Sample Vagrant, Phing

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