Getting started

Set up your development environment

Two approaches to setting up a development environment are documented below. One is the “default” option currently documented in the SKA software developer portal. The other is our “recommended” approach.

  • (The Default approach) In this approach, you will create an Ubuntu 18.04 virtual machine using VirtualBox (though you could do the same on a physical machine), then use an Ansible playbook to install Tango.

    • In this approach, your system has everything you need to run and test your code.

    • However we have found it to be quite brittle. You wouldn’t want to fiddle with the settings, lest things go wrong. And when they do go wrong, they can be very hard to debug.

  • (The Recommended approach) Develop against the SKA Docker images. In this approach, you will install Docker, and use the SKA Docker image for testing code.

    • In this approach, your system does not have Tango installed, so you cannot run and test your code locally.

    • Because you don’t be running your code locally, you have flexibility in how you set your local system up. The only real requirement is Docker.

    • You will be testing your code in a Docker container running the standard SKA docker image, so you don’t need to worry that your code might not port to other SKA environments.

    • The Docker image will be kept up to date; you don’t need to worry about updating it yourself.

    The approach documented below uses an Ubuntu 20.04 image, with Visual Studio Code (VScode) as an IDE. VScode integrates very well with Docker.

The SKA software developer portal way

  1. Follow the instructions on the Tango Development Environment set up page.

  2. Set up your itango docker container to mount your host working directory. This will allow you to launch locally hosted code within the itango container. To do this, edit /usr/src/ska-docker/docker-compose/itango.yml and add the following lines under the itango service definition:

      - ${HOME}:/hosthome:rw
  3. Clone our GitLab repo.

  4. Verify your setup:

    $ cd /usr/src/ska-docker/docker-compose
    $ make start itango #not needed if it already shows in "make status"
    $ docker exec -it -e PYTHONPATH=/hosthome/ska-logging:/hosthome/lmc-base-classes/src \
      itango python3 \
      /hosthome/ska-low-mccs/src/ska/mccs/ -?
    usage :  MccsMaster instance_name [-v[trace level]] [-nodb [-dlist <device name list>]]
    Instance name defined in database for server MccsMaster :
    $ docker exec -it -e PYTHONPATH=/hosthome/ska-logging:/hosthome/lmc-base-classes/src \
      itango tango_admin --add-server MccsMaster/01 MccsMaster lfaa/master/01
    $ docker exec -it -e PYTHONPATH=/hosthome/ska-logging:/hosthome/lmc-base-classes/src \
      itango python3 \
      /hosthome/ska-low-mccs/src/ska/mccs/ 01
    1|2020-03-13T05:27:15.844Z|INFO|MainThread|write_loggingLevel||tango-device:lfaa/master/01|Logging level set to LoggingLevel.INFO on Python and Tango loggers
    1|2020-03-13T05:27:15.845Z|INFO|MainThread|update_logging_handlers||tango-device:lfaa/master/01|Logging targets set to []
    1|2020-03-13T05:27:15.846Z|INFO|MainThread|init_device||tango-device:lfaa/master/01|No Groups loaded for device: lfaa/master/01
    1|2020-03-13T05:27:15.846Z|INFO|MainThread|init_device||tango-device:lfaa/master/01|Completed SKABaseDevice.init_device
    Ready to accept request