Designer agent mode


If you wish to leave comments or ask questions, please log on or sign up.
This feature is implemented in 1C:Enterprise version 8.3.10.2168.

As a tool for developing and supporting applications, Designer can be used both interactively (to edit configurations or describe 1C:Enterprise script algorithms) and from the command line (to update, dump and restore configurations, etc.). For instance, the new development environment (EDT) reassigns some of its functions to Designer.

Our initial intent was to speed up EDT-Designer interactions. However, we decided to extend the task at hand. Ultimately, we developed a universal way of working with Designer through the command line. We called it the agent mode. In agent mode, Designer can run an arbitrary number of external commands without shutting down.

Benefits

The main advantage for the EDT is the reduced time it now takes to run operation sequences, such as dumping configurations to files, restoring configurations from files, and updating database configurations. After all, in Designer batch mode previously used by EDT Designer would start, execute one command, and then shut down. So if you needed to run several commands in sequence, the overhead costs of Designer’s startup / shutdown could be quite significant.

Another benefit we didn't plan for originally is that you can now operate Designer via standard SSH clients, meaning you can automate your Designer operations. This is something we would like to go into more detail about.

How it works

To start Designer in the new mode, the command-line option /AgentMode is used, along with a number of other secondary options that define connection settings. At startup, the infobase Designer is supposed to work with is specified.

Once the agent is up and running, you can work with the infobase, alternating between the agent (by executing SSH commands) and Designer running in regular mode. What does ‘alternating’ mean?

To manage Designer via the SSH client, first you need to connect to the infobase. This simple operation looks like this:
designer>common connect-ib
 The operation is completed  

After this, you can run any SSH command.

If you run the SSH disconnect command, you can (without shutting the agent down) start another Designer in regular mode and work with the infobase as usual, e.g. edit modules. After shutting down the regular-mode Designer you can execute SHH commands to connect to the infobase again via the running agent. This is what the short version of the sequence looks like:

  • Start Designer in agent mode (SSH session starts)
  • Connect to infobase (SSH command)
    • ... Other SSH commands
  • Disconnect from infobase (SSH command)
  • Start Designer in regular mode
    • ... Modify the infobase the Designer agent is connected to
  • Shut down Designer operating in regular mode
  • Connect to infobase (SSH command)
    • ... Other SSH commands
  • Disconnect from infobase (SSH command)
  • Shut down Designer operating in agent mode (SSH command, SSH session termination)

SSH commands

You can connect to Designer running in agent mode via standard SSH clients, such as PuTTY, WinSCP, MobaXterm, and others. So far we have implemented only the most necessary commands:

  • Connect to / disconnect from infobases
  • Dump configurations to / restore from files (including partial dumping and restoring)
  • Save/load external reports or data processors
  • Update database configurations
  • A number of utility commands

We will consider expanding the list of commands in the future.

Example

As mentioned in the beginning, the SSH protocol will help you not only leverage the command line in standard SSH clients, but also automate your Designer operations by using programming languages other than 1C:Enterprise script. For instance, you need just a few lines in Python (based on the Paramiko library) to connect to / disconnect from an infobase.
import paramiko
 
host = '192.168.1.1'
user = 'login'
secret = 'password'
port = 1543
 
client = paramiko.SSHClient()
client.set_missing_host_key_policy(paramiko.AutoAddPolicy())
client.connect(hostname=host, username=user, password=secret, port=port)
 
stdin, stdout, stderr = client.exec_command('common connect-ib')
data = stdout.read() + stderr.read() 
  
      ...
 
stdin, stdout, stderr = client.exec_command('common disconnect-ib')
data = stdout.read() + stderr.read()
 
client.close()  

Specific features

Designer in itself defines a number of SSH-interaction restrictions.

First of all, Designer operates in such a way that makes all SSH commands run synchronously. Only one SSH shell client and several SFTP clients can be connected to the infobase at the same time.

Second of all, there is a strict "one agent – one infobase" restriction. Given that authentication requires an infobase user name and password, the agent needs to know right away (i.e. at startup), which base it will be working with.

And third, one of the things we were aiming at when developing this mechanism was to be able to monitor Designer’s command execution progress. However, thorough analysis showed that not all Designer operations have such an option and that implementing it is quite a time-consuming task. For now, this option stays on our wish list.