Configuring Services

Configuring Services

ℹ️
Services Overview
For a high-level overview of our Commands workflows and their use cases, be sure to have a look at our Services Overview in the Getting Started section of our docs.

Using CTO.ai Services lets you deploy long-running applications directly to our platform. Acting as a zero-configuration deployment target for your Commands or Pipelines, Services are deployed as lightweight containers (with ephemeral, non-persistent storage) for serving an application or API to the public internet over HTTP—at a unique subdomain URL created just for your service.

We currently offer Workflow SDKs with support for Python, Node, Go, and Bash runtimes. Our SDKs provide a straightforward way to send Lifecycle Event data to your CTO.ai Dashboard, interact with other workflows, and integrate with external systems.

Structure of Services Workflows

The CTO.ai ops CLI provides a subcommand to create scaffolding files for your workflow: ops init. You can use the -k flag to specify the kind as a service workflow, as well as pass an optional argument to give the workflow a name (example-service, in this case):

After you respond to the CLI’s interactive prompting, it will generate template code for your new Services workflow. There are three main components within the newly-created directory defining your workflow:

  • ops.yml
  • Dockerfile (and a corresponding .dockerignore file)
  • Your custom code

For a deeper explanation of the ops init subcommand and the scaffolding generated by our CLI, our Workflows Overview document has you covered.

Important Usage Considerations

If you plan to deploy your containerized application as a CTO.ai Service, there are a few things to keep in mind about the environment in which your application will run.

Storage and Databases

Containers deployed as CTO.ai Services do not have persistent storage. Any data written to the container’s writeable filesystem will be lost when the container is stopped. If your application requires persistent storage or databases, we recommend you configure your application to point to external storage or database systems.

⚠️
Storage is Not Persistent

Containers deployed as Services on the CTO.ai platform do not have persistent storage.

Any data written to the container’s writeable filesystem will be lost when the container is stopped.

To give your application access to your database provider, you can specify credentials for your database as Configs or Secrets in your ops.yml file, for example:

We recommend passing your database URL to your Service workflow as a Config value and your database credentials as Secrets values, to help keep them private.

Subdomains

By default, deployed Services will be assigned a unique subdomain based on the UUID of the deployment. The application deployed by the Service will be accessible at that unique URL, via the port specified in the ops.yml configuration file for the service. However, it is also possible to configure a custom domain for your Service.

Services Workflow Reference

To help you better understand how Services workflows are structured, we have included an explanation of the scaffolding template generated for each of our SDK languages below. Let’s have a look at what is generated when we create a new Services workflow with our CLI.

Create a Services Workflow (ops init)

The CTO.ai ops CLI provides a subcommand to create scaffolding files for your workflow: ops init. You can use the -k flag to specify the kind as a service workflow, as well as pass an optional argument to give the workflow a name (example-service, in this case):

After you respond to the CLI’s interactive prompting, it will generate template code for your new Services workflow.

Workflow Scaffolding Code