Skip to main content

Posts

How to get Virtualbox VMs to talk to each other

I'm busy writing an Ansible script and want to test it locally before trying to deploy it anywhere.  The easiest way to try and make my local environment as close to my deployment environment was to set up a network of Virtualbox VMs. The problem was that I've always configured my VM's to use NAT networking.  I ssh onto them by setting port forwarding and have never really needed them to have their own address. The solution to this problem is pretty simple.  Just stop the machines and add a new network adapter of type "Host Only".  This adapter will handle communication between the guest and host machines. The trick is that you need to configure the guest OS network interface too. To do this SSH onto your VM and run "ip add" to list your network adapters.  If you're like me and started with NAT before adding "Host Only" as your second adapter the output should look something like this: You need to identify the adapter that is y...

Is PHP a good fit for an API server?

Image: Pixabay Calling PHP a double-claw hammer is a bit of an in-joke in the PHP community .  A lot of people bemoan PHP as a language – it's fashionable to do so and it seems to be a way to look clever.   The joke came about from a blog post where somebody pointed out all of the problems with PHP (here's a rebuttal -  https://blog.codinghorror.com/the-php-singularity/   ) Anyway, PHP is a warty language that sucks in academic circles but it doesn't matter because it's really good at web stuff, there are lots of people who know it (so it's cheap to hire), there are lots of libraries and frameworks (so it's cheap and fast to develop in).  The commercial world is willing to overlook the academic warts. I'm busy helping to improve the performance of an API server.  As part of my effort I'm profiling calls to the endpoints.  I'm using Blackfire to generate call graphs and also logging the sql queries that the ORM is producing so that I can check...