Skip to main content

The death of my friend MP3

In the wake of recent news Fraunhofer Institute for Integrated Circuits IIS has officially put the MP3 out to pasture, I am reminded of the joys technology can bring to our lives.

Excluding the moral debate (or not) of a particular file-sharing platform, I recall my non-malicious use of said platform very fondly as I was a teenager discovering music in ways exponentially faster than my parents did a generation before. At the time I was the lucky one with a broadband connection, and my friends and I would binge share music we had discovered. I distinctly remember being introduced to a local band in Chicago named SOiL (a must if you enjoy hard-rock/metal). Something I would have never discovered without the advent of the MP3 and thereby file-sharing in its infancy, like it or not. Similar experiences followed with Mudvayne, Local H, Chevelle, From Zero and even Brawl (before they became Disturbed, we “ripped” their CDs and shared voraciously).

Rest In Peace MP3; my old friend.

 

Software Development Testing

Too often best practices for testing are an after-thought, or a non-thought with respect to the development and deployment of code.

This generally results in shortcuts or bandaids being applied to the SDLC of an organization which can build up over time and become a major constraint on the future product evolution.

With respect to a PHP driven application, my preference is PHPUnit. So briefly a friendly reminder to distinguish your tests by categorization, without opening up a can-of-worms on how to classify a test; we can do that later.

The simplest and easiest ways to get started with this is to organize your tests within PHPUnit, so you can run specific groups of tests along your deployment cycle.

For example, it’s generally a good practice to run your true unit tests on every commit. If they’re written correctly and concisely this shouldn’t introduce a bottleneck on the developers.

Building on that, this is a simple recommended approach for which tests to run along your pipeline:

  1. Unit
    1. On every commit
    2. After/during each pull-request being merged
  2. Integration
    1. On every preprod build; usually I do this with a jenkins/ansible build in a containerized environment that can hit specific api endpoints.
  3. Functional
    1. On every environment deployment. When deployed to env we’ll run tests specific for that environment to verify behaviors for things like billing rules, email filters, etc.
  4. UI
    1. After deployment; when deployed and “launched” we can run automated UI tests to verify behaviors and UI/UX interactions.
    2. These are typically lower importance/severity, so they can generally happen post-build.

Improve Symfony3 cache/logs performance by environment

Tired of the permission errors with your cache/logs in a Vagrant environment? Me too!

After being mildly annoyed with having to manually delete /var/cache and /var/logs repeatedly during “local” development, I decided to brut force matters into my own hands and solve this little annoyance once and for all. Ironically, Symfony 3.3 is addressing some of this, so it may be obsolete by then, but in the meantime…

What are we doing here?

  1. Define cache and logs directories for a specific environment.
    1. Wouldn’t it be awesome if we could customize these as parameters in the FrameworkBundle? Yes, yes it would!
  2. Write a simple CacheCommand that overrides the default cache:clear
  3. PARTY!!!!

Customize your getCacheDir and getLogDir methods by your environment

In my case, I typically use Vagrant/Virtualbox for local development, and Docker containers/bitbucket-pipelines for “test” while Production is a variety/flavor of AWS EC2 instances which have some additional flare.

Write a CacheCommand you can love and cherish forever and ever

PARTY!!!

Now you can enjoy life and all references to cache:clear will run your new and improved command that will also work noticably faster in Vagrant development environments; thanks entirely to Benjamin Eberlei and his wonderful blog post.

Enjoy!

cd /path/to/myapp && php bin/console cache:clear