• Beta
Services: How to Setup
  • 18 Nov 2020
  • 2 Minutes To Read
  • Share
  • Dark
    Light

Services: How to Setup

  • Share
  • Dark
    Light

What are Services?

Services allow you to instantly deploy your Cloud-Native Micro-Services & Web Apps into CTO.ai to make them available to anyone on the public internet. Add these directly to your load balancer to host your custom application or deploy complex internal business logic, as well.

Like Comands & Pipelines, Services are Slack-Native so you can easily interact with anyone in your team to augment workflow logic with human input.

How to use

A Service is a type of Op which allow you to run a small web application over htttp.
In the backend it is a long running container that supports both network traffic both in and out of the container.

1. Create a Service

To start using the Service feature, you will want to use the init flow in he CLI. For this, run the following command in your terminal ops init

  • You will be prompted to choose between different types of Ops
  • Select service and press enter
  • Select your SDK
  • You will then be asked to choose a name, a description and a version for your service

terminal-03.png

You can now work on your service by editing the ops.yml file in the repo newly created. To see some example of use cases for services, refer to the below "Example Use Case" section of the documentation.

terminal-04.png

2. Build a Service Op

After the Op has been created you will likely want to run it. In order to do that you need to perform two simple steps. Build the Op & publish it.

In order to build the Op use the command ops build [service-name]
For more information on Building click the link.

3. Publish a Service Op

After the Op has been successfully built you can then Publish it to The Ops Registry with the following command: ops publish [service-name]
For more information on Publishing click the link.

Note

At this time to test your Services they must be published to be Run.

2. Start a Service Op

1. Through the CLI

  • Go back to your terminal
  • run the following command ops start service_name
  • You will get two URLs printed to your terminal:
    • A Public URL where you can access an http server running in your op (if you choose to do so)
      • Note: Custom URLS are coming soon and are currently not available
    • The CTO.ai Status URL for a web view that will display logs for your Op Service

2. Through the Web Dashboard

  • Go to cto.ai
  • Sign-in and go to the Dashboard
  • You should be able to have access to the Services tab which will list all of your current Services and their status
  • Click on the service of you choice and click on the run (Blue and White arrow) button

services list.png

3. Through Slack

  • Link to the Channel associated with the team in Slack
  • Run /ops run service_name
  • To see the URL information and Status see the Web Dashboard
Note: At this time we have no implemented "stopping" a services from Slack. You will have to goto the Web Dashboard to stop a service. 

Example Use Cases

Services are very versatile and can be used for any long-running task. For example:

  • A cron style task that performs a periodic database backup
  • Host a microsite
  • Deploy an micro service an API

🚀 What's Next


Need help getting started?

Contact Support — we're here to help!

Was This Article Helpful?