6.2.1.1. Using Tomcat in Production

The fast deployment procedure creates app and app-core web applications running on port 8080 of a local Tomcat instance. It means that the web client is available at http://localhost:8080/app. You can use this server instance in production, but you need to change some application properties to conform to the production environment.

First set up a server host name.

If you are not going to change the port (8080) or the web context name (app), set the following properties in both tomcat/conf/app/local.app.properties and tomcat/conf/app-core/local.app.properties files:

cuba.webHostName = myserver
cuba.webAppUrl = http://myserver:8080/app

If the port differs from 8080, specify also the cuba.webPort property:

cuba.webPort = 7070
cuba.webHostName = myserver
cuba.webAppUrl = http://myserver:7070/app

If you want to change the web context (e.g. to sales), do the following:

  • Rename the web applications and conf subdirectories:

    tomcat/
        conf/
            sales/
                local.app.properties
            sales-core/
                local.app.properties
        webapps/
            sales/
            sales-core/

  • Open tomcat/webapps/sales-core/WEB-INF/web.xml and change the last line in the appPropertiesConfig context parameter value to the following:

    file:${catalina.home}/conf/sales-core/local.app.properties

  • Open tomcat/webapps/sales/WEB-INF/web.xml and change the last line in the appPropertiesConfig context parameter value to the following:

    file:${catalina.home}/conf/sales/local.app.properties

  • Add the following to tomcat/conf/sales-core/local.app.properties:

    cuba.webContextName = sales-core
    cuba.webPort = 7070
    cuba.webHostName = myserver
    cuba.webAppUrl = http://myserver:7070/sales

  • Add the following to tomcat/conf/sales/local.app.properties:

    cuba.connectionUrlList = http://localhost:7070/sales-core
    cuba.webContextName = sales
    cuba.webPort = 7070
    cuba.webHostName = myserver
    cuba.webAppUrl = http://myserver:7070/sales

    The cuba.connectionUrlList property is used when transferring uploaded files between web client and middleware even in case of local service invocations, so it should always point to a real URL of the middleware application.

If you want to use the root context for the web client (http://myserver:8080), rename sales directories to ROOT

tomcat/
    conf/
        ROOT/
            local.app.properties
        sales-core/
            local.app.properties
    webapps/
        ROOT/
        sales-core/

and use / as the web context name in tomcat/conf/ROOT/local.app.properties:

cuba.webContextName = /