diff --git a/server/src/main/java/org/eclipse/jifa/server/Configuration.java b/server/src/main/java/org/eclipse/jifa/server/Configuration.java index ab0d1ac2..741ea5bf 100644 --- a/server/src/main/java/org/eclipse/jifa/server/Configuration.java +++ b/server/src/main/java/org/eclipse/jifa/server/Configuration.java @@ -128,14 +128,14 @@ public class Configuration { private boolean allowRegistration = true; /** - * default root username + * default admin username */ - private String rootUsername = "root"; + private String adminUsername = "admin"; /** - * default root password + * default admin password */ - private String rootPassword = "password"; + private String adminPassword = "password"; /** * Input files is some specified files that will be added automatically when starting. diff --git a/server/src/main/java/org/eclipse/jifa/server/service/impl/UserServiceImpl.java b/server/src/main/java/org/eclipse/jifa/server/service/impl/UserServiceImpl.java index a3ca8ec4..6de8c672 100644 --- a/server/src/main/java/org/eclipse/jifa/server/service/impl/UserServiceImpl.java +++ b/server/src/main/java/org/eclipse/jifa/server/service/impl/UserServiceImpl.java @@ -13,6 +13,7 @@ package org.eclipse.jifa.server.service.impl; import jakarta.annotation.PostConstruct; +import org.apache.commons.lang3.StringUtils; import org.eclipse.jifa.common.domain.exception.ShouldNotReachHereException; import org.eclipse.jifa.common.util.Validate; import org.eclipse.jifa.server.ConfigurationAccessor; @@ -70,15 +71,15 @@ public UserServiceImpl(TransactionTemplate transactionTemplate, @PostConstruct private void init() { - if (config.getRootUsername() != null) { - Optional root = loginDataRepo.findByUsername(config.getRootUsername()); - if (root.isPresent()) { + if (userRepo.count() == 0 && StringUtils.isNotBlank(config.getAdminUsername())) { + Optional defaultAdmin = loginDataRepo.findByUsername(config.getAdminUsername()); + if (defaultAdmin.isPresent()) { return; } try { - register("root", config.getRootUsername(), cipherService.encrypt(config.getRootPassword()), true); + register("Admin", config.getAdminUsername(), cipherService.encrypt(config.getAdminPassword()), true); } catch (Throwable t) { - if (loginDataRepo.findByUsername(config.getRootUsername()).isEmpty()) { + if (loginDataRepo.findByUsername(config.getAdminUsername()).isEmpty()) { throw t; } } @@ -89,8 +90,8 @@ private void init() { public JifaAuthenticationToken login(String username, String password) { LoginDataEntity loginData = loginDataRepo.findByUsername(username).orElse(null); Validate.notNull(loginData, USER_NOT_FOUND); - Validate.isTrue(encoder.matches(cipherService.decrypt(password), loginData.getPasswordHash()), - INCORRECT_PASSWORD); + Validate.isTrue(encoder.matches(cipherService.decrypt(password), loginData.getPasswordHash()), + INCORRECT_PASSWORD); return jwtService.generateToken(loginData.getUser()); } diff --git a/site/docs/guide/configuration.md b/site/docs/guide/configuration.md index 1b308053..da722c33 100644 --- a/site/docs/guide/configuration.md +++ b/site/docs/guide/configuration.md @@ -72,13 +72,13 @@ Default:Read from the environment variable `MYSQL_PASSWORD`, and `jifa` is use ## scheduling-strategy -The scheduling strategy. +The scheduling strategy. Type: Enum - `STATIC` - `ELASTIC` - + Default: null ## storage-pvc-name @@ -123,9 +123,10 @@ Default: 8102 ## elastic-worker-idle-threshold -The idle threshold of `WORKER` nodes in an elastic cluster, in minutes, with a minimum value of 2. When a `WORKER` node is idle for more than this threshold, it will automatically stop. +The idle threshold of `WORKER` nodes in an elastic cluster, in minutes, with a minimum value of 2. When a `WORKER` node +is idle for more than this threshold, it will automatically stop. -Type: int +Type: int Default: 5 @@ -145,17 +146,19 @@ Type: boolean Default: true -## root-username +## admin-username -Root username. +The username of the administrator account. Type: String -Default: root +Default: admin + +If set to blank or if there are already registered users, administrator account registration will not be performed. -## root-password +## admin-password -Root password. +The password of the administrator account. Type: String diff --git a/site/docs/guide/contributing.md b/site/docs/guide/contributing.md index 38c59689..310e7e7e 100644 --- a/site/docs/guide/contributing.md +++ b/site/docs/guide/contributing.md @@ -5,7 +5,7 @@ Contributions in various forms are welcome, including but not limited to: - Bug reports and issue submissions - + - New requirements or ideas - Bug fixes @@ -13,7 +13,7 @@ Contributions in various forms are welcome, including but not limited to: - Testing - Documentation enhancement - + - New features or improvements ## Code Format diff --git a/site/docs/guide/deployment.md b/site/docs/guide/deployment.md index 125b8bff..46a4dac2 100644 --- a/site/docs/guide/deployment.md +++ b/site/docs/guide/deployment.md @@ -29,14 +29,14 @@ There are two types of roles: Based on different scheduling strategies, the cluster is divided into two types: -- Elastic Cluster: `WORKER` nodes are scheduled on-demand. Users need to prepare a K8S cluster. The role of `WORKER` nodes is `ELASTIC_WORKER`. +- Elastic Cluster: `WORKER` nodes are scheduled on-demand. Users need to prepare a K8S cluster. The role of `WORKER` + nodes is `ELASTIC_WORKER`. - Static Cluster: `WORKER` nodes need to be started in advance. The `role` of `WORKER` nodes is `STATIC_WORKER`. - ### Elastic Cluster -Refer to [cluster.yml](https://github.com/eclipse/jifa/blob/main/cluster.yml). +Refer to [cluster.yml](https://github.com/eclipse/jifa/blob/main/cluster.yml). Command: `kubectl apply -f cluster.yml` diff --git a/site/docs/guide/what-is-eclipse-jifa.md b/site/docs/guide/what-is-eclipse-jifa.md index 5181b150..0755f813 100644 --- a/site/docs/guide/what-is-eclipse-jifa.md +++ b/site/docs/guide/what-is-eclipse-jifa.md @@ -3,7 +3,8 @@ ## Introduction Eclipse Jifa (abbreviated as Jifa) stands for "**J**ava **I**ssues **F**inding **A**ssistant". -This project originated from an internal system which was designed to improve the efficiency of diagnosing Java heap related issues that occurred in the production environment. +This project originated from an internal system which was designed to improve the efficiency of diagnosing Java heap +related issues that occurred in the production environment. Currently, Jifa primarily supports the following features: @@ -39,7 +40,7 @@ Taking the analysis of a heap dump as an example, users can initiate an analysis ::: 2. Upload the heap dump to Jifa. Currently, various transfer methods are supported, including local file upload, -as well as uploading through cloud storage solutions such as S3. + as well as uploading through cloud storage solutions such as S3. ![Upload](../image/upload.jpeg) diff --git a/site/docs/zh/guide/configuration.md b/site/docs/zh/guide/configuration.md index bdec8352..cf178ed8 100644 --- a/site/docs/zh/guide/configuration.md +++ b/site/docs/zh/guide/configuration.md @@ -2,7 +2,9 @@ 本页梳理了服务端支持的配置。 -各配置项的默认值由 [Configuration.java](https://github.com/eclipse/jifa/blob/main/server/src/main/java/org/eclipse/jifa/server/Configuration.java) 或默认配置文件 [application.yml](https://github.com/eclipse/jifa/blob/main/server/src/main/resources/application.yml) 提供。 +各配置项的默认值由 [Configuration.java](https://github.com/eclipse/jifa/blob/main/server/src/main/java/org/eclipse/jifa/server/Configuration.java) +或默认配置文件 [application.yml](https://github.com/eclipse/jifa/blob/main/server/src/main/resources/application.yml) +提供。 通过启动参数 `--jifa.=` 或指定配置文件进行设置。 @@ -142,17 +144,19 @@ 默认值:true -## root-username +## admin-username -root 用户名。 +管理员账号的用户名。 类型:String -默认值:root +默认值:admin -## root-password +如果设置为空,或已有注册用户则不会进行管理员账号注册 -root 用户密码。 +## admin-password + +管理员账号的密码。 类型:String diff --git a/site/docs/zh/guide/gc-log-analysis.md b/site/docs/zh/guide/gc-log-analysis.md index 6d7a2345..de7313a6 100644 --- a/site/docs/zh/guide/gc-log-analysis.md +++ b/site/docs/zh/guide/gc-log-analysis.md @@ -2,13 +2,18 @@ ## 介绍 -GC(垃圾回收)日志分析是一种用于排查 GC 问题和 GC 性能分析技术。当应用程序出现 Full GC 导致应用长时间暂停,GC 性能低等问题时,GC 日志分析可以提供有关 GC 触发原因,GC 持续时间,内存使用变化等详细信息。 +GC(垃圾回收)日志分析是一种用于排查 GC 问题和 GC 性能分析技术。当应用程序出现 Full GC 导致应用长时间暂停,GC 性能低等问题时,GC +日志分析可以提供有关 GC 触发原因,GC 持续时间,内存使用变化等详细信息。 -通过生成 GC 日志文件,我们可以获取应用程序在一段时间内应用的 GC 的执行情况。这个执行情况包括了每次 GC 的时间,原因,内存变化等。GC 日志格式多样,信息较多且专业,想要人工阅读分析的门槛较高。使用 GC 日志分析工具,用户不必自己阅读冗长繁杂的 GC 日志就能够迅速发现内存泄漏、长时间 GC 暂停、对象过早晋升以及许多其他影响性能的问题。 +通过生成 GC 日志文件,我们可以获取应用程序在一段时间内应用的 GC 的执行情况。这个执行情况包括了每次 GC 的时间,原因,内存变化等。GC +日志格式多样,信息较多且专业,想要人工阅读分析的门槛较高。使用 GC 日志分析工具,用户不必自己阅读冗长繁杂的 GC +日志就能够迅速发现内存泄漏、长时间 GC 暂停、对象过早晋升以及许多其他影响性能的问题。 -GC 日志分析还提供了对比两份 GC 日志或者对比一份 GC 日志两个不同时间段的 GC 指标的功能,这能够指导我们进行 GC 性能优化,了解变更对 GC 性能的影响。 +GC 日志分析还提供了对比两份 GC 日志或者对比一份 GC 日志两个不同时间段的 GC 指标的功能,这能够指导我们进行 GC 性能优化,了解变更对 +GC 性能的影响。 -总的来说,GC 日志分析是一种强大的工具,可以帮助开发人员诊断和解决 Java 应用程序中的内存泄漏、长时间 GC 暂停、对象过早晋升等。通过深入分析 GC 的执行情况,我们可以找出潜在的问题,并采取相应的优化措施。 +总的来说,GC 日志分析是一种强大的工具,可以帮助开发人员诊断和解决 Java 应用程序中的内存泄漏、长时间 GC 暂停、对象过早晋升等。通过深入分析 +GC 的执行情况,我们可以找出潜在的问题,并采取相应的优化措施。 ## 视图 diff --git a/site/docs/zh/guide/what-is-eclipse-jifa.md b/site/docs/zh/guide/what-is-eclipse-jifa.md index e4e68119..ee5e8d68 100644 --- a/site/docs/zh/guide/what-is-eclipse-jifa.md +++ b/site/docs/zh/guide/what-is-eclipse-jifa.md @@ -2,7 +2,8 @@ ## 简介 -Eclipse Jifa(简称 Jifa)中的 Jifa 由 “**J**ava **I**ssues **F**inding **A**ssistant” 的首字母组成。 项目起源于一个内部的在线系统,被设计用于提高生产环境 Java 应用堆泄漏等问题的排查效率。 +Eclipse Jifa(简称 Jifa)中的 Jifa 由 “**J**ava **I**ssues **F**inding **A**ssistant” 的首字母组成。 +项目起源于一个内部的在线系统,被设计用于提高生产环境 Java 应用堆泄漏等问题的排查效率。 目前主要包含以下功能: @@ -42,5 +43,5 @@ Eclipse Jifa(简称 Jifa)中的 Jifa 由 “**J**ava **I**ssues **F**inding ![Upload](../image/upload.jpeg) 3. 着手进行分析。 - + ![Upload](../image/heap-dump-analysis-overview.jpeg) \ No newline at end of file