Activating Services

This tutorial demonstrates how to activate Tailor Platform services in the application.

Tutorials - Activate Service

Prerequisite

If you haven't built your first app, please complete the Quickstart. This tutorial assumes that you have already deployed the app.

Tutorial steps

  1. Uncomment a service entry in the app.cue file
  2. Add entry in workspace.cue
  3. Apply the change using tailorctl

1. Uncomment a service entry in the app.cue file

By default, all service entries except for Tailor DB are commented out. To activate a service, uncomment its entry. Each entry includes the name of the service.

For example, to activate the Pipeline service in the application, uncomment the following directory entry in app.cue:

<span><span style="color: var(--shiki-color-text)">application.#Spec </span><span style="color: var(--shiki-token-keyword)">&amp;</span><span style="color: var(--shiki-color-text)"> {</span></span>
<span><span style="color: var(--shiki-color-text)">  ...</span></span>
<span><span style="color: var(--shiki-color-text)">  subgraphs: [</span></span>
<span><span style="color: var(--shiki-color-text)">    ...</span></span>
<span><span style="color: var(--shiki-color-text)">    {type: common.#Pipeline</span><span style="color: var(--shiki-token-punctuation)">,</span><span style="color: var(--shiki-color-text)"> name:  pipeline.namespace}</span><span style="color: var(--shiki-token-punctuation)">,</span></span>
<span><span style="color: var(--shiki-color-text)">  ]</span></span>
<span><span style="color: var(--shiki-color-text)">}</span></span>
<span></span>

2. Add entry in workspace.cue

Add pipeline to the services array in workspace.cue

<span><span style="color: var(--shiki-token-keyword)">package</span><span style="color: var(--shiki-color-text)"> v2</span></span>
<span></span>
<span><span style="color: var(--shiki-token-keyword)">import</span><span style="color: var(--shiki-color-text)"> (</span></span>
<span><span style="color: var(--shiki-color-text)">  ...</span></span>
<span><span style="color: var(--shiki-color-text)">	</span><span style="color: var(--shiki-color-text)">&quot;</span><span style="color: var(--shiki-token-string-expression)">tailor.build/template/services/pipeline</span><span style="color: var(--shiki-color-text)">&quot;</span></span>
<span><span style="color: var(--shiki-color-text)">)</span></span>
<span></span>
<span><span style="color: var(--shiki-color-text)">v2.#Workspace </span><span style="color: var(--shiki-token-keyword)">&amp;</span><span style="color: var(--shiki-color-text)"> {</span></span>
<span><span style="color: var(--shiki-color-text)">	Apps: [</span></span>
<span><span style="color: var(--shiki-color-text)">		application</span></span>
<span><span style="color: var(--shiki-color-text)">	]</span></span>
<span><span style="color: var(--shiki-color-text)">	Services: [tailordb</span><span style="color: var(--shiki-token-punctuation)">,</span><span style="color: var(--shiki-color-text)"> pipeline</span><span style="color: var(--shiki-token-punctuation)">,</span><span style="color: var(--shiki-color-text)"> auth]</span></span>
<span><span style="color: var(--shiki-color-text)">}</span></span>
<span></span>

3. Apply the change using tailorctl

To apply the changes, run the following commands:

<span><span style="color: var(--shiki-token-function)">tailorctl</span><span style="color: var(--shiki-color-text)"> </span><span style="color: var(--shiki-token-string)">workspace</span><span style="color: var(--shiki-color-text)"> </span><span style="color: var(--shiki-token-string)">apply</span><span style="color: var(--shiki-color-text)"> </span><span style="color: var(--shiki-token-string)">-m</span><span style="color: var(--shiki-color-text)"> </span><span style="color: var(--shiki-token-string)">./workspace.cue</span></span>
<span></span>

Then, Pipeline service is activated in the application.

Further Information