Skip to content

How to run

Timofey Bryksin edited this page Nov 1, 2016 · 9 revisions

How to run WMP

WMP is a multi-application environment that encompasses a number of web services, so this page describes how it could be properly run.

Project structure

Currently WMP consists of the following applications:

  • db-diagram-service -- a back-end service providing data and CRUD-like operations for diagrams
  • db-user-service -- a back-end service providing data and CRUD-like operations for users
  • db-robot-store-service -- a back-end service providing data and CRUD-like operations for robots (was used only in RobotStore project)
  • auth-service -- a web service providing authentication and authorization facilities for all other services
  • dashboard-service -- a web service providing a dashboard for RobotStore project
  • editor-service -- a web service for diagram editors and other modeling tools. Currently acts as a web version of TRIK Studio IDE, but will be refactored someday soon.

db-* services start as stand-alone applications, while auth-service, dashboard-service and editor-service require an instance of tomcat web server to run.

Maven profiles

There are currently two ways to run tomcat-based services.

  1. Run them all on one instance of tomcat server.
  2. Run each of the services on a separate tomcat server.

The first option is available with "one-tomcat-for-all" Maven profile and is active by default (if you don’t specify the profile explicitly). To start separate tomcat servers use “different-ports" or "travis" Maven profile (this is the profile that Travis CI and production servers are meant to use).

See examples of running the services below.

Manual console run

If the goal is to just start everything once, the console way is the simplest. Use mvn exec:java -P <profile> command for each db-* service and mvn tomcat7:run-war-only -P <profile> for all other services. For example, this is exactly how Travis CI starts the services (see Travis config file file for complete commands list).

However if you want to restart the services (e.g. while developing one of them), this approach is not not very useful since you have to kill the process to restart the service.

Manual run from IDEA using Maven goals

All profile setup and service running activities could be performed using IDEA's Maven Projects tab.

To run the service double click exec:java or tomcat7:run-war/tomcat7:run-war-only goals (tomcat7:run-war-only goal just starts the web server and tomcat7:run-war performs install goal before).

This will create more usable environment: IDEA will create a tab for each maven goal run and all of them can be shut and re-run separately.

Automatic run from IDEA using Multirun plugin

Install Multirun IDEA plugin (Settings -> Plugins).

Using Maven Projects tool window or Run -> Edit Configurations window create one run configuration for each maven goal that need to be run.

When done Edit Configurations window should look like this:

Create a new Multirun run configuration (click the green + top-left icon, select Multirun). Add all maven configurations in the Choose configurations to run window. The order of the configurations matters, to work correctly robots-editor should be the last one in the list. Set the delay value into 2-3 seconds (should be even more if your hardware is super slow).

To start everything just run this newly created Multirun configuration. IDEA should start a tab for each running sub-configuration.

Keep in mind that git clean command deletes all run configurations, so if you plan to do it regularly, you better backup your .idea/workspace.xml file.

NOTE: current Multirun version has some issues with re-using tabs when re-running the configuration, so be careful to stop everything using Run -> Stop Multirun command. Run -> Stop could also be used if the goal is to start everything and restart only some services later using their own (not Multirun-based) configurations.