March 21, 2019
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:
When adding the custom service you need to define:
- Hostname - the ID that will be used by other services to connect to this one
- Docker Image — registry, image, and its version
- [Optional] Commands to run and filesystem to mount
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:
The whole pipeline will look like this, with two actions build both ends of your app, and the custom action running the tests:
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_USER variables to the official MySQL image to
configure the image during its start.
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:
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
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.
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 firstname.lastname@example.org.
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.
Customer Success Manager