Deploying or Updating Thriftly APIs Across Multiple Machines

The Thriftly Configurator includes a PowerShell script generator you can use to deploy your Thriftly-enabled app and APIs, or update your Thriftly Deployment configuration, across multiple machines and sites simultaneously.

To do so, you first create a PowerShell script that specifies the applications, endpoints, and settings you want to migrate from your initial Thriftly Deployment machine. Then, you run that script on your other machines using Windows’s PowerShell framework. PowerShell then automatically updates your new machine’s instance of Thriftly Deployment to deploy your APIs and use the settings you specified in your script.

As you create your script, you can choose to apply Thriftly Configurator settings at the application pool, application, or endpoint level. This granularity allows you to roll out your entire application pool on a new machine at once or simply update one setting within one specific endpoint, depending on your needs. Below, we’ll walk you through creating and running a Thriftly PowerShell script, so you can easily deploy or update your APIs across multiple machines.

Creating Your Script

  1. If you haven’t already, launch the Thriftly Configurator (Windows Start menu > Thriftly Deployment Server > Thriftly Admin).

  2. If you are creating a script for a new machine that does not already have Thriftly Deployment installed and licensed, you’ll want to include your Thriftly Deployment registration code in your script, so you can automatically license your new machine. To ensure you have your registration code on hand when you create your script, you should:

    1. From the Thriftly Configurator toolbar, select the Options button.

    2. Go to the About tab.

    3. Select the Configurator_Clipboard_Button button located next to the Registration Code field to copy your registration code to your clipboard.

  3. From the Thriftly Configurator sidebar, select the application pool, application, or endpoint that you want to deploy or update using your PowerShell script. Then, from the Thriftly Configurator toolbar, select the PowerShell button. The PowerShell Script Generation window appears.

The PowerShell Script Generation window
  1. If you’re creating a script for use on a new Thriftly Deployment machine, select the Set Registration Code checkbox. Then, paste your registration code into the associated field.

  2. To configure your script to generate a log file when executed, select the Generate Log File checkbox. You can use this log file, which will be created in the same folder in which you store your PowerShell script, to troubleshoot any issues that arise when you run your script.

  3. To migrate any customized gateway recovery settings you’ve made (on the Settings tab found in the Thriftly Configurator Options menu) to your new machine, select the Add Server Gateway Settings checkbox.

  4. To automatically start any applications included in your script after they are deployed on your new machine, select the Start Applications checkbox.

  5. To suppress non-critical status updates as your script runs, select the Silent Execution checkbox. If you select this checkbox, PowerShell will still show information on any errors that occur as you run your script.

  6. In the Common Actions field, you can select an action to perform (create, update, or delete) for all of the endpoints currently listed in the Endpoint column. You can also select actions for each endpoint individually, using the Action field located next to each endpoint. Choose from the following actions:

    • <Blank>: If you select <Blank> for an endpoint, that endpoint is not included in your PowerShell script. If the endpoint already exists on the machine where you run this script, it remains unchanged after you run the script.

    • Create or Update: If you select Create or Update for an endpoint, the script creates that endpoint if it does not already exist on your new machine. If the endpoint does exist on that machine, the endpoint is updated using the settings specified in your script.

    • Delete: If you select Delete for an endpoint, and that endpoint exists on the machine where you run your script, the endpoint is deleted when you run your script.

  7. In the Common Gateway Server field, you can optionally select the Thriftly Gateway to use for all the endpoints included in your script. You can also specify gateways individually using the Gateway field located next to each endpoint. Remember, we recommend choosing the gateway that’s located geographically closest to the machine where you will create your application/endpoints.

  8. Select Browse to specify the path and file name at which to create your PowerShell script. Browse to the directory where you want to save the script, enter a file name in the File name field, and then select Save.

  9. Select the Generate button to create your script.

Running Your Script

To run your PowerShell script, perform the following steps on the machine on which you want to create or update your Thriftly Deployment settings.

  1. If you haven’t already, install Thriftly Deployment on your new machine (using the install instructions in the Installing and Licensing Thriftly Deployment section).

  2. Copy your application’s executable file(s) and any other required data files to your new machine (if they do not already exist on that machine). Make sure to place your application and executable file(s) at the same location you placed them on your previous machine, so your PowerShell script can correctly find and add your application (if you configured it to do so) when updating your Thriftly Deployment configuration. If you can’t place your application and executable files at the same location on your new machine, be sure to update your script to include your application’s new location.

  3. Copy your PowerShell script to your new machine. Then, open the script in your text-viewing application of choice. Copy the script to your clipboard for use in step 6 below.

  4. From the Windows Start menu, run Windows PowerShell as an administrator (by selecting the application, right-clicking on it, and selecting Run as administrator). The Administrator: Windows PowerShell window appears.

  5. If you have not already done so, set your Windows PowerShell execution policy to Unrestricted.

    1. Enter the Get-ExecutionPolicy command to determine your current execution policy.

    2. Enter the Set-ExecutionPolicy command, and then set your ExecutionPolicy to Unrestricted, to change your execution policy to Unrestricted.

  6. Paste your PowerShell script into PowerShell and press Enter on your keyboard to run your script. When the Install Menu appears, select 1 - Install/Update Thriftly Server Configuration.

  7. The PowerShell script runs and updates your Thriftly Deployment configuration, applications, and endpoints as you configured. If you chose to create a log file (by selecting the Generate Log File checkbox when you created your script), the log file is created in the directory where you stored your PowerShell script.

  8. To confirm that the PowerShell script updated your configuration as expected, open the Thriftly Configurator (Windows Start menu > Thriftly Deployment Server > Thriftly Admin) and review your application and endpoint settings.