Getting Started

The Sensitivity Calculator is an application for calculating the sensitivity of the SKA Mid-Frequency Aperture Array.

The front end of the application is currently being split into a separate component which will be deployed in Kubernetes alongside the new API. For now, the old API is still available in this repo.

Below are two sets of instructions, one for deploying the old application to Docker and the second for deploying the new API to Kubernetes.

## Deploying the Backend server to Docker

The project uses a Docker container to make the results independent of host environment. Starting and stopping the Calculator is done using make, but first the code must be downloaded from the SKA Git repository.

The necessary steps are:

  1. Install Git if you don’t already have it.

    To find if Git is installed on your computer, type in a terminal: git --version. The output will either say which version of Git is installed, or that git is an unknown command.

    If Git is not there, point your browser to https://git-scm.com/book/en/v2/Getting-Started-Installing-Git and follow the instructions for installation.

  2. Install Docker if you don’t already have it.

    To find if Docker is installed on your computer, type in a terminal: docker -v. The output will either say which version of Docker is installed, or that docker is an unknown command.

    If Docker is not there, point your browser to https://docs.docker.com/get-docker and follow the instructions for installation.

  3. Clone the sensitivity calculator from the SKA Git repository by moving to the destination directory on your machine, and typing: git clone --recurse-submodules https://gitlab.com/ska-telescope/ska-ost-senscalc.git.

  4. Enter the code directory with: cd ska-ost-senscalc.

  5. To refresh the GitLab Submodule, execute below commands:

` git submodule update --recursive --remote git submodule update --init --recursive `

6. Install all dependencies using Poetry: First go to the poetry shell, It opens the poetry virtual environment and then run poetry install command

` poetry shell poetry install `

  1. To update the poetry.lock file, use command:

` > poetry update `

  1. Build a new Docker image for ska-ost-senscalc:

` make oci-build `

  1. Execute the unit tests and lint the project with:

` make python-test && make python-lint `

  1. Format the Python code:

` make python-format `

  1. Type: make up to build and run a Docker container with the Sensitivity Calculator.The process may take several minutes the first time.

  2. To shut down the Sensitivity Calculator and remove its Docker container, type: make down.

## Deploying the API to Kubernetes

The Ingress rule in the Helm chart only allows access to the new API path, so the old UI will not be visible as this requires root path access.

The Docker image can be built with make oci-build. To deploy to Kubernetes, using the Helm chart, run

` make k8s-install-chart `

and uninstall the chart with ` make k8s-uninstall-chart `

Once installed, the Sensitivity Calculator API should be available externally to the Kubernetes cluster. If using minikube, run minikube ip and use the IP to access the API, eg http://192.168.48.1/api/v1/subarrays.

## Further help

Further documentation, including a User Guide can be found in the docs folder. To build the html version of the documentation, start from the ska-ost-senscalc directory and first install the dependency using poetry install --extras "docs" and then type make docs-build html.

Read the documentation by pointing your browser at docs/build/html/index.html.

## Release a new version

  • Run make help release or make long-help release to see available documentation

  • Check if a release exists

` make check-release ERROR: version not yet tagged in git. make [minor,major,patch]-release. make: *** [.make/release.mk:166: check-release] Error 1 ` - Bump minor version for docker and python and follow the output

` make bump-minor-release make python-set-release ` Note: If there are outstanding(uncommitted tracked) changes existing this will fail so commit first

  • commit the changes for the version files

` make git-create-tag make git-push-tag `

This will create a GitLab release with the changelog, follow the Releases page in gitLab UI to see the details. In addition, if you have a CHANGELOG file in the repository it will get updated.

Note: If there is same version tag existing this will fail so first delete the tag

` git tag -d <tag> `

If your push of tag fails that could be because the tag is already present on Gitlab or CAR. To fix this, just update your version to latest version in .release file and push it. It should pass then.

Documentation can be found in the docs folder.

[![Documentation Status](https://readthedocs.org/projects/ska-telescope-ska-ost-senscalc/badge/?version=latest)](https://developer.skao.int/projects/ska-ost-senscalc/en/latest/?badge=latest)