Install on Cloud Foundry
Install on Cloud Foundry
You can install
Layer7 Live API Creatorin a Cloud Foundry environment. The following examples use the public Pivotal Cloud Foundry, but you can also run in a private cloud.
For more information about Pivotal Cloud Foundry, see the Pivotal Cloud Foundry website.
In this article:
Verify the Prerequisites
Before you install
Layer7 Live API Creatoron Cloud Foundry, ensure that you have completed the following prerequisite steps:
- You have installed the Cloud Foundry command line, and you are logged in to Cloud Foundry.
- You have obtained the package containing theCALiveAPICreator.warweb application ARchive (WAR) file. You use this WAR file to install in a Cloud Foundry environment. This file only includes the JDBC driver for Derby. If you plan to access other database types, such as MySQL, PostgreSQL, Oracle, IBM Db2, or Microsoft SQL Server, add the JDBC driver for that database type to the WAR file (in theWEB-INF/libdirectory), or make them available to the app in Cloud Foundry.
- You know which license type you are usingLayer7 Live API Creatorunder, either a standard license that the CA Support site issues or an Enterprise Software Portfolio License Agreement (PLA).For more information about licensing, see Licensing.
- You have reviewed the installation best practices.For more information about the best practices, see Installation Best Practices.
(Optional) Add JDBC Drivers and Other Libraries into the WAR File
You can enable access to a database by adding the JDBC driver for that database into the
CALiveAPICreator.warfile. The following commands are for UNIX, but the Windows commands are similar.
Prerequisite:You have a copy of the
CALiveAPICreator.warfile in the current directory.
- From terminal or a command prompt, create theWEB-INFdirectory and theWEB-INF/libdirectory by issuing the following commands:mkdir WEB-INFmkdir WEB-INF/lib
- Download the JDBC driver from the web to theWEB-INF/libdirectory.wget -P WEB-INF/lib <JDBC driver file name and location on the web>Example:wget -P WEB-INF/lib http://central.maven.org/maven2/mysql/mysql-connector-java/8.0.12/mysql-connector-java-8.0.12.jar
- Add the JAR file to the/development/CALiveAPICreator.warfile by issuing the following command:jar uvf CALiveAPICreator.war WEB-INF/lib/<JDBC driver file name>Example:jar uvf CALiveAPICreator.war WEB-INF/lib/mysql-connector-java-8.0.12.jar
- Add other JDBC drivers and Java libraries as needed.
The WAR file now contains the JDBC drivers and other Java libraries. The file is ready for you to install it in a Cloud Foundry environment.
Deploy as Cloud Foundry Application
You can deploy Cloud Foundry applications using several methods. The following example illustrates a method that uses options for basic Cloud Foundry application deployment.
For more information:
Follow this step:
pushcommand with the following options:
cf push MyLiveAPICreator -p CALiveAPICreator.war -b https://github.com/cloudfoundry/java-buildpack.git
The following output is expected:
Uploading droplet, build artifacts cache...Uploading droplet...Uploading build artifacts cache...Uploaded build artifacts cache (55.1M)Uploaded droplet (125.8M)Uploading completeWaiting for app to start...Cell a39a5e3a-75de-4118-1041-9e2be7c61825 stopping instance 8afcfd14-603f-498b-a699-ca4d4d82a2bdCell a39a5e3a-75de-4118-1041-9e2be7c61825 destroying container for instance 8afcfd14-603f-498b-a699-ca4d4d82a2bdname: MyLiveAPICreatorrequested state: startedroutes: myliveapicreator.cfapps.iolast uploaded: Wed 05 Sep 11:54:32 PDT 2018stack: cflinuxfs2buildpacks: https://github.com/cloudfoundry/java-buildpack.gittype: webinstances: 1/1memory usage: 1024Mstart command: JAVA_OPTS="-agentpath:$PWD/.java-buildpack/open_jdk_jre/bin/jvmkill-1.16.0_RELEASE=printHeapHistogram=1 -Djava.io.tmpdir=$TMPDIR-Djava.ext.dirs=$PWD/.java-buildpack/container_security_provider:$PWD/.java-buildpack/open_jdk_jre/lib/ext-Djava.security.properties=$PWD/.java-buildpack/java_security/java.security $JAVA_OPTS -Daccess.logging.enabled=false -Dhttp.port=$PORT" &&CALCULATED_MEMORY=$($PWD/.java-buildpack/open_jdk_jre/bin/java-buildpack-memory-calculator-3.13.0_RELEASE -totMemory=$MEMORY_LIMIT-loadedClasses=23031 -poolType=metaspace -stackThreads=250 -vmOptions="$JAVA_OPTS") && echo JVM Memory Configuration: $CALCULATED_MEMORY &&JAVA_OPTS="$JAVA_OPTS $CALCULATED_MEMORY" && MALLOC_ARENA_MAX=2 JAVA_OPTS=$JAVA_OPTS JAVA_HOME=$PWD/.java-buildpack/open_jdk_jre exec$PWD/.java-buildpack/tomcat/bin/catalina.sh runstate since cpu memory disk#0 running 2018-09-05T18:55:15Z 251.0% 349.6M of 1G 262.1M of 1G
Complete the following procedures after you have created and uploaded the Cloud Foundry application.
Enable Other Options at Server Startup
The following are options that you can enable at startup:
Add these options before starting your server only once. Do not add these options as part of normal operations.
For more information:
You can enable the options when you start API Server by way of a defined
Follow these steps:
- Define amanifest.ymlfile.The following code snippet shows an example of the contents of amanifest.ymlfile, with the options added as environment variables:---applications:- name: MyLiveAPICreator instances: 1 memory: 768M buildpack: java_buildpack path: CALiveAPICreator.war health-check-type: http health-check-http-endpoint: /rest/abl/admin/v2/@heartbeat env: ca_accept_license: ENU LAC_INITIAL_SA_PASSWORD: Password2 LAC_INITIAL_ADMIN_PASSWORD: Password3 LAC_INITIAL_ACCOUNT_URL_NAME: myteamspace LAC_INITIAL_ACCOUNT_NAME: MyTeamSpace LAC_SERVER_IDENT: MyPCFserver LAC_REPOSITORY_ROOT: /tmp/repo
- Add the file to the same directory as the WAR file.
- Create and upload the Cloud Foundry application.For more information, see the "Create and Upload the Cloud Foundry Application" section.
Bypass the Extra Step at Login to Accept the EULA
If you are deploying into production using a cluster or if you are scripting deployment, you can bypass the API Creator screen that asks the initial API developer (a TeamSpace user) to log in to accept the user license, which pre-accepts the terms of the EULA. You can pre-accept the terms of the EULA by adding the
CA_ACCEPT_LICENSEoption as an environment variable or as a Java system property, for example:
Specify an Alternate License File
If you are licensed to use
Layer7 Live API Creatorunder the standard license that the CA Support site issues, the first time that you start
Layer7 Live API Creatorin Cloud Foundry, you must install the API Server license file. You can install this file when you start your Cloud Foundry environment by adding the
LAC_DEFAULT_LICENSE_FILEoption when you start API Server:
Change the Initial Password for the System Administrator User and for the Initial API Developer
If you did not change the passwords for the system administrator (
sa) user and for the initial API developer (a TeamSpace user) for the default TeamSpace as options when you started your Java container, change the passwords. Add the
LAC_INITIAL_ADMIN_PASSWORDoptions when you start API Server.
For more information:
Specify the Location from Where you Want
Layer7 Live API Creatorto Pull your Admin Repository
By default, at initial server startup,
Layer7 Live API Creatorpulls your admin repository from the location you set using the
LAC_REPOSITORY_ROOToption. You can change this location by adding the
LAC_REPOSITORY_CONFIGURATION_URLoption when you start API Server.
Specify the Location to Where you Want
Layer7 Live API Creatorto Add your Admin Repository
The first time that you start your Cloud Foundry environment with
Layer7 Live API Creator, you must set the location for your admin repository at startup by adding the
LAC_REPOSITORY_ROOToption when you start API Server, for example:
You can change the location using this option.
Connect to your Installation
- Connect to your installation, in this examplehttp://myliveapicreator.cfapps.io, and then log in.
- Verify thatLayer7 Live API Creatoris up by issuing the following command:cf appsThe following output is expected:Getting apps in org acme / space development as [email protected]OKname requested state instances memory disk urlsMyLiveAPICreator started 1/1 1G 1G myliveapicreator.cfapps.io
- Verify that all is well by looking at the logs by issuing the following command:cf logs --recent MyLiveAPICreator
Layer7 Live API Creatorto Collect and Send Usage Data
If you are licensed to use
Layer7 Live API Creatorunder a PLA, you must activate
Layer7 Live API Creatorand configure it to collect and send usage data. If you are licensed to use
Layer7 Live API Creatorunder a standard license, you can consent to
Layer7 Live API Creatorcollecting and sending usage data.
For more information about how to configure to collect and send usage data, see Activate and Configure to Send Usage Data.
Import the API Server License
The API Server license controls access to API Creator and services. If you are licensed to use
Layer7 Live API Creatorunder a standard license and you did not specify a license file when starting your Cloud Foundry environment (by adding the
LAC_DEFAULT_LICENSE_FILEoption at Cloud Foundry startup), you must now upload it.
For more information about licensing, see Licensing.
The following topic provides advanced configuration details.
Create a Database for your Authentication Tokens
Layer7 Live API Creatorgenerates authentication tokens, stores them in the in-memory Derby database, and synchronizes them to your admin repository in the following cases:
- You have configuredLayer7 Live API Creatorto run as a single node.
- You are running in a local development environment.
You can optionally have
Layer7 Live API Creatorstore the authentication tokens that it generates for API users in a database instead by creating one.
For more information about how to create this database, see Create a Database for your Authentication Tokens.