# Architecture and Deployment

## Components

**Kyso** is a Web Application organized as a set of services and applications packaged in containers prepared to be deployed and work together using a `kubernetes` cluster (the components could be deployed using other orchestration systems if required, but our current deployment system is focused on `k8s`).

<figure><img src="https://4003540104-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LjzfPqQ1fXmC4OMXwiD%2Fuploads%2FwewhwSXuR5ElWVUXXUuC%2FC4_Container_Diagram-Kyso.svg?alt=media&#x26;token=690abc78-a3a1-4f03-8350-2f97bb45768b" alt=""><figcaption><p>Kyso Architecture</p></figcaption></figure>

The two main components of the system are:

* `kyso-api`, `NodeJS` server that implements the backend functionality using internal and external services and provides a REST API to access it.
* `kyso-front`, the system's web user interface, developed using the `NextJS` framework, does its work calling the relevant API methods on behalf of the user.

Other support services used are:

* `kyso-scs`, module used to manage the reports storage and publication; it includes four sub-components that work together:
  * an internal ssh server to manage report files (it is accessed only by the API, users don't have direct access to it).
  * a web server that provides access to the files with access control (the access validation is managed by calling the API).
  * a Java application used to index the content of the reports and add the relevant information to the search engine database.
  * a Web server that allows us to run scripts with direct access to the filesystem for maintenance tasks and information retrieval.
* `elasticsearch`, search engine used to search and index comments, discussions and  reports uploaded to the platform.
* `mongodb`, a database used to keep all the data related to the platform that is not inside the reports (i.e. configuration and user data, discussions and comments, etc.)
* `nats`, a message oriented *middleware* used by the API to emit messages related to different events that can be consumed by specialised micro-services
* `onlyoffice-ds`, online editor for text documents, spreadsheets, presentations, forms and PDF reader used to display office formats from the frontend

Additionally the platform supports the deployment of *optional* message consumers (`nats` clients) that perform specialised tasks (send notifications using email or slack, display an activity feed, etc.)

## Deployment system

Right now the recommended way of deploying Kyso is to use `kitt` (*Kyso Internal Tool of Tools*), a command line tool that includes support to configure and deploy third party components (i.e. `mongodb`, `elasticsearch`, …​) and our own services (`kyso-api`, `kyso-front`, `kyso-scs`, …​) on kubernetes clusters using `helm` and `kubectl`.

The tool is also capable of installing a cluster for testing purposes on a single Linux server (using `k3d`) and install and configure additional services on it or an existing kubernetes cluster.
