Since its inception, Zato has always offered hot-deployment, which means that it is possible to update code of one's SOA/API services without restarting servers - simply upload a new version of a given Python module and it is automatically distributed to all servers forming a cluster.

The next major version will extend it to user configuration as well - so you will be able to edit any .ini config file on any server and all changes will be propagated to other servers each time that file is saved, just like with services today.

In Zato 2.0 a little piece of code such as the one below can be used to achieve the same effect.

Essentially - after updating a config file, for instance user.conf you need to invoke the 'util.config.reload' service, can be either directly from web-admin, command line or over HTTP, AMQP, ZeroMQ or any other channel.

This will publish an internal message to all servers prompting them to re-read all user-provided configuration files.

In this manner, there is even less need to restart servers - after all, why restart the whole server if only a file or two changed?

# -*- coding: utf-8 -*-

from __future__ import absolute_import, division, print_function, unicode_literals

# Zato
from zato.common.broker_message import SERVICE
from zato.common.util import get_config, new_cid
from zato.server.service import Service

class _Reload(Service):
    name = 'util.config._reload'

    def handle(self):

        server_conf = get_config(self.server.repo_location, 'server.conf')

        self.server.user_config.clear()
        self.server.user_config.update(server_conf.user_config_items)

        self.logger.info('User config reloaded')

class Reload(Service):
    name = 'util.config.reload'

    def handle(self):
        msg = {}
        msg['action'] = SERVICE.PUBLISH.value
        msg['service'] = _Reload.name
        msg['payload'] = ''
        msg['cid'] = new_cid()

        self.broker_client.publish(msg)