Skip to content

Deployment

Logan Saether edited this page Jan 25, 2021 · 1 revision

Deployment

Both the Kusama and Polkadot programme are hosted in the same repository and share a deployment pipeline.

Whenever a PR is made the deployment pipeline will run the tests and check if it can build the docker image. These are the minimum amount of checking that the CI does in order to make sure there's no compilation errors. The test pipeline should also run yarn test but currently we rely on running this locally because the mongo testing database dependency has an unresolved issue with being used in the CircleCI environment.

In order to make a release and deploy the new code to production, you must push to master then make a tag that's in ascending order (we use SemVer). For example, if the current release is 2.0.0 and we add additional validators to the configuration, we must make a new commit to master then tag it as 2.0.1 and push the tag.

Configuration

There are two sets of configuration files, one for Polkadot and one for Kusama.

Further, there are two configuration files for each set: the secrets config and the main config.

Each of the respective main configuration are hosted in the public repository in the helmfile.d directory and under the network heading. For example, the Kusama config is hosted in the file helmfile.d/config/kusama/otv-backend.yaml.gotmpl and starting at line 18. The corresponding configuration for Polkadot can be found in the file helmfile.d/config/polkadot/otv-backend.yaml.gotmpl and starting at line 18.

To see all the fields available to be configured see the Config type in the codebase, here.

Main Config

The main configuration is where you can set new validators or turn on and off various features of the backend.

The constraints field alters which requirements we ask of validators in the programme. The available configurations are as follows:

  constraints: {
    skipConnectionTime: boolean;
    skipIdentity: boolean;
    skipStakedDestination: boolean;
  };
  • skipConnectionTime means that if set to true the backend ignores the requirement for being connected for at least 7 days.
  • skipIdentity means that if set to true the backend ignores the requirement for having an identity set.
  • skipStakedDestination means that if set to true the backend ignores the requirement for having the payment destination set to Staked. Generally, this should be set true for Kusama but false for Polkadot since this is a Polkadot-only requirement.

If you want to run the backend in "dry run" mode meaning that it will start all the services but stub out any transactions that it would normally make, then you can turn the global.dryRun paremeter to true.

Perhaps the most used part of the configuration is the scorekeeper parts. In here we have the candidates field which is used to add new validators as "candidates" of the programme. Each of the respective networks have slightly unique JSON objects that are required to be put here.

For Kusama the candidate field requires the following fields (example):

          {
              "name": "Anson&Fabio-sv-public-temp",
              "stash": "CmD9vaMYoiKe7HiFnfkftwvhKbxN9bhyjcDrfFRGbifJEG8",
              "riotHandle": ["@anson:web3.foundation", "@fabio:web3.foundation"]
          },

For Polkadot the candidate fields look like this:

        {
            "name": "specialized-tarmac-1",
            "stash": "126RwaHn4MDekLWfUYfiqcVbiQHapwDSAT9vZZS15HLqfDJh",
            "kusamaStash": "FP6NJ41XMsHb2t7ijRhrtNW9mmNkRp9jMfw5Nwakvz9xNXE",
            "riotHandle": "@joe:matrix.parity.io"
        },

where riotHandle can accept either a string of an array of strings for both configuration.

Secret Config

The secret config is hosted in CircleCI and can only be accessed by users with admin privileges set in this GitHub repository. In the secret config we keep the parameters that are sensitive. Concretely, this is the matrix.accessToken and scorekeeper.nominators. The secret config may be important if you want to add or remove a nominator from the rotation.

In order to change this configuration you would go into CircleCI and access "Project Settings" for the 1k-validators-be repository. From here select "Environment Variables" from the sidebar. Kusama's secret configuration is set as KUSAMA_OTV_BACKEND_SECRET. This must be a string which contains the JSON configuration. Similarly for Polkadot you would set POLKADOT_OTV_BACKEND_SECRET.

The secret fields look like the following:

TODO
Clone this wiki locally