Deploy OneAgent using AWS Elastic Beanstalk

AWS Elastic Beanstalk is a service provided by Amazon Web Services that gives you the option of deploying and auto-scaling applications and services. You can modify your deployment by supplying additional resources or packages using a predefined .ebextensions directory zipped into your deployment package. For more information, see the AWS documentation.

You can prepare configurations where DESK OneAgent is already part of your application deployment. In such cases you won't have to manually install OneAgent or restart servers to enable service monitoring.

What you need

  • DESK OneAgent download link (Windows or Linux).
  • Access to your AWS Console.

Get the DESK OneAgent download

  • For Windows, go to Deploy DESK > Start installation > Windows and select the Download OneAgent installer button. For more information, see Install OneAgent on Windows.

  • For Linux, go to Deploy DESK > Start installation > Linux and follow the instructions. For more information, see Install OneAgent on Linux.

Create a configuration to install DESK OneAgent

Because the specifics of this type of installation depend heavily on user customizations, we can't provide a simple set of steps that will work in all scenarios. Following is only a brief overview of the entire process, with examples that will help you create your own deployment.

Customizing your installation

When creating the configuration file, you can customize your installation using all the supported DESK OneAgent installation parameters. In the examples below, we used the APP_LOG_CONTENT_ACCESS=1 parameter enabling DESK OneAgent to access log files for the purpose of Log Monitoring. If you want to add more parameters, separate them with a space. Learn more about Windows installation parameters and Linux installation parameters.

It's best to split plugin configuration into two files, one for downloading the DESK OneAgent installer and a second for invoking the installation and post-installation tasks. Note that the Elastic Beanstalk plugin script file names are important—the Amazon interpreter executes these in alphabetical order.

Create the download configuration file and save it with the name 0deskDownload.config. The configuration file needs to contain a files section where you must define:

  • Download path and target file name, for example /tmp/DESK-OneAgent.sh
  • Proper user rights settings
  • The DESK OneAgent download URL you copied to your text editor.

For example:

  files:
    "/tmp/deskinstall.sh":
      mode: "000755"
      owner: root
      group: root
      source: "https://abcdefghij.live.desk.com/installer/agent/unix/latest/abc1234567890"

Create a file called 1deskInstallAndPost.config to execute the DESK OneAgent installer and perform other tasks, such as service restart.
The following script checks for an existing DESK OneAgent setup, executes installation from the /tmp directory if no OneAgent is found, the file is passing the APP_LOG_CONTENT_ACCESS=1 installation parameter enabling Log Monitoring and restarts the httpd service:

  commands:
  install_desk_oneagent:
    command: "[ -d /opt/desk/oneagent ] || /tmp/DESK-OneAgent.sh APP_LOG_CONTENT_ACCESS=1"
    cwd: /tmp
    restart_httpd:
      command: service httpd restart

Copy the 0deskDownload.config and 1deskInstallAndPost.config files to the .ebextensions directory and place it in the Beanstalk deployment package.

Extend your configuration

For convenience, you can also include steps to download DESK OneAgent in your configuration.

This Linux script example includes the DESK OneAgent download in the configuration. While this is necessary for the first installation of DESK OneAgent, this may substantially extend future application updates, because you download DESK OneAgent each time.

You can improve your Beanstalk configuration by adding a check for an existing DESK OneAgent installation and have your scripts download DESK OneAgent only when it isn't found on the system.

Look at the following Linux configurations example carefully before creating your own scripts. Take care in formatting and escaping special characters. The Amazon interpreter is sensitive to syntax errors.

files:
  "/tmp/deskElasticBeanstalk.sh":
    mode: "000755"
    owner: root
    group: root
    content: |
      #!/bin/bash
      if [ ! -d /opt/desk/oneagent ]; then
        wget -O /tmp/DESK-OneAgent.sh "https://yyyyyyyy.live.desk.com/api/v1/deployment/installer/agent/unix/default/latest?Api-Token=xxxxxxxxxxGw&arch=x86"
        chmod 755 /tmp/DESK-OneAgent.sh
        sudo chown root:root /tmp/DESK-OneAgent.sh
        sudo /tmp/DESK-OneAgent.sh

commands:
  install_desk:
    command: /tmp/deskinstall.sh APP_LOG_CONTENT_ACCESS=1
    restart_nginx:
    command: service nginx restart
    ignoreErrors: true