Dcycle Blog

Recent Posts

  • October 06, 2017

    Deploying Letsencrypt with Docker-Compose

    Last week I wrote about setting up a reverse-proxy to serve a number any number of Docker containers via https.In order for this technique to work with Docker-Compose, we need to add a network to the Docker-Compose container.PremiseLet’s say you h...

  • October 03, 2017

    Letsencrypt HTTPS for Drupal on Docker

    This article is about serving your Drupal Docker container, and/or any other container, via https with a valid Let’s encrypt SSL certificate.Edit: if you’re having trouble with Docker-Compose, read this follow-up post.Step one: make sure you have ...

  • February 28, 2017

    Can the exact same module code run on Drupal 7 and 8?

    As the maintainer of Realistic Dummy Content, having procrastinated long and hard before releasing a Drupal 8 version, I decided to leave my (admittedly inelegant) logic intact and abstract away the Drupal 7 code, with the goal of plugging in Drup...

  • October 02, 2016

    When not to use Drupal

    Unless you work exclusively with Drupal developers, you might be hearing some criticism of the Drupal community, among them: We are almost cult-like in our devotion to Drupal; maintenance and hosting are expensive; Drupal is really complicated;...

  • September 30, 2016

    Migrating data from Drupal to Jekyll

    This technical post will run through how I went about migrating this site (the Dcycle blog) from Drupal to Jekyll. For the reasons why I migrated, please see Know when not to use Drupal.Exporting very simple content from Drupal to JekyllDepending ...

  • September 19, 2016

    Using Docker to evaluate, patch or develop Drupal modules

    Docker is now available natively on Mac OS in addition to Linux. Docker is also included with CoreOS which you can run on remote Virtual Machines, or locally through Vagrant.Once you have installed Docker and Git, locally or remotely, you don’t ne...

  • May 08, 2016

    Using git bisect to determine when a failure was introduced

    So your project’s tests are failing and you’re not sure when the failure was introduced. Your git history might look like:f09c875 - failing commit9344dc8 - ?a84feca - ?1a66df1 - ?05e4293 - ?acbddb6 - ?5fb7fac - ?fba9f93 - ?93cdfa0 - ?c9e0fc2 - ?80...

  • February 09, 2016

    Compass Sass to CSS using Docker

    I have seen many developers on a few teams cringe when they need to make a simple CSS change and are faced with this folder structure:myproject some-folder another-folder sass something.scss css something.cssIn my opini...

  • November 16, 2015

    Gitsubmodulizing and Gitflow

    Gitflow is a development workflow we use where all features are developed on their own branch, and we constantly merge in the mainline (in this example it will be master) to the feature branches, until the feature branches are ready, at which poin...

  • September 11, 2015

    Debugging a hanging PHP script

    I installed a script called test.php on a Vagrant box with CentOS 6.x and PHP 5.3. I made my script available at http://example.local/test.php and it contains:<?phpfunction whatever() { sleep(1);}while (TRUE) { whatever();}When I access this ...

  • July 27, 2015

    Fixing "Docker error : no space left on device" by increasing the size of your CoreOS VM

    You might get this error especially with very large projects. We are assuming that your setup is: Your local “bare metal” computer (can be any OS). CoreOS running on Vagrant and VirtualBox. Containers running via Docker on CoreOS.We are assumin...

  • July 16, 2015

    Date-related tests failing on one environment and passing on another? Make sure your timezone is always the same

    PHPUnit tests, or Drupal simpletests, are sometimes used to make sure your functions calculating date and times work correctly.I recently had a failure on my continuous integration server where a year was one day more than it was supposed to be. O...

  • July 07, 2015

    What does it take to succeed with TDD, and why should you make the effort?

    A few weeks ago, I participated in an online panel on the subject of Test-Driven Development as part of Continuous Discussions (#c9d9), a series of community panels about Agile, Continuous Delivery and DevOps. Watch a recording of the panel:Contin...

  • July 06, 2015

    Catching watchdog errors in your Simpletests

    If you are using a site deployment module, and running simpletests against it in your continuous integration server using drush test-run, you might come across Simpletest output like this in your Jenkins console output:Starting test MyModuleTestCa...

  • June 10, 2015

    Add unit testing to legacy code

    To me, modern code must be tracked by a continuous integration server, and must have automated tests. Anything else is legacy code, even if it was rolled out this morning.In the last year, I have adopted a policy of never modifying any legacy code...

  • February 23, 2015

    Continuous integration with Circle CI and Docker for your Drupal project

    Continuous integration (CI) is the practice of running a series of checks on every push of your code, to make sure it is always in a potentially deployable state; and to make sure you are alerted as soon as possible if it is not.Continuous integra...

  • February 18, 2015

    A quick intro to Docker for a Drupal project

    I recently added Docker support to Realistic Dummy Content, a project I maintain on Drupal.org. It is now possible (with Docker installed, preferably on a CoreOS VM) to run ./scripts/dev.sh directly from the project directory (use the latest dev v...

  • February 17, 2015

    Rebasing in Git (squashing commits)

    Here is a typical usecase: You master branch contains your code in a potentially deployable state You have a feature branch, with a bunch of commits. When your feature branch is ready, you want to merge it to master as a single commit.For examp...

  • February 09, 2015

    Drupal and Docker: Creating a new Docker image based on an existing image

    To get the most of this blog post, please read and understand Getting Started with Docker (Servers for Hackers, 2014/03/20). Also, all the steps outlined here have been done on a Vagrant CoreOS virtual machine (VM).I recently needed a really simpl...

  • February 06, 2015

    Two tips for debugging Simpletest tests

    I have been using Simpletest on Drupal 7 for several years, and, used well, it can greatly enhance the quality of your code. I like to practice test-driven development: writing a failing test first, then run it multiple times, each time tweaking t...

  • January 20, 2015

    Multiple git remotes, the --depth parameter and repo size

    When building a Drupal 7 site, one oft-used technique is to keep the entire Drupal root under git (for Drupal 8 sites, I favor having the Drupal root one level up).Starting a new project can be done by downloading an unversioned copy of D7, and in...

  • December 04, 2014

    Using Gerrit to review a change to your code

    Gerrit is a free open-source code review platform created by Google. In this post we will develop code locally and review it in Gerrit.Step 1: install Gerrit and set up your git repo. Start by installing a Gerrit server at http://gerrit.example.c...

  • December 04, 2014

    Setting up Gerrit with a git repo

    Gerrit is a free open-source code review platform created by Google. In this post we will set up Gerrit with a Git repo.Step 1: install GerritSee this post for instructions on how to install Gerrit on CentOS. We will assume that your Gerrit instan...

  • December 03, 2014

    What is content? What is configuration?

    What is content? What is configuration? At first glance, the question seems simple, almost quaint, the kind one finds oneself patiently answering for the benefit of Drupal novices: content is usually information like nodes and taxonomy terms, whil...

  • December 02, 2014

    Setting up Phabricator to track a git repo

    Phabricator is a free open-source code review and workflow management system. Here is how it can be used to track a git repo.Step 1: install PhabricatorIf you are just evaluating Phabricator you can use these instructions to set up an evaluation v...

  • December 02, 2014

    Setting up Phabricator to review code

    Phabricator is a free open-source code review and workflow management system. Here is how it can be integrated into a code-review workflow.Step 1: install Phabricator and make it track a git repo If you are just evaluating Phabricator you can use...

  • December 02, 2014

    Setting up Gerrit on CentOS for evaluation

    Gerrit is a free open-source code review platform created by Google. Here is how to set up a quick, insecure version of Gerrit for evaluation.You might also be interested in Phabricator (installing, linking with git, and reviewing code), another p...

  • December 02, 2014

    Installing an evaluation version of Phabricator

    Phabricator is a free open-source code review and workflow management system. Here is how to quickly install Phabricator in a manner which should be considered non-secure, so you can determine if it is right for you. You might also be interested i...

  • September 10, 2014

    An approach to code-driven development in Drupal 8

    What is code-driven development and why is it done?Code-driven development is the practice of placing all development in code. How can development not be in code?, you ask.In Drupal, what makes your site unique is often configuration which resides...

  • July 30, 2014

    New Drupal 7 project checklist

    I had this checklist documented internally, but I keep referring back to it so I’ll make it available here in case anyone else needs it. The idea here is to document a minimum (not an ideal) set of modules and tasks which I do for almost all proje...

  • May 23, 2014

    Test your sad path first

    One of the techniques I use to make sure I write tests is to write them before I do anything else, which is known as test-driven development. If you develop your functionality before writing a test, in most cases you will never write the test to g...

  • April 22, 2014

    Simpletest Turbo: how I almost quadrupled the speed of my tests

    My development team is using a site deployment module which, when enabled, deploys our entire website (with translations, views, content types, the default theme, etc.).We defined about 30 tests (and counting) which are linked to Agile user storie...

  • February 26, 2014

    Eight tips to remember on your path to automated testing

    Many Drupal projects now under maintenance suffer from technical debt: a lot of the functionality is in the database and outside of git, and the code lacks automated testing. Furthermore, the functionality is often brittle: a change to one feature...

  • February 11, 2014

    Connecting Jenkins and Git

    For your Jenkins job to connect to Git, you need two things: An ssh key on your jenkins account The Jenkins user needs to have a public private key pair. To do this you need to log into your command line as the jenkins user. Here is how. Use...

  • January 20, 2014

    Do not use incremental IDs in your code

    Drupal uses incremental IDs for such data as taxonomy terms and nodes, but not content types or vocabularies. If, like me, you believe your site’s codebase should work with different environments and different databases, your incremental IDs can b...

  • January 07, 2014

    Do not clone the database

    It is generally agreed that cloning the database downstream (that is, from development toward production) is a bad idea, if only because by doing so all production content is lost; most developers use Features, Context, some variation on a site de...

  • December 13, 2013

    Continuous deployment, Drupal style

    Edit (2016-10-03): This website is no longer Drupal-based.Deployments are often one of the most pain-inducing aspects of the Drupal development cycle. I have talked to Drupal developers in several shops, and have found that best practices are ofte...

  • November 22, 2013

    What is a site deployment module?

    In a Drupal development-staging-production workflow, the best practice is for new features and bug fixes to be developed locally, then moved downstream to the staging environment, and later to production.Just how changes are pushed downstream vari...

  • November 13, 2013

    Case study: installing mock objects for testing Drupal-Nuxeo synchronisation

    I recently inherited a Drupal project which periodically imported content from a Nuxeo server, synchronizing it with Drupal nodes, thus creating, updating and deleting nodes as need be. Nuxeo content was in no case modified by Drupal.The Nuxeo ser...

  • November 13, 2013

    An approach to deploying translations for a multilingual site

    Let’s say you are working locally and you need to add a new module to the site. Here is an example with Login Toboggan:Let’s start by downloading the module to our local dev sitedrush dl logintobogganInstead of enabling it outright, we’ll want to ...

  • November 11, 2013

    Don't perform logic in your hook_form_submit: use an API

    Examples like these are rampant throughout Drupal 7, in block_admin_display_form_submit(), for example:/** * Form submission handler for block_admin_display_form(). * * @see block_admin_display_form() */function block_admin_display_form_submit($fo...

  • October 29, 2013

    Using Drush and SSH to clone a remote database

    Sometime one needs to clone an entire remote website in order to diagnose certain problems. Here’s how I go about it:The following example assumes that: You have a local webserver, in this example MAMP. You have Drush installed both locally and ...