Customizing a Workflow

In the following examples, we use SERVICE-NAME as sampleapis and WORKFLOW-NAME as record. The following should be customized to your service(s) and workflow(s).

Adding Custom Container Services

The following are examples of what custom container services can be used for:

  • When recording requests from a service, a local instance may be needed. This local instance of the service can be added here

  • When testing, a custom container can be used to trigger the tests after all the services have initialized. An entrypoint service is provided for this purpose

To add a custom container service:

  1. Each workflow provides a docker-compose.yml for the purpose of adding custom container services. For example:

$ cat .stoobly/docker/<SERVICE-NAME>/<WORKFLOW-NAME>/docker-compose.yml
networks:
  gateway:
    external: true
    name: ${APP_NETWORK}
  sampleapis:
    name: sampleapis
services: {}
  1. Custom services should be added under the services property. A custom services include under profiles the name of the workflow. For example, if the current workflow is record, then:

$ cat .stoobly/docker/<SERVICE-NAME>/<WORKFLOW-NAME>/docker-compose.yml
networks:
  gateway:
    external: true
    name: ${APP_NETWORK}
  sampleapis:
    name: sampleapis
services: 
  helloWorld:
    image: hello-world
    profiles:
      - record

Adding Custom Lifecycle Hooks

To understand more about lifecycle hooks, see:

  1. Each workflow provides a lifecycle-hooks.py that will be auto-included for that particular service workflow

  2. It can be accessed in the following location:

ls .stoobly/docker/<SERVICE-NAME>/<WORKFLOW-NAME>
bin  docker-compose.yml  lifecycle_hooks.py

Adding Custom Init Scripts

The intended purpose of the init script is to provide an established location to run shell commands before the service's workflow runs. Uses include, but are not limited to:

  1. Building source files

  2. Building fixtures to use for mocking

To customize the init script:

  1. Each workflow provides an init script that will be run in the workflow's init step

  2. It can be accessed in the following location:

ls .stoobly/docker/<SERVICE-NAME>/<WORKFLOW-NAME>/bin
configure init 

Adding Custom Configure Scripts

The intended purpose of the init script is to provide an established location to run Stoobly commands to customize proxy settings.

  1. Each workflow provides a configure script that will be run in the workflow's configure step

  2. It can be accessed in the following location:

ls .stoobly/docker/<SERVICE-NAME>/<WORKFLOW-NAME>/bin
configure init 

Last updated