.. _user/upgrade-1-0: ************************* Upgrading from 0.x to 1.0 ************************* This section descibes the upgrading of a `Cybus Connectware` installation from a previous 0.x version to 1.0.0. For an overview of concept changes, see :ref:`user/changes-in-1-0` Upgrading the Connectware installation ====================================== To upgrade the installed version from 0.x to 1.0, just download and run the ``connectware-online-installer.sh`` script as usual. If a 0.x installation is detected, the Connectware containers of the previous installation will be stopped and the container instances removed, but the container images will remain installed. It is not possible to run both versions in parallel on the same computer, just as it is not possible to run more than one instance of the Connectware in parallel on one computer anyway. It is possible to have both versions installed and start either of both versions alternating, as long as one version is stopped completely (using *docker-compose down*) before starting the other version. Make sure to reload your browser window (e.g. by Ctrl+F5) when switching between both versions, as sometimes the browser keeps the wrong version of the admin UI in its cache. Currently, no automatic migration of user data, device configuration, or service configuration is implemented. Please contact Cybus support if you need help in migrating your data. Migrating commissioning files ============================= In the following, the necessary migration work for service and device commissioning files will be described. In 1.0, the resources of one commissioning file can reference other resources not only from the same commissioning file and service, but also across different services using the :ref:`service id `. Hence, the complete system context can be described by one or or by multiple commissioning files, whatever fits best for the application. In particular, it is up to you whether the old device and service commissioning files are migrated into one or into two files. Both is possible. Service commissioning files --------------------------- To migrate the old service commissioning files into new service commissioning files with resources, the following steps must be performed with the respective sections in the old file: * Old ``general`` properties must be rewritten in the new top-level properties or metadata properties, see :ref:`user/services/structure`. * Old ``containers`` sections must be rewritten into :ref:`user/services/structure/resources/container` resources * Old ``frontends`` sections must be rewritten into :ref:`user/services/structure/resources/ingress-route` resources * For more information, feel free to contact Cybus Support. Device commissioning files -------------------------- To migrate the old device commissioning files into new service commissioning files with resources, the following steps must be performed with the respective sections in the old file: * Old ``source`` sections must be rewritten into :ref:`user/services/structure/resources/connection` resources * Old ``target`` sections are not needed as separate entries anymore. For the definition of the target topic prefix, either the default from the :ref:`Cybus::MqttRoot ` global parameter is used, or the endpoint's :ref:`topic ` property needs to be defined. * Old ``mappings`` sections must be rewritten into :ref:`user/services/structure/resources/mapping` resources * Default settings that were used in multiple mappings (now: multiple endpoints) now need to be defined using :ref:`user/services/structure/definitions` and used by ``!merge`` in the :ref:`properties `. * For more information, feel free to contact Cybus Support. Specific Topics =============== Template Syntax --------------- Old In 0.x Connectware, the installation specific parameters were made configurable using the ``{{...}}`` *template syntax*. When installing commissioning files with these templates, the user was being asked to give values for these templates. New In 1.0 Connectware, the installation specific parameters are noted as :ref:`parameters `. They are defined in the *parameters* section of the :ref:`commissioning file `, then used by the ``!sub`` function for value substitution. Example: ``!sub 'My Workbench ${ID}'`` MQTT Topic Space ---------------- Old There were no special constraints on the MQTT topics to which device could write its messages, in particular no constraints on the *topicPrefix* of the *target* interface. New In 1.0 Connectware, every service hat its own namespace in MQTT as given by its :ref:`user/services/service-id`. Other services cannot read data from each other's namespace directly. A service has its own scope. If this is intended to be changed, the global parameter :ref:`CYBUS_MQTT_ROOT ` can be redefined to some global pattern. And also in a :ref:`user/services/structure/resources/mapping` resource, you are allowed to write to anything, but not in the endpoint. Frontend Routes --------------- Old For making specific ports of service containers accessible to the outside, in 0.x Connectware one would specify these proxy rules in the *frontends* section of the service commissioning file. The URLs were created in a scheme that contains the string *services*, then the provider name and service-identifier, followed by the *slug*. New In 1.0 Connectware, making ports accessible to the outside is achieved by specifying a :ref:`Cybus::\IngressRoute resource `. The URL still contains the string *services*, but then the *serviceId* followed by the specified *slug*. Watch out: No trailing slash is appended automatically now. This has to be specified explicitly if wanted. Docker options -------------- Old If the docker containers in a service need to be started with special options, such as device capabilities or xxxx mode, one would use the section *alice* with some extra parameters. New In 1.0 Connectware, all extra docker options are available as parameters below the :ref:`user/services/structure/resources/container` resource, in particular the :ref:`user/services/structure/resources/container/devices`, :ref:`user/services/structure/resources/container/ports`, and :ref:`user/services/structure/resources/container/capAdd` parameters. Environment Variables --------------------- Old For passing environment variables to containers, a property section *env* was added to the containers section in the commissioning file. The actual env variables were written in a syntax with equal sign, like so: ``MQTT_HOST=foo.bar``. New Defining environment variables for a container is done by adding the :ref:`user/services/structure/resources/container/environment` parameter below the :ref:`Cybus::Container resource `. The actual variables are now written in a syntax of yaml object assignment, as follows: ``MQTT_HOST: foo.bar``. It is also common to use a :ref:`parameter ` in this place by reference ``!ref`` or substitution ``!sub``, like so: ``MQTT_HOST: $ref Cybus::MqttHost`` or ``MQTT_HOST: '!sub ${myParameter}'`` Examples ======== More examples are also :ref:`shown here `. Grafana dashboard Example ------------------------- This example shows the comparison between the old file to the new file. More examples are also :ref:`shown here `. This service runs a Grafana visualization for data, an InfluxDB as data source of the container, and a connector container for data input. The comparison shows how the syntax for specifying containers needs to be changed when upgrading. Old file in 0.x ~~~~~~~~~~~~~~~ .. literalinclude:: ../resources/examples/cybus-generic-grafana-v0_38.yml :language: yaml New file in 1.0 ~~~~~~~~~~~~~~~ See also the full example here: :ref:`services/examples/modbus2/grafana` Download: :download:`services/examples/modbus2/utilization-grafana.yml` .. note:: |registry_images_license_note| .. literalinclude:: services/examples/modbus2/utilization-grafana.yml :language: yaml :linenos: