Delivering your vision
Crawley Borough Council
Helping the development team scale
Crawley Borough Council (CBC) came to us for support with their ongoing digital projects. They are creating an in house development team, and using Drupal as their preferred in house platform to host an array of services for internal stakeholders. C&W are supporting CBC using our experience and expertise in Drupal, collaborative development and industry best practices.
Our latest work with them:
- Helped CBC to utilise the cloud for local development
- Created the tools needed to enforce code standards and best practices
- Introduced Gitflow as a development methodology with code reviews
- Helped them adopt BitBucket as their preferred code repository
- Created a developer’s guide that can be used as a resource for existing developers to onboard new developers.
CBC approached us with several challenges they were facing. They had adopted a methodology where by their local development environment has been in a virtual machine (VM) but that VM was running through Vagrant in the developers’ computers. That resulted in the VM to be very slow and affecting their productivity. Due to their network configuration it was difficult to provide internet access to the VMs and as a consequence code and security updates were difficult to handle. The lack of internet on their local machines also dictated their options for version control. They were using a locally hosted git server with a minimal interface without support for viewing or reviewing changes.
CBC was moving their in house infrastructure to a cloud based environment and felt it was time to change some of their practises to maximise the benefits from their move.
They were looking for a solution that would allow them to:
Automatically spin up development environments which would run much quicker
Enforce coding standards and best practises at a code level
Adopt a code repository where GUI elements for viewing changes are available
- Adopt a development methodology that would minimise code conflicts between developers and would make it easy to separate code between development, staging and production environments.
Having worked with CBC previously we knew that the biggest challenge was going to be their very strict policies around network connectivity and security. CBC is a governmental organisation and there is a very strict framework of what your are and aren’t allowed to provide.
After analysing the requirements we formulated the following plan:
Configure a VM with all required software and capture that as a template to be used for spinning up new environments.
Move all code to BitBucket.
Create a code repository with PHP Codesniffer and configure it for Drupal coding standards and development practises.
Create a developer’s guide that would act as the definitive resource for existing and new developers.
CBC was in the process of moving their infrastructure to the cloud, and they had already been using VM for their local development environments. We integrated the two into a new offering, in which we configured a VM from scratch with all software needed. As this was a Drupal project we had to take account of PHP package manager composer, and Drush, as well as git and the LAMP stack. This resulted in a VM that was ready for Drupal development and had access to the internet, which meant that we would move all code to BitBucket.
We chose BitBucket as our preffered code repository due to its simplicity and its scaling capabilities. CBC’s team is currently a few developers but they are looking to scale up with new team members, and BitBucket provides them with the ability to do so with a reduced cost structure.
PHP Codesniffer (PHP-CS) provides projects with tools to automatically check coding standards. We configured PHP-CS for use with a Drupal project. ThIS requires importing a set of standard definitions and instruct PHP-CS to use that once code is checked. We created all necessary documentation outlining the steps that need to be taken to check the code base. We packaged all up as a separate repository which allows developers to checkout the code to their machine and ready start enforcing coding standards without any additional setup.
Our aim was to provide a complete solution that can onboard new developers while also be a valuable resource for existing developers who can go back to it as and when they need. Topics within the developer’s guide range from setting up SSH keys to automatically deploying code to different environments. The guide has been created collaboratively allowing the CBC developer’s full visibility and encouraging them to review topics and suggest new ones as we went along. We have incorporated some of their major pains in the Appendix with details on how to handle different scenarios such as providing hotfixes in production without disrupting normal operations or how to best use git rebase for synchronising feature branches with main branches.
The Key Benefits
Our approach allowed CBC to utilise their cloud infrastructure in a much better way, and provided them with everything needed to adopt a modern development workflow.
All their code now resides in BitBucket which helps them take full advantage of the Gitflow branching model during development and implement code reviews as part of their quality assurance. It also gives them a great experience in viewing and reviewing changes as part of their development workflow.
CBC adopted a development workflow based on Gitflow to help them fix any bugs discovered in the production environment, and have multiple quality checkpoints to minimise the overall bug count. Using a slightly stricter branching strategy than Gitflow, each new user story is developed in it’s own isolated branch. Once a pull request is issued, the code is reviewed, and then moved into the development branch. Following this the development branch is deployed to the development environment, the master branch in staging, and a tag in production. Adopting this workflow provides CBC with plenty of quality checkpoints minimising the risk of actual bugs finding their way in production.
A separate repository with all tools needed for coding standards and best practises help them stagger their introduction into their workflow. The absence of such tools means that there needs to be a period of combing existing code and fixing errors before stricter rules are enforced. A natural progression after that initial adjustment period is to run those tools automatically every time a developer commits code or as part of the task automation suite.
Finally, a dedicated developer’s guide is a valuable resource outlining a series of important topics. We aimed for a resource that was detailed enough so newcomers could use to set up their development environments, but broad also to cover issues such as working with Gitflow and pull requests, automated deployments to different environments, and how to perform hotfixes in production. The developer’s guide is a resource that ensures a base level of quality in all developer’s and also allows them to experiment with new topics that may not have felt comfortable to do so by themselves.