- Download Leroy for your platform and unzip to the folder of your choice.
- Run: controller.exe from the command line by itself for the first time. This will detect that there’s no controller.xml and will generate a fresh pair of SSH keys and initialize the controller.
- Run: controller.exe –addagent for each agent, in each environment that you’d like to add.
- Edit environments.xml and configure what agents you’d like to have in each environment and their roles. An example environments.xml is bundled with the controller that has examples and is easily editable.
- Build a workflow in xml and store it in your workflow folder as deploy.xml. You can find example workflows here. In your workflow you will define a series of steps that describe how to deploy your application. Please see the Administration Guide for full documentation on the available commands that can be used in a workflow.
- Once your workflow has been created and your environments.xml file has been configured, you can run the deployment with the following commands:
controller.exe --workflow deploy --environment dev
controller.exe --workflow deploy --environment test
controller.exe --workflow deploy --environment stage
controller.exe --workflow deploy --environment prod
With this, we see how trivial it is to integrate the automated deployment of an application inside any build system by simply executing one command.
Executing commands on agents
In order to run a command on an agent, you first have to put the file in the $LEROY_HOME/commands folder the file you place in here will be transferred to the agent and executed. Leroy passes any options you wish into the script’s system ENVIRONMENT variables. There are some rules to follow when using this:
- On windows, powershell file must be named with the .ps1 extension.
- Leroy is OS independent, so you must follow the rules for file names / extension on whatever platform your using.
Once your file is in the commands folder, you may use the <execute> tag in Leroy. See documentation for options on the <execute> tag. If the <execute> tag is used on a command=”” that doesn’t exist in the $LEROY_HOME/commands folder, you will get an early error on it and the deployment will fail.
Transferring files to agents
In order to transfer files, the file must be in the $LEROY_HOME/artifacts folder. Then we can make use of the <transfer> command. Transfer has the ability to transfer any file or archive (zip, tar, tgz, etc) and explode it into folders on agents. Transfer can also simply transfer a file. If you use the <transfer> command with a file specified that doesn’t exist in $LEROY_HOME/artifacts folder, you will get an early error on it and the deployment will fail.