New feature: Custom Services in Build Actions [Beta]

New feature: Custom Services in  Build Actions [Beta]

Building and testing applications are the core features of Buddy, right alongside deployments. In order to test your app properly, however, you often need a database or some other service. Buddy handled that with predefined services like MySQL, PSQL or MongoDB. Until now.

This week, we release custom services, a feature that many of you has requested. It will allow you to run tests for both frontend and backend of your application, or to create a database service with custom configuration. The functionality is currently in Beta phase and is available for all users (see bottom for more info on that).

How to add a custom service

Custom services are added just like any other microservice. Just go to the corresponding tab in the build action and select 'Custom service' from the dropdown:

Image loading...Services tab

When adding the custom service you need to define:

  1. Hostname - the ID that will be used by other services to connect to this one
  2. Docker Image — registry, image, and its version
  3. [Optional] Commands to run and filesystem to mount

Image loading...Custom service configuration

Using your own image as a service

By default, Buddy pulls images from the selected private or public Docker registry, with dedicated support for Docker Hub, Amazon ECR and Google GCR registries.

However, you can also use an image previously built by an action in the pipeline. For example, you can build images for both Frontend and Backend, and then run and test them together using the 'Custom Build' action.

In order to do that, select 'Use Docker image built in previous action', and then choose the image below:

Image loading...Pipeline filesystem

The whole pipeline will look like this, with two actions build both ends of your app, and the custom action running the tests:

Image loading...Pipeline example

Each build action can have up to 6 services added. The first one is the main image of the build action. The remaining 5 can be mounted in the Services tab.

Customizing services with ENV VARs and the filesystem

Whenever a custom service is run, Buddy sends to it the variables that are defined in the build action. This way you can customize the way it works.

For example, you can send MYSQL_ROOT_PASSWORD or MYSQL_ROOT_USER variables to the official MySQL image to configure the image during its start.

Image loading...Variables tab

Other than that, if your service requires access to files from version control, e.g. configuration files, you can mount the pipeline filesystem to it:

Image loading...Build action selection

Caching data from services

The predefined services like MySQL, MongoDB or PSQL can be cached. This means that the database is seeded only once, which significantly speeds up the builds.

In order to cache data in a custom service we need to either use the pipeline filesystem (see above), or define the paths that will be cached for each service

Image loading...Defining a path for a custom service cache

The mounted volumes will remain persistent between executions, i.e. a cache will only be cleared manually from the pipeline settings, or when an execution is run with the 'Clear cache' option enabled.

Docker compose

Custom services enable you to define any configuration achievable through docker compose. In fact, the whole build action and services are run according to docker compose.

If you have any questions how to define docker compose for your pipelines, feel free to reach out to us via the livechat or at support@buddy.works.

More about the Beta phase

Please mind that during the Beta phase custom services will be available for all users. The Beta will last until the end of April 2019. From May onwards, the feature will be restricted to paid plans only.

Jarek Dylewski

Jarek Dylewski

Customer Support

A journalist and an SEO specialist trying to find himself in the unforgiving world of coders. Gamer, a non-fiction literature fan and obsessive carnivore. Jarek uses his talents to convert the programming lingo into a cohesive and approachable narration.

Mar 21st 2019
Share