Quantcast
Channel: Christopher Ickes » vagrant

5 Essential Tools for EC2 Web Development

$
0
0

There are one million ways to configure your cloud servers. Here are a few tools to consider for web development efficiency.

Efficient Web Development Tools for Cloud Hosting

This is a quick list of tools with links to resources to help you learn more. We are assuming a Windows client developing on a LAMP stack but these tools can help with many configurations. If there are tools missing, please share with us in the comments below.

Eclipse

Open Source IDE for Web Development. Offers many plug-ins to improve your efficiency and address your choice of programming language.

PuTTY

SSH Client for Windows development. Is this essential? Depends on the developer. Many can get by with Remote Systems Explorer (RSE) in Eclipse. Personally I use both.

Git

Version control system that is free, open source and has a light footprint. Allows you to quickly revert to old versions of your project, allows teams to work concurrently and allows you to efficiently retrieve code from repositories such as github.

Vagrant

Synthesize development environments with production environments and also across teams. Vagrant allows you to create Virtual Machines to use for development. You can quickly & easily set up one configuration and then reproduce this configuration across projects, across developers & across environments.

Chef

While the previous 4 tools are no-brainers, Chef is a personal choice. Chef is a systems management tool that will help with automating server tasks and configurations. There is much debate between Chef, Puppet and others. In the end, choose one and learn it. My choice was Chef.

Putting All the Web Development Tools Together

I came a great tutorial that shows a basic EC2, Vagrant & Lamp integration. After you learn about each tool individually, perhaps try the tutorial to help with putting it all together.

Which Web Development Tools Help with Efficiency?

Share your favorite web development in the comments below. What did I miss? Let me know about it. Sharing helps all of us to improve.


Chef Configuration with Multiple Websites & Multiple Apps

$
0
0

Chef makes it easy to provision servers and deploy apps. Jason Grimes wrote an excellent three part tutorial including Vagrant and EC2 details.

This post assumes you have a successfully running project as instructed by Jason. Building upon Jason’s excellent work, let’s look at configuring multiple websites and apps using Chef.

As always, your feedback is valued so please leave additional tips and suggestions in the comments.

Chef Directory Structure for Multiple Apps

  1. Within your chef-repo directory (~/path/to/chef-repo/), create a new sub-directory called projects.
    Projects will contain Chef configurations for multiple projects.
  2. Copy the contents of your chef-repo directory except for the projects directory and move them to ~/path/to/chef-repo/projects/original_project/
  3. Access the new location and confirm your original nodes are listed.
    cd ~/path/to/chef-repo/projects/original_project
    knife node list

    If your original nodes are listed, you are ready to proceed.

Add a Second Project to Chef

Create the directory structure to support a new project. We will call the new project new_project.

mkdir ~/path/to/chef-repo/projects/new_project
mkdir ~/path/to/chef-repo/projects/new_project/.chef

Create directories normally found in a chef configuration (certificates, config, cookbooks, data_bags, environments, roles) although these may vary based on your configuration.

Create a New Organization at Opscode

Web developers are often working on multiple projects for multiple clients. Often web developers are working on side projects or start ups as well. It is best to create an Opscode account for each client and/or business.

Keeping client & project files separate is also why we chose to use a directory based approach as opposed to simply adding nodes and roles to a single configuration. Perhaps the node approach can be examined in a future post.

  1. Create a new account at Opscode Hosted Chef.
  2. While logged in, download your Chef Organization Validation Key and your knife config file (knife.rb).
  3. Download your User Private Key. This file is <username>.pem where <username> is replaced with your Chef username. If you don’t have this file for your NEW account, go to Opscode and click “Reset User Key”.
  4. Move the 3 downloaded files (knife.rb, <organization_name>-validation.pem and <username>.pem) to ~/path/to/chef-repo/projects/new_project/.chef
  5. cd ~/path/to/chef-repo/projects/new_project
    knife client list

    and confirm your new project is listed. You should see <organization-name&rt;-validator.

What Happens With Cookbooks in a Shared Chef Configuration?

The easiest way to share cookbooks between web projects is to use a tool such as Berkshelf or Librarian.

There are times when sharing is not possible even though cookbooks are required by 2 apps. In an non-DRY approach, copy the applicable cookbooks from ~/chef-repo/projects/original_project/cookbooks to ~/chef-repo/projects/new_project/cookbooks. NOTE: You won’t want to copy the original_project.rb cookbook and other original_project specific cookbooks.

In the ~/chef-repo/projects/new_project/ directory, upload the cookbooks.
knife cookbook upload --all

Similarly, continue to setup your environments, roles, users & databag secrets. If you need assistance, check out Jason Grimes’s Excellent tutorial.

Pay special attention to your data bag items. Each project should have unique passwords.

VagrantFile for 2 Websites – Multiple Virtual Machines

Vagrant supports Multi-VM Environments. Replace your existing VagrantFile with the configuration details for each project-specific VM.


app_servers = {
 :original_project => {
  :appname => "original_app",
  :orgname => "org1",
  :ipaddress => "10.0.0.20",
  :fwdport => "8080",
  :hostname => "originalapp-vm",
  :vmname => "ORIGINAL APP VM"
 },
 :new_project => {
  :appname => "new_app",
  :orgname => "org2",
  :ipaddress => "10.0.0.21",
  :fwdport => "8081",
  :hostname => "newapp-vm",
  :vmname => "NEW APP VM"
 }
}

Be sure to edit the values with your project specific values.

Append the code below to the end of your new VagrantFile.


Vagrant::Config.run do | config |

 app_servers.each do | app_server_name, app |
  config.vm.define app_server_name do |app_config|
   app_config.vm.box = "precise64"
   app_config.vm.forward_port 80, app[:fwdport].to_i
   app_config.vm.customize [
    "modifyvm", :id,
    "--name", "#{app[:vmname]}",
    "--memory", "2048"
   ]

   # Assign this VM to a host-only network IP
   app_config.vm.network :hostonly, app[:ipaddress]
   app_config.vm.host_name = "#{app[:hostname]}"

   node = ENV['NODE']
   node ||= "vagrant-#{app[:orgname]}"

   app_config.vm.share_folder("v-root", "/home/vagrant/apps", ".", :nfs => false)
   # remove nfs inside the parentheses for non-mac / non-linux hosts

   app_config.vm.provision :chef_client do |chef|
    chef.chef_server_url = "https://api.opscode.com/organizations/#{app[:orgname]}"
    chef.validation_key_path = "#{ENV['HOME']}/chef-repo/projects/#{app[:appname]}/.chef/#{app[:orgname]}-validator.pem"
    chef.validation_client_name = "#{app[:orgname]}-validator"
    chef.encrypted_data_bag_secret_key_path = "#{ENV['HOME']}/chef-repo/projects/#{app[:appname]}/.chef/encrypted_data_bag_secret"
    chef.node_name = "#{node}"
    chef.provisioning_path = "/etc/chef"
    chef.log_level = :debug
    chef.environment = "dev"
    chef.add_role("base")
    chef.add_role("db_master")
    chef.add_role("webserver")
   end
  end
 end
end

Chef Error with Mysql Installation

A quick sidenote: if you are receiving an error during the MySql portion of provisioning, check your password length. On my Vagrant installs, I ran into issues with passwords longer than 12 characters.

If you know why this error is occurring, please share in the comments below.

Update Hosts File

Use the Hosts file to add a human-friendly hostname for your project. Obtain the IP address for each project from your VagrantFile.

Add the following lines to your host file where you substitute the “x”s for the appropriate IP address.

127.0.0.1 localhost
xx.x.x.xx original_app.dev
xx.x.x.xy new_app.dev

Your new app should now be accessible at http://new_app.dev. Check for the Apache “It Worked” message. Same for http://original_app.dev. Obviously you will only be able to access these websites from your workstation.

Chef is Flexible Depending on Your Project

This approach separates each website / app into unique project directories. This approach is best for multiple clients and/or unrelated websites / apps.

Another, perhaps more efficient but not always applicable, method is to separate the websites into multiple nodes. The multiple nodes approach is best when you have related websites / apps such as an e-commerce store front, a blog and a brochureware site all on sub-domains.

How Can This Chef Configuration Be Improved?

Share with us in the comments below. Help all of us get better!

Best Ultrabook for Web Development 2013

$
0
0

Web developers require high performance laptops. Ultrabooks offer high portability. New ultrabooks offer incredible performance. Which ultrabook is best for web development in 2013?

Ultrabook Specs for Web Development

Ultrabooks will be compared across 4 features.

  1. Intel Haswell Processor
  2. RAM
  3. SSD (Solid State Drive) Hard Drive
  4. Weight & Size

Ultrabooks with Intel Haswell Processors

The Haswell Processor is Intel’s 4th generation chip set. Ultrabooks typically use the dual core version.

How Do I Identify a Haswell Processor?

Intel has three series of processors – i3, i5 & i7. Haswell processors have a “4″ immediately after the series number and a dash. A sample Haswell processor would be i7-4771 or i3-4330.

What Are the Benefits of An Intel Haswell Processor?

There are 3 main improvements in Ultrabooks.

  1. Improved Performance
  2. Improved Battery Life
  3. Improved Graphics

Seek Out Ultrabooks with 16 GB RAM

Many web development tools are memory hogs (Eclipse IDE, Virtual Machines like Vagrant). Accordingly, the more RAM, the better the experience.

How Much RAM Do I Need in An Ultrabook?

8 GB is the minimum RAM required for high performance web development. However, 16 GB of RAM is highly preferred. Unfortunately this can be a tough find in the current out of the box ultrabooks. Rare, but Ultrabooks with 16 GB of RAM do exist.

Why Is an SSD Ultrabook Better Than an HDD?

SSD (Solid State Drives) offers greater performance, durability and reliability than HDD (Hard Disk Drives). Of course these benefits come with a cost. The prices are now tantalizingly affordable as the supply of SSD Ultrabooks has increased.

SSD Ultrabooks also “wake” quickly.

Ultrabook Size & Weight

Portability is key with ultrabooks. Ample screen size is needed for web development workstation ultrabooks.

Top 4 Ultrabooks for Web Development

  ASUS Zenbook UX301LA Samsung ATIV Book 9 Plus HP Spectre 13t Apple MacBook Pro
Processor Haswell: 1.6 GHz Intel Core i5-4200U Haswell: 1.8 GHz Intel Core i7-4500U Haswell: 1.6 GHz Intel Core i5-4200U Haswell: 1.6 GHz Intel Core i5-4288U
RAM 8GB DDR3 RAM 8GB DDR3 RAM 8GB DRDR3 RAM 16GB DDR3 RAM
SSD 256GB SSD 256GB SSD 256GB SSD 256GB SSD
Size and Weight 13.3″ screen
2.6 pounds
13.3″ screen
3.1 pounds
13.3″ screen
3.3 pounds
13.3″ screen
3.5 pounds
Image and Price $1799.00

Which Ultrabook is Best for You?

Share with us in the comments below. Have you found a nice Ultrabook with 16GB of RAM, a Solid State Drive (SSD) and a 4th Generation Intel Haswell Processor? Is it lightweight and costs less than $2000? Please share with us too.





Latest Images