Tag Archives: development

Allow per-developer Vagrantfile customisations

If you are sharing a Vagrant file across a team, for example, for configuring a local development environment you’ll know that sometimes individual developers want their own VM tweaks. For example, they may have a machine with more memory that they’d like to dedicate to the VM. In order to support this, you can add a config file for custom changes:

Example Vagrantfile showing custom memory and CPU cap:

# -*- mode: ruby -*-
# vi: set ft=ruby :
require 'yaml'

if File.exists?('vagrant.yml')
  settings = YAML.load_file 'vagrant.yml'
end

memory_use    = defined?(settings['memory']) ? settings['memory'] : 1024
cpu_execution = defined?(settings['cpucap']) ? settings['cpucap'] : 50

Vagrant.configure(2) do |config|
  config.vm.box = "puphpet/centos65-x64"
  config.vm.network "private_network", ip: "192.168.56.101"

  config.vm.provider "virtualbox" do |vb|
    vb.memory = memory_use
    vb.customize ["modifyvm", :id, "--cpuexecutioncap", cpu_execution]
  end

  config.vm.provision "ansible" do |ansible|
    ansible.playbook = "provision/playbook.yml"
    ansible.become = true
    ansible.raw_arguments = Shellwords.shellsplit(ENV['ANSIBLE_ARGS']) if ENV['ANSIBLE_ARGS']
    ansible.compatibility_mode = "1.8"
  end
end

In this example, we’ve specified two configurable settings — memory_use and cpu_execution. Values will be read from the settings file, if it exists, otherwise default values are set (lines 9-10). Memory is specified in megabytes, and CPU execution is the maximum allowed percentage of the hosts CPU usage.

Example vagrant.yml file:

memory: 4096
cpucap: 75

Don’t forget to add the vagrant.yml file to your .*ignore file to make sure it isn’t committed to your source repo.

Glen Scott

I’m a freelance software developer with 18 years’ professional experience in web development. I specialise in creating tailor-made, web-based systems that can help your business run like clockwork. I am the Managing Director of Yellow Square Development.

More Posts

Follow Me:
TwitterFacebookLinkedIn

Going Freelance Part 4 – Finding Work

Fall 2011 Student Hackathon Coding

I recently read a blog post from Alan Hollis about his first month’s experience as a freelancer. Alan asked about tips on finding work, so I’ve collected some together in this blog post.

I’ve now been freelancing for 9 months, and so far I’ve been successful in finding work through these avenues:

Former work colleagues

My first few clients were people that I have worked with in the past, who had gone onto set up their own businesses. I remember Tweeting about being available as a freelancer when I started, and I soon received a few enquiries about my services.

The great thing about this kind of work is that you already know your client, and they know you, so the trust is there from day one.

Networking

I’ve been to a few networking events, including developer meet-ups and co-working sessions. I always take my business card to hand out, and on a couple of occasions I’ve found new work this way. Co-working sessions, such as Jelly are more “soft” networking because you are primarily going to work, and not sell, but can still lead to new clients.

Speculative e-mails

At one point I sent out a batch of speculative e-mails to local web design agencies, highlighting how my experience may be of benefit to them. A couple of agencies got back to me straight away enquiring about my rate, and I subsequently ended up doing a couple of months work with one of them.

My own site

I have a basic page advertising my services and I have had a couple of enquiries through this. I’m currently building out a more comprehensive site for myself, but it’s taking a while as client work always comes first! I reluctantly added Olark to the page to enable me to chat in real-time to visitors, and I was surprised to find someone using it to contact me shortly after I had installed it.

LinkedIn

I get a lot of enquiries from recruiters via my LinkedIn profile. Whilst a lot of these opportunities are not at all relevant, every now and again there has been an interesting contract position. Contracts are a “fall-back” option for me — if I’ve not got any freelance work, then I would then consider such opportunities.

Hopefully these tips are of some help to other freelancers.

Glen Scott

I’m a freelance software developer with 18 years’ professional experience in web development. I specialise in creating tailor-made, web-based systems that can help your business run like clockwork. I am the Managing Director of Yellow Square Development.

More Posts

Follow Me:
TwitterFacebookLinkedIn

Wise Words from Martin Fowler

I’ve become quite obsessive about unit testing recently, and in particular the PHPUnit testing framework. A big proponent of test-driven development is Martin Fowler, and I keep one of his quotes in a sticky note on my desktop as a little reminder:

Whenever you are tempted to type something into a print statement or a debugger expression, write it as a test instead.

The PHPUnit manual is really well written, and contains a great guide for writing your first tests.

Glen Scott

I’m a freelance software developer with 18 years’ professional experience in web development. I specialise in creating tailor-made, web-based systems that can help your business run like clockwork. I am the Managing Director of Yellow Square Development.

More Posts

Follow Me:
TwitterFacebookLinkedIn