Host the API Server on Heroku



Consume your data from smart phones and cloud-based applications such as Salesforce Connect. You can deploy the CData API Server for your data source to Heroku in 5 steps. The CData API Server is a lightweight Web application for Windows and Java that produces OData feeds for 80+ relational, non-relational, cloud, and on-premises data sources. In this article we show how to use the Webapp Runner Tomcat container and the Heroku Toolbelt to deploy the API Server. You can follow a similar procedure for Jetty Runner.

  1. Install the Heroku Toolbelt, as well as the Java edition of the CData API Server.
  2. On the Resources tab for your app, click Edit in the Add-Ons section. Enter Heroku Postgres in the box, add the database, and click Save.

    The API Server persists connection settings and schemas in this database.

  3. On the Settings tab for your app, click Reveal Config Vars -> Edit and add the following configuration variables:
    • Set the APP_DB, APP_USERS, and APP_LOGS variables to a valid JDBC connection string to the PostgreSQL database you provisioned. The syntax is below:
      jdbc:postgresql://AddressOnAmazonAWS.com:5432/MyDatabaseName?user=MyUsername&password=MyPassword
      Use the following parts from DATABASE_URL to obtain the parts of the JDBC connection string:
      postgres://user:password@AddressOnAmazonAWS.com:5342/MyDatabaseName
    • Set the WEBAPP_RUNNER_OPTS variable to the following:
      --tomcat-users-location ../../tomcat-users.xml

      The administrator for the API Server is defined in tomcat-users.xml. Note that the path to tomcat-users.xml is relative to the Webapp Runner JAR, the Tomcat container that runs your Web application.

  4. Configure authentication for the administrator of the API Server: Create a tomcat-users.xml file with the cdata_admin role. You can use the following tomcat-users.xml, based on the default file in a standalone Tomcat installation:

    <?xml version='1.0' encoding='cp1252'?>
    <tomcat-users>
      <user name="admin" password="admin" roles="cdata_admin" />
    </tomcat-users>
  5. Open a command prompt and execute the following command to deploy the WAR:
    heroku deploy:war -w path-to-your-war -a your-app-name -i path-to-your-tomcat-users.xml

You can now log into the API Server. See the Getting Started chapter in the help documentation for a guide to setting required connection properties, allowing access to tables, and making OData queries.