An introduction to automated development environment and Laravel Homestead

An introduction to automated development environment and Laravel Homestead

In this presentation, I explain what DevOps is, and how infrastructure as code can be used as a tool to improve your development environment. In the second part, I explain the advantages of Vagrant and show how easy you can get started with Homestead.

B4e6cd606ce4f2122d78f259e46ea64a?s=128

Jens Segers

July 31, 2014
Tweet

Transcript

  1. Jens Segers @jenssegers jenssegers.be github.com/jenssegers

  2. Laravel related repositories - laravel-mongodb - laravel-agent - laravel-date ...

  3. None
  4. None
  5. What is DevOps?

  6. None
  7. Say hello to Infrastructure as Code

  8. Mark Burgess 1993, University of Oslo

  9. #!/bin/bash echo "$HOSTNAME" > /etc/hostname hostname -F /etc/hostname apt-get install

    -y ntp sed -i "s/Port 22/Port $SSHPORT/g" /etc/ssh/sshd_config useradd -s /bin/bash -m -d /home/$USER -U -p $PASS $USER
  10. bootstrap.sh debian.sh centos.sh webserver_debian.sh mailserver_debian.sh webserver_centos.sh mailserver_centos.sh webserver_debian7.sh mailserver_debian7.sh webserver_debian_intel.sh

    webserver_debian_dell.sh webserver_debian7_intell.sh webserver_debian7_dell.sh
  11. file: “file.txt” -> “foo” this file contains the word ‘foo’

  12. echo “foo” > file.txt add the word ‘foo’ to this

    file
  13. Service File 1 User File 2 Package Building blocks

  14. File Attributes: - filename - content - permissions - owner

    Operations: - create - modify - delete Abstract class/interface
  15. Debian Centos Provider Provider Operating system independent package: “nginx” apt-get

    -y install nginx yum -y install nginx
  16. Advantages Infrastructure as Code

  17. 1. Infrastructure documentation 2. Software tools 3. Versioning 4. Platform

    independent 5. Idempotent/self-healing 6. Testing & development ...
  18. The Tools

  19. +

  20. What is Vagrant?

  21. virtual machines + provisioning

  22. Example Vagrantfile Vagrant.configure("2") do |config| config.vm.box = 'precise32' config.vm.box_url =

    'http://files.vagrantup.com/precise32.box' # Port forwarding config.vm.network "forwarded_port", guest: 80, host: 8000 # Shared folder config.vm.synced_folder "src/", "/var/www/website" end
  23. Boot the virtual machine vagrant up SSH to the virtual

    machine vagrant ssh Shutdown and remove the VM vagrant destroy
  24. What is Homestead?

  25. Homestead Provisioning for Vagrant

  26. - Ubuntu 14.04 - PHP 5.5 - Nginx - MySQL

    - Postgres - Node (Bower, Grunt & Gulp) Homestead base image - Redis - Memcached - Beanstalkd - Laravel Envoy - Fabric + HipChat Extension
  27. Installing Homestead

  28. 1. Install VirtualBox and Vagrant virtualbox.org vagrantup.com

  29. 2. Add the Homestead box vagrant box add laravel/homestead ==>

    box: Loading metadata for box 'laravel/homestead' box: URL: https://vagrantcloud.com/laravel/homestead ==> box: Adding box 'laravel/homestead' (v0.1.7) for provider: virtualbox
  30. 3. Clone the Homestead repository git clone https://github.com/laravel/homestead.git Homestead Cloning

    into 'Homestead'... remote: Reusing existing pack: 154, done. remote: Total 154 (delta 0), reused 0 (delta 0)
  31. 4. Edit Homestead.yaml authorize: /Users/me/.ssh/id_rsa.pub keys: - /Users/me/.ssh/id_rsa

  32. 4. Edit Homestead.yaml folders: - map: /Users/me/Code to: /home/vagrant/Code

  33. 4. Edit Homestead.yaml sites: - map: homestead.app to: /home/vagrant/Code/Laravel/public

  34. 4. Edit Homestead.yaml variables: - key: APP_ENV value: local

  35. 5. Add domain to /etc/hosts 127.0.0.1 homestead.app

  36. 6. Start the Homestead VM vagrant up

  37. 7. Done http://homestead.app:8000

  38. Homestead advantages 1. Uniform development environment 2. Made for Laravel

    3. Easy for beginners 4. Disposable virtual machines Homestead disadvantages 1. Different from production 2. Not “DevOps”
  39. Homestead what? laravel.com/docs/homestead laracasts.com/lessons/introducing-laravel- homestead

  40. Jens Segers @jenssegers jenssegers.be github.com/jenssegers