Stack

Configure a private service catalog

Go to the Cycloid dashboards' organization management view:

Manage Organizations

A private service catalog is basically in a private git repository. So to access this repository we will first add new git credentials to access it into Cycloid credentials manager.

Click on the Credentials Key logo on your organization.

A popup should display your credentials, add a new one with type git.

Add Git Credential

Then click on the private service catalog logo Private Catalog to create a new one using the previously added git credential.

Private service catalog for your stacks

A stack is composed by a stack part and a config part, see Concept of a stack.

A private stack is defined by at least one .cycloid.yml) file and one Pipeline. Those files have to be put in a git repository which can be private or public.

note

If you add or remove a stack in the git repository of your service catalog., or if you do any changes in a .cycloid.yml file, a refresh of the service catalog is required. To do so :

  1. Go on your service catalog list
  2. Click on your private service catalog.
  3. Then hit the Refresh this repository button.

Read more about .cycloid.yml file here.

To store the config of all your private stack, we usually use the same git repository with a dedicated branch named config. But you can provide a dedicated git repository for each config.

In a git repository you can create one or several stacks : One at the root level. Or several stacks in subdirectories (maxdepth 1).

As explained above, for a private stacks we usually create a git repository containing those 2 following branches : config and stacks

git clone -b stack git@github.com:<repository name>.git stacks
git clone -b config git@github.com:<repository name>.git config
1
2

In the stacks you should find at the top level the names of stacks. For example stack-infrastructure, stack-myApp, ...

In those stacks, you might have 3 directories and a file:

  • Terraform: Contains terraform module definition (Terraform Modules), required variables and output of the stack.
  • Ansible: Default variables, roles and ansible playbook to use.
  • Pipeline: Template of the pipeline used only once at the project creation step. Concourse Triggers Docs
  • .cycloid.yml: A file containing the description and the configuration of the stack in the catalog Format of .cycloid.yml file.

Here is an example :

stack-myApp/.cycloid.yml
stack-myApp/pipeline/pipeline.yml
stack-myApp/pipeline/variables.sample.yml
stack-myApp/terraform/provider.tf
stack-myApp/ansible/site.yml
1
2
3
4
5

In the config you might find at top level name of stacks. For example infrastructure, myProject, ...

  • Terraform: The call of the module defined in the stack. The call contains all configuration variable of the module. You can imagine stack like a function definition and config like a call of that function specifying args.
  • Ansible: Contains usually variable file used by the playbook defined in the stack.

Here is an example :

myProject/terraform/prod/variables.tf
myProject/ansible/prod-variables.yml
1
2

As described in Concept of a stack, during a deployment, the stack and the config are merged. That means you can put whatever you want in the stack or in the config, keeping in mind that the file in config will override the one located in stack. There is no limit, in some specific cases you can even override an entire stack with config if you respect the same files path.

Stack Config

So, all things required in the config are usually defined by the stack. You can create a stack which does not require any config, or you can create a stack which requires a lot of variables, template, files etc. from the config.

Private service catalog on Aws

We usually create a CodeCommit repository with a branch stacks containing one or more private stack definition, and a config branch containing all stacks configuration for each environments.

To access to a CodeCommit repository you need to have an Amazon user on which you add a policy to access to CodeCommit and provide a public ssh key. See AWS Access Control Docs

To get the login for your user to clone a CodeCommit repository go to the Amazon console: AWS Console Users

Click on your user and go in the security credentials section, you should find the id under the CodeCommit section.

The first step is to get locally the git repository of the stack and the config with the CodeCommit user id.

git clone -b stack ssh://<userID>@git-codecommit.eu-central-1.amazonaws.com/v1/repos/<name_of_my_service_catalog> stacks
git clone -b config ssh://<userID>@git-codecommit.eu-central-1.amazonaws.com/v1/repos/<name_of_my_service_catalog> config
1
2