A better website development workflow – part 2 puphpet
Here is a very bare bones way to get a local machine up and running in Vagrant. If you don’t have admin access to your machine you probably will not be able to do this, so make sure you have it for your local machine. The great thing about using puphpet is you don’t have to invest a lot time learning puppet to take advantage of the a virtual environment.
For this you will need:
- Virtual Box
- Mac OSX but this may work on other OSes, but I am doing this from the OSX machine
Everything will be configured via puphpet.com. There are lots of options that puphpet provides that make it really simple to get your first virtual machine running.
For a typical box I will run ubunutu 14 with apache, php, mysql. Everything on puphpet is setup with php and zend but you can use hhvm if you are feeling adventurous.
To get started go to puphpet.com
Below is a screenshot of the first screen, remember your ip address. Also note the sync folder this is how you can sync files via your local system.
Note not all of the screen is shown here:
I usually leave as is. You can setup Mailcatcher to deliever email if you need it.
I usually leave as is since this only running locally.
I usually select apache and then also add apache modules: vhost_alias and headers
On the second part of this page I will setup custom domain:
using the example below everything is based off of awesome.dev. You can replace this with whatever domain you like as long as you edit you localhost file. On mac this is /etc/hosts
Next you can configure php, I usually leave defaults unless you need something specific like curl, or gd, etc… You can also install xdebug, which I have not used but looks pretty nice. If you use sublime you can try this tutorial on installing xdebug.
Next I leave the database as is. Work queues and search servers I leave as is then create your manifest file by pressing the big blue button.
Now we are almost ready to launch. I like to keep my machines in vagrantboxes folder on my desktop. First unzip the file and then copy over you puphpet folder and vagrant file. Next bring up your terminal. You will need to use this to start your virtual machine. To keep it simple lets say you have a folder on your desktop called vagrantboxes.
In your terminal switch over to directory. You should be able to see your Vagrantfile. Next type vagrant up. You should now see your machine building. It may take several minutes for this to finish as it is building the machine so be patient.
cd ~ cd Desktop cd vagrantboxes vagrant up
…. when it is done you should see someting like this:____ ____ _ _ ____ _ generated using | _ \ _ _| _ \| | | | _ \ ___| |_ ___ ___ _ __ ___ | |_) | | | | |_) | |_| | |_) / _ \ __| / __/ _ \| '_ ` _ \ | __/| |_| | __/| _ | __/ __/ |_ | (_| (_) | | | | | | |_| \__,_|_| |_| |_|_| \___|\__(_)___\___/|_| |_| |_|
Once it is finished, I usually try and ping the server to verify it worked.ping 192.168.56.101
Congrats you now have a virtual machine working isolated from your desktop. Now you can look at the services by using ssh.
Type vagrant ssh and sudo netstat -tlnp$ vagrant ssh $ sudo netstat -tlnp Active Internet connections (only servers) Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name tcp 0 0 127.0.0.1:3306 0.0.0.0:* LISTEN 844/mysqld tcp 0 0 0.0.0.0:111 0.0.0.0:* LISTEN 600/rpcbind tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 1019/apache2 tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 1385/sshd tcp 0 0 0.0.0.0:1080 0.0.0.0:* LISTEN 884/ruby1.8 tcp 0 0 0.0.0.0:1025 0.0.0.0:* LISTEN 884/ruby1.8 tcp 0 0 0.0.0.0:50022 0.0.0.0:* LISTEN 716/rpc.statd tcp6 0 0 :::111 :::* LISTEN 600/rpcbind tcp6 0 0 :::22 :::* LISTEN 1385/sshd tcp6 0 0 :::38971 :::* LISTEN 716/rpc.statd
In the next part of this series I will be looking at setting up the custom local domain, connecting with a mysql client and using automated deployment via dandelion.
Related articles across the web