Example: Deploy the Bundled WAR to a Cluster

The 
setup.sh
 sample script is an example that you can use to bundle the admin repository and the definition of the data source for the authentication token database into the WAR file and deploy the bundled WAR file to a cluster running
CA Live API Creator
.
lac42
The  sample script is an example that you can use to bundle the admin repository and the definition of the data source for the authentication token database into the WAR file and deploy the bundled WAR file to a cluster running
CA Live API Creator
. This sample illustrate running 
CA Live API Creator
 on Apache Tomcat.
The script demonstrates the following high-level steps: 
  1. Download Tomcat, and then configure Tomcat on a cluster of two nodes that run on a different set of ports (lines 9-36).
  2. Copy the database JDBC drivers that your API requires into the
    ${CATALINA_HOME}/lib
    directory (lines 42-43).
  3. Create the 
    configuration.zip
     file from your admin repository.
    1. If your you have created a database to persist your authentication tokens, copy the 
      ApiKey.json
       file (the definition of the data source for the authentication token database) into
      system/data_sources
      directory.
      For more information about using a database for your authentication tokens, see Create a Database for your Authentication Tokens.
    2. Create the 
      configuration.zip
       file that includes the the 
      teamspaces
       and 
      system
       directories.
    CA Live API Creator
    expects the
    configuration.zip
    file for the admin repository.
  4. Bundle the admin repository into the WAR file. 
    The following sample script shows the commands that it uses: 
    # cp lac/production/APIServer.war mydeployment-1.war cp lac/development/CALiveAPICreator.war mydeployment-1.war rm -rf WEB-INF mkdir WEB-INF WEB-INF/classes # specialize the war for my APIs, system configuration and an externalized ApiKey database # The name configuration.zip must be exact. cp MyProductionAPIs-v1.zip WEB-INF/classes/configuration.zip # and customize the deployment war jar uvf mydeployment-1.war WEB-INF
  5. Deploy the bundled WAR file to the servers as the 
    lac
     application (lines 69-70).
  6. Start the Tomcat nodes, and then retrieve the server status on each node using the 
    @heartbeat
     endpoint (lines 73-84).
    For more information about this system REST endpoint, see System REST Endpoints.
  7. Shut down the Tomcat nodes (lines 87-88).