Jarboot
Jarboot is a powerful platform for server process management and diagnosis, which can manage, monitor, and diagnose local and remote programs online. It can also cluster and manage multiple server nodes. In addition, it has functions such as file management and remote terminal.
Install / Use
/learn @majianzheng/JarbootREADME
Jarboot ❤️

<code>Jarboot</code> is a platform for Java process startup, shutdown, management and diagnosis. It can manage, guard, monitor and diagnose local and remote Java processes.
In the test environment and daily built integrated environment, a series of jar files such as compilation output can be put into the agreed directory. <code>Jarboot</code> provides a friendly browser UI interface and HTTP interface to manage its start, stop and status monitoring, and execute commands to debug the target process.
📚 Document: https://www.yuque.com/jarboot
🍏 Best practices 🔥 : Jarboot with Spring Cloud Alibaba Example ⭐️
🐳 Extensible: Support both <code>JDK SPI</code> and <code>Spring SPI</code>, support plugins develop.
📦 Installation package Download: https://gitee.com/majz0908/jarboot/releases
📺 视频演示: 哔哩哔哩视频

Background and objectives
<code>Jarboot</code> uses Java agent and <code>ASM</code> technology to inject code into the target java process, which is non-invasive. The injected code is only used for command interaction with jarboot's service. Some commands modify the bytecode of the class for class enhancement. A command system similar to <code>Arthas</code> is added, such as acquiring JVM information, monitoring thread status, acquiring thread stack information, etc.
- 🌈 Browser interface management, one click start, stop, do not have to manually execute one by one.
- 🔥 Support start and stop priority configuration<sup id="a2">[1]</sup>, and default parallel start.
- ⭐ Process daemon. If the service exits abnormally after opening, it will be automatically started and notified.
- ☀️ Support file update monitoring, and restart automatically if jar file is updated after opening.<sup id="a3">[2]</sup>
- 🚀 Debug command execution, remote debugging multiple Java processes at the same time, the interface is more friendly.
- 💎 Support user-define command by <code>SPI</code>, support develop plugins.

Architecture brief introduction
Detailed architecture design view
Front-end interface adopts <code>Vue3</code> technology. The back-end service is mainly implemented by <code>SpringBoot</code>, which provides HTTP interface and static resource broker. The process information is pushed through <code>websocket</code> to the front-end interface in real time, and a long connection is maintained with the started java process to monitor its status.
Chrome >=87 Firefox >=78 Safari >=14 Edge >=88
Install or build
Download the zip package to install or using Docker.
1. Install package download: <a href="https://github.com/majianzheng/jarboot/releases" target="_blank">从Github下载</a>
2. Select <code>Docker</code>
# build jarboot package, need jdk17+ maven nodejs16+
mvn clean install -P prod
# build docker image
sh docker/docker_image_build.sh
# start docker container
sudo docker run -itd --name jarboot -p 9899:9899 mazheng0908/jarboot
3. Select docker compose setting:
# build jarboot package, need jdk17+ maven nodejs16+
mvn clean install -P prod
# build docker image
cd docker
# shutdown first when running
docker compose down
sh docker_image_build.sh
# start docker compose
bash init_docker_dir.sh
docker compose -f docker-compose.yml up -d
Code build method
Ignore this when using zip package or <code>docker</code>.
Build the jarboot code.
#At first prepare JDK17+ and nodeJs16+, then
$ mvn clean install -P prod
Start <code>jarboot</code> server
Ignore this when using <code>docker</code>.
#Execute startup.sh to start, use startup.cmd when in windows OS.
$ sh startup.sh
Browser access http://127.0.0.1:9899
Enter the login page. Initial username: <code>jarboot</code>, default password: <code>jarboot</code>
SPI Extension, support both JDK and Spring SPI
Use SPI extension can implement your own command, define a command how to execute. And,also can notify stated event to Jarboot server , don't need to wait no console time.
SpringBoot Application
- Import <code>spring-boot-starter-jarboot</code> dependency
<dependency>
<groupId>io.github.majianzheng</groupId>
<artifactId>spring-boot-starter-jarboot</artifactId>
<version>${jarboot.version}</version>
</dependency>
- Implement <code>CommandProcessor</code>SPI interface
Also, you can use <code>@Bean</code> in the method.<br> It will use bean name as the command name if not annotated by <code>@Name</code>.
@Name("spring.command.name")
@Summary("The command summary")
@Description("The command usage detail")
@Component
public class DemoServiceImpl implements DemoService, CommandProcessor {
@Override
public String process(CommandSession session, String[] args) {
return "Spring boot Demo user-defined command using Spring SPI";
}
//implement other method...
}
It will add two new spring debug command <code>spring.bean</code> and <code>spring.env</code> after imported <code>spring-boot-starter-jarboot</code> dependence.
#spring.bean usage:
$ spring.bean [-b <name>] [-d]
#Examples:
# Get all bean names
$ spring.bean
# Get bean info
$ spring.bean -b beanName
# Get bean detail definition
$ spring.bean -b beanName -d
#sping.env usage:
$ spring.env <name>
#Examples:
$ spring.env spring.application.name
None SpringBoot Application
Demonstrate how to use ordinary non springboot applications.
How to create user-defined command
- Import jarboot api dependency
<dependency>
<groupId>io.github.majianzheng</groupId>
<artifactId>jarboot-api</artifactId>
<scope>provided</scope>
<version>${jarboot.version}</version>
</dependency>
- Implement spi interface
/**
* Use Name to define the command name
*/
@Name("demo")
@Summary("The command summary")
@Description("The command usage detail")
public class DemoCommandProcessor implements CommandProcessor {
@Override
public String process(CommandSession session, String[] args) {
return "demo SPI command result.";
}
}
- Create spi define file
Then create a file in <code>resources</code>/<code>META-INF</code>/<code>services</code> named <code>spi.cmd.io.github.majianzheng.jarboot.api.CommandProcessor</code> the content is class full name.
Proactive notification of startup completion
public class DemoApplication {
public static void main(String[] args) {
// do something
try {
//Notify completion
JarbootFactory.createAgentService().setStarted();
} catch (Exception e) {
log(e.getMessage());
}
}
}
Tools
File browse

Terminal

Command list
bytes
View the class bytes,Usage:
jarboot$ bytes io.github.majianzheng.jarboot.demo.DemoServerApplication
ClassLoader: org.springframework.boot.loader.LaunchedURLClassLoader@31221be2
------
getUser
L0
LINENUMBER 27 L0
...
ILOAD 1
ILOAD 2
IADD
IRETURN
L8
stdout
Turn on or off real-time display of standard output stream (initially on), it will be displayed on the front-end UI of the web in real time. The output stream includes <code>System.out.println</code>, <code>System.err.println</code> and log printing information such as <code>logger.info("hello")</code> in the code.
Note: The implementation mechanism of this function has been carefully designed. It is recommended to be turned on all the time, which has no impact on performance and can be accelerated when starting.
#Turn on real time display of standard output stream
jarboot$ stdout on
#Turn off real time display of standard output stream
jarboot$ stdout off
#Get current status on or off
jarboot$ stdout
dashboard
This is the real time statistics dashboard for the current system,click x cancel.

jad
Decompile the specified cla
