How to deploy the platform UI in TOMCAT instead of a Docker container

Dennis Andrade
4 min readMar 1, 2021

ForgeRock delivers the new Platform UI using Docker and that’s the recommended and easier way of doing it, however this is not the only way to deploy it. Docker is definitely the easiest way of building it because it is already packed within this container and all you have to do is download and run it. But we understand that sometimes there is a need to deploy it in a different way whether it’s because of business requirements or personal preferences.

In this article we will show the step by step on how to build the Platform UI on a Tomcat server

Follow the steps below to deploy the platform enduser-ui and the login-ui on Tomcat:

  1. Download and build the platform-enduser and the platform-login.
  • Clone the platform-ui git repository.
  • Adjust all variables found within .env.production.
  • Build it by executing the following command: yarn build
  • The files that we need should be available under the dist/ directory.

2. Once we have the files ready, it’s time to generate our war file to be able to deploy in tomcat. The process is the same for both UIs but I will give you the example on how to do it for the enduser-ui. When executing it for the login-ui, make sure you execute the command below by renaming the enduser parameters with the loginui parameters.

  • Execute the following maven command to generate a new empty maven project. A new directory called plat-enduser-ui will be created where you executed this command:
mvn archetype:generate -DgroupId=com.forgeRock.platformEnduserUI -DartifactId=plat-enduser-ui -DarchetypeArtifactId=maven-archetype-webapp -DarchetypeVersion=1.4 -DinteractiveMode=false
  • Delete the file index.jsp from the plat-enduser-ui/src/main/webapp directory.
  • Copy all the contents from the dist directory (step 1.d) to the plat-enduser-ui/src/main/webapp directory.
  • Build the project to generate the war file with the following command: mvn clean install

The war file should be available in the target folder within the project.

3. Configure tomcat to listen on the port you have configured the enduser-ui and the login-ui. In our documentation, it’s configured to listen on port 8888 (enduser-ui) and 8083 (login-ui) so I will stick with it but you can use whatever port you find appropriate for your deployment.

  • Navigate to your tomcat home directory/conf and edit server.xml. Look for the HTTP/1.1 connector and change the port to 8888 for enduser-ui or 8083 for login-ui
  • Copy the war file from step 2.d to the <tomcat home>/webapps/ directory
  • Rename the file to ROOT.war. It’s important to rename the file before you start the tomcat server. We want to use it in the root context to avoid having to add the app context into the URL.
  • Start the tomcat server

You are done and the platform UIs should be configured to run on a tomcat server.

Platform admin-ui

The platform admin-ui is not a public repository so you will not be able to follow the procedure above to deploy the admin-ui on a tomcat server. It is recommended that you run the admin-ui in a Docker environment. However, if you are still interested in running the admin-ui on Tomcat, it is possible to do by extracting the admin-ui files from the Docker container.

  1. Deploy the admin-ui in a Docker environment by following the procedure on the ForgeRock Platform Setup Guide
  2. Execute the following commands to list all the docker images and all the running images to get the container’s name:
sudo docker image list
sudo docker ps

3. From the above output we can see that the only docker image running is the happy_leavitt. But if you have multiple images running, match the IMAGE with the IMAGE ID from both outputs to find out which one is the admin ui.
Copy the admin ui files from the container to the host vm by executing the following command:

sudo docker cp -a happy_leavitt:/usr/share/nginx/html .

4. The directory named “html” has all the files needed to build the war file needed to run it on a tomcat server. From this point on you can just follow the steps outlined above starting on step 2.

You are done!

--

--