BlueDev Bedrock — A Tool for Easily Building a Microservice Architecture

Ksenia Lvova
Blue Harvest Tech Blog
5 min readAug 18, 2021

Starting a new project can be a daunting affair, having to rewrite the same boilerplate code over and over again. Many patterns which we covered previously here help us solve these problems. However, as already mentioned in that article, creating a scaffolding utility used to automate project creation from the specified template and data is not without its issues. There are already quite a few patterns that try to solve this problem, but none of them is perfect.

BlueDev is a bedrock pattern implementation made by developers for developers. Bedrock pattern is used to share code and configuration between applications.

Idea

Recently, Blue Harvest’s developers have started to create initial versions of bedrock patterns. We were inspired by the article Bedrock pattern: a better way of sharing code?

We realized that there’s no way to develop one generator for different languages (Java, Node.js, Python, etc). The only technology-agnostic approach can provide this option. For example, a bash script can be utilized as a tool to gather the data from a user’s input and customize the range of packages in the target configuration.

Our bedrock provides a minimum setup configuration for the project but doesn’t dictate the way how to use it. For example, some people prefer to install dependencies locally, others — keep all services in docker files. Each bedrock is a git project that implements a feature that can be extended to any project. General BlueDev bedrock does not contain any business logic in the project. It installs dependencies and default configuration for basic architecture that can be changed from user input. Here is the list of published bedrocks in Blue Harvest.

The technical implementation of any bedrock is written in HOW_TO_USE_BEDROCKS.md in each repo with the bedrock.

The usage of at least 2 bedrocks looks like references to remote repositories of bedrocks.

When Git setup is ready then a user has to run a bash script to provide an output to build a custom configuration of the project. For example, the required steps to create a bedrock based on Java looks as follows:

1. Run customize.sh2. Fills in application.properties file and changes necessary settings(maven artifact name, project name, Kubernetes manifests etc)

However, BlueDev generators will not create a structure and patterns in our code (routes, controllers, components, helpers, etc). These patterns change and improve over time so when it’s not always easy to locate the files in your codebase that represent the current “best practice”.

The implementation of each bedrock helps speed up development times on particular needs.

  • Reusable: Designed to last and improve over time. Each Bedrock is easily adaptable to the needs of each project or programming language.
  • Open Framework: BlueDev is for everyone, so no matter what technology, framework, or preferred language, it is always possible to implement a Bedrock to support the development community.
  • Production-ready: BlueDev is designed as a process of continuous improvement, and at the same time, implementing best development practices and clean code practices.
  • Business Driver: BlueDev is built around real needs, so today’s developers can be successful in what they do best.

Creating a bedrock

It essentially implies providing project templates as Git repositories that new projects can pull from.

Naming convention

Also, we can create new bedrock projects by forking from base, like:

bedrock-spring-k8s extends bedrock-spring bedrock with Kubernetes. Or,`bedrock-spring-k8s-{team-name} extends main bedrock `bedrock-spring-k8s` with a new feature created by a team.

This way of building bedrock is good to fill in your custom project with certain technologies.

Pulling updates from this project is mainly the responsibility of the maintainers of the child projects. However, in case of urgent updates or fixes, or just as a general courtesy, please notify the responsible to pull the latest changes from this project.

Introducing the Bedrock Pattern

The bedrock pattern was conceived by engineers at Kayo Sports (AUS). It’s based on the Linux kernel module development process and leverages Git to create flexible project templates. Bedrock terms are used in geology and describe a bottom rocky layer supporting higher layers of soil

Bluedev Bedrocks

Bedrock usage

  1. Create an empty repo and clone it
  2. Add all the desired bedrocks as remotes in git
  3. Fetch, merge and commit changes from each remote
  4. Follow combined Readme and run the customize.sh script
  5. Execute any additional steps that might be required by the bedrocks
  6. Replace Readme content with your own
  7. Push updates to the project’s remote
  8. Start adding your own business logic
Video: How to use the bedrock

Application maintenance

Since we are using git, it’s easy to receive updates from the bedrocks to our project, for example when we want to upgrade to a new framework version. Once that update is available to the online repository, you just repeat step 4 from above to receive the latest changes. We would love to see your contribution to Bluedev.

Announcement: We are hiring! If you are interested in similar technologies and would like to work with us, check our careers page. We are looking for enthusiastic candidates, especially for Belgium. So, send us your CV!

Useful links

Bedrock Pattern: A better way of sharing code?

--

--