Example: Deploy the Bundled WAR to a Cluster

You can repackage the
Layer7 Live API Creator
WAR file to include the admin repository containing your APIs and simplify the deployment of
Layer7 Live API Creator
to a cluster.
You can repackage the
Layer7 Live API Creator
WAR file to include the admin repository containing your APIs and simplify the deployment of
Layer7 Live API Creator
to a cluster. Use the following example to deploy the bundled WAR to a cluster.
Create the ZIP File for your Admin Repository
Create a ZIP file (for example,
MyProductionAPIs-v1.zip
) from your admin repository.
Follow these steps:
  1. If 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 the
    system/data_sources
    directory.
    For more information:
  2. Create the ZIP file that includes the
    teamspaces
    and
    system
    directories. The
    teamspaces
    directory contains the directories for each TeamSpace that you define in
    Layer7 Live API Creator
    . The
    system
    directory contains the API definitions for the Admin API that API Server uses to at startup.
The ZIP file for your admin repository is created.
Create the Bundled WAR File
The sample script is an example that you can use to bundle the admin repository and deploy the bundled WAR file to a cluster running
Layer7 Live API Creator
. This sample illustrate running
Layer7 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. Rename the zip file for your admin repository to
    configuration.zip
    file and bundle it 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 # 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
  4. Deploy the bundled WAR file to the servers as the
    lac
    application (lines 68-69).
  5. Start the Tomcat nodes, and then retrieve the server status on each node using the
    @heartbeat
    endpoint (lines 72-83).
    For more information about this system REST endpoint, see System REST Endpoints.
  6. Shut down the Tomcat nodes (lines 86-87).