Scaffolding a Service

Background

An app will likely depend on one or more services. Scaffolding a service will by default create the following workflows: record, mock, and test. It additionally will enable creating custom workflows for individual services. To learn more:

Service

Steps to Scaffold a Service

  1. Run the scaffold service create command in the root of your app directory:

stoobly-agent scaffold service create \
    --hostname <SERVICE-HOSTNAME> \
    --scheme <SERVICE-SCHEME> \
    --port <SERVICE-PORT> \
    --workflow mock \
    --workflow record \
    --workflow test \
    <SERVICE-NAME>

For example:

stoobly-agent scaffold service create \
    --hostname api.sampleapis.com \
    --scheme https \
    --port 443 \
    --workflow mock \
    --workflow record \
    --workflow test \
    sampleapis

After running the command, the following files and folder will be created:

$ ls -a .stoobly/docker/sampleapis
.config.yml .docker-compose.base.yml mock record test

Run the scaffold service list command to list all services. You should see your new service called "samplesapis" as well as others used by Scaffold:

$ stoobly-agent scaffold service list

name                      detached    hostname                     port    priority  proxy_mode                                scheme
build                     False                                     443           0
entrypoint                False                                     443          10
gateway                   False                                     443           1
sampleapis                False       api.sampleapis.com            443           5  reverse:https://api.sampleapis.com        https
stoobly-ui                False                                     443           1

  1. (Optional) For custom container services, define them using the scaffold Docker Compose yaml file. See the following guide:

Customizing Container Services

Next Steps

Now that your service is created, you can now run workflows!

How to Run a Workflow

Or to further customize a workflow, see:

Customizing a Workflow

Last updated

Was this helpful?