-
Notifications
You must be signed in to change notification settings - Fork 7
How to RUN [2]
WMP is a multi-application environment that encompasses a number of web services, so this page describes how it could be properly run.
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.
- selector-service -- a service which provides selectors for web-services. It is used because of GUI-testing.
db-* services start as stand-alone applications, while auth-service, dashboard-service and editor-service require an instance of tomcat web server to run. selector service starts separately as a spring boot application.
There are currently two ways to run tomcat-based services.
- Run them all on one instance of tomcat server.
- 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.
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, mvn tomcat7:run-war-only -P <profile>
for all other services and mvn spring-boot:run
for selector-service. 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.
All profile setup and service running activities could be performed using IDEA's Maven Projects tab.
To run the service (expect selector-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).
To run selector-service do following steps.
- Click the
Execute Maven Goal
icon.
- Enter the command
spring-boot:run
.
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.
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. Add maven goals (click the +
top-left icon, select Maven). When done Edit Configurations window should look like this:
Tomcat configuration should look like this:
Create a new Multirun run configuration (click the +
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 tomcat 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.