Using Tomcat in Production

By default, the fast deployment procedure creates the app and app-core web applications running on port 8080 of the local Tomcat instance. It means that the web client is available at http://localhost:8080/app.

You can use this Tomcat instance in production just by copying the tomcat directory to the server. All you have to do is to set up the server host name in both conf/app/local.app.properties and conf/app-core/local.app.properties files (create the files if they do not exist):

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

Besides, set up the connection to you production database. You can do it in the context.xml file of your web application (webapps/app-core/META-INF/context.xml), or copy this file to conf/Catalina/localhost/app-core.xml as described in the previous section to separate development and production settings.

You can create the production database from a development database backup, or set up the automatic creation and further updating of the database. See Creating and Updating the Database in Production.

Optional Configuration
  1. If you want to change the Tomcat port or web context (the last part of the URL after /), use Studio:

    • Open the project in Studio.

    • Go to Project Properties > Edit > Advanced.

    • To change the web context, edit the Modules prefix field.

    • To change the Tomcat port, edit the Tomcat ports > HTTP port field.

  2. If you want to use the root context (http://myserver:8080/), rename app (or whatever you set on the previous step) directories to ROOT


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

    cuba.webContextName = /