Skip to content

Commit

Permalink
chore: rename rootUsername to adminUsername and rootPassword to admin…
Browse files Browse the repository at this point in the history
…Password
  • Loading branch information
D-D-H committed Oct 18, 2023
1 parent e4e0689 commit 5397af3
Show file tree
Hide file tree
Showing 9 changed files with 54 additions and 39 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -70,15 +71,15 @@ public UserServiceImpl(TransactionTemplate transactionTemplate,

@PostConstruct
private void init() {
if (config.getRootUsername() != null) {
Optional<LoginDataEntity> root = loginDataRepo.findByUsername(config.getRootUsername());
if (root.isPresent()) {
if (userRepo.count() == 0 && StringUtils.isNotBlank(config.getAdminUsername())) {
Optional<LoginDataEntity> 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;
}
}
Expand All @@ -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());
}

Expand Down
21 changes: 12 additions & 9 deletions site/docs/guide/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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

Expand All @@ -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

Expand Down
4 changes: 2 additions & 2 deletions site/docs/guide/contributing.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@
Contributions in various forms are welcome, including but not limited to:

- Bug reports and issue submissions

- New requirements or ideas

- Bug fixes

- Testing

- Documentation enhancement

- New features or improvements

## Code Format
Expand Down
6 changes: 3 additions & 3 deletions site/docs/guide/deployment.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`

Expand Down
5 changes: 3 additions & 2 deletions site/docs/guide/what-is-eclipse-jifa.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:

Expand Down Expand Up @@ -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)

Expand Down
16 changes: 10 additions & 6 deletions site/docs/zh/guide/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.<key>=<value>` 或指定配置文件进行设置。

Expand Down Expand Up @@ -142,17 +144,19 @@

默认值:true

## root-username
## admin-username

root 用户名
管理员账号的用户名

类型:String

默认值:root
默认值:admin

## root-password
如果设置为空,或已有注册用户则不会进行管理员账号注册

root 用户密码。
## admin-password

管理员账号的密码。

类型:String

Expand Down
13 changes: 9 additions & 4 deletions site/docs/zh/guide/gc-log-analysis.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 的执行情况,我们可以找出潜在的问题,并采取相应的优化措施。

## 视图

Expand Down
5 changes: 3 additions & 2 deletions site/docs/zh/guide/what-is-eclipse-jifa.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 应用堆泄漏等问题的排查效率。

目前主要包含以下功能:

Expand Down Expand Up @@ -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)

0 comments on commit 5397af3

Please sign in to comment.