Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
Yohann0617 committed Nov 14, 2024
1 parent f20f2cc commit 7599b9a
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 7 deletions.
14 changes: 9 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,17 @@

## 如何部署

推荐docker部署,出于安全问题建议使用Nginx反向代理配置HTTPS访问
推荐docker部署,出于安全考虑建议使用Nginx反向代理配置HTTPS访问

### 1. 新建目录

创建密钥文件存放目录,新增oci配置时只需输入密钥文件名称即可,默认会加上这个目录全路径。
```bash
mkdir -p /app/oci-helper/keys
```

### 2. 拷贝文件

复制`application.yml``oci-helper.db``/app/oci-helper`目录下。
复制`application.yml``oci-helper.db``/app/oci-helper`目录下,并修改`application.yml`部分配置

### 3. docker拉取镜像直接运行

Expand All @@ -37,8 +37,12 @@ yohannfan/oci-helper:latest

## 页面展示

![image.png](https://pic5.58cdn.com.cn/nowater/webim/big/n_v2095b0fdd8f7e4b7186d265cd261b6d81.png)
![image.png](https://pic1.58cdn.com.cn/nowater/webim/big/n_v26a2f3e2cd0ea4ac787723191f4f32f36.png)

![image.png](https://pic4.58cdn.com.cn/nowater/webim/big/n_v290443ddeb885445399561ab6eb1d7a09.png)

![image.png](https://pic1.58cdn.com.cn/nowater/webim/big/n_v2543323ea3d274c2ca435e2b5dcc3074f.png)

![image.png](https://pic3.58cdn.com.cn/nowater/webim/big/n_v2e3c93ccfcbd6442b8093d11fec370ee1.png)
![image.png](https://pic3.58cdn.com.cn/nowater/webim/big/n_v2e3c93ccfcbd6442b8093d11fec370ee1.png)

![image.png](https://pic7.58cdn.com.cn/nowater/webim/big/n_v2a47b5866e28344e695b25a84f568ba05.png)
Binary file modified oci-helper.db
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -195,8 +195,10 @@ synchronized public InstanceDetailDTO createInstanceData() {
instanceDetailDTO.setOut(true);
log.error("【开机任务】用户:[{}] ,区域:[{}] ,系统架构:[{}] 无法创建实例,配额已经超过限制~",
user.getUsername(), user.getOciCfg().getRegion(), user.getArchitecture());
// throw new OciException(ErrorEnum.LIMIT_EXCEEDED);
return instanceDetailDTO;
} else if (error.getStatusCode() == 429 && error.getMessage().contains(ErrorEnum.TOO_MANY_REQUESTS.getErrorType())){
log.warn("【开机任务】用户:[{}] ,区域:[{}] ,系统架构:[{}] 开机请求频繁,[{}]秒后将重试......",
user.getUsername(), user.getOciCfg().getRegion(), user.getArchitecture(), user.getInterval());
} else {
// clearAllDetails(computeClient, virtualNetworkClient, instanceFromBootVolume, instance, networkSecurityGroup,
// internetGateway, subnet, vcn);
Expand Down
1 change: 1 addition & 0 deletions src/main/java/com/yohann/ocihelper/enums/ErrorEnum.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
public enum ErrorEnum {

LIMIT_EXCEEDED(400, "LimitExceeded", "无法创建实例,配额已经超过免费额度"),
TOO_MANY_REQUESTS(429, "TooManyRequests", "请求频繁"),
CAPACITY(500, "Out of capacity", "Out of capacity"),
CAPACITY_HOST(500, "Out of host capacity", "Out of host capacity"),

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@

import com.yohann.ocihelper.mapper.OciUserMapper;

import java.io.File;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.*;
Expand Down Expand Up @@ -70,6 +71,8 @@ public class OciServiceImpl implements IOciService {
private String account;
@Value("${web.password}")
private String password;
@Value("${oci-cfg.key-dir-path}")
private String keyDirPath;

public final static ScheduledThreadPoolExecutor CREATE_INSTANCE_POOL = new ScheduledThreadPoolExecutor(
10,
Expand Down Expand Up @@ -128,7 +131,7 @@ public void addCfg(AddCfgParams params) {
.ociUserId(ociCfgMap.get(OciCfgEnum.OCI_CFG_USER_ID.getType()))
.ociFingerprint(ociCfgMap.get(OciCfgEnum.OCI_CFG_FINGERPRINT.getType()))
.ociRegion(ociCfgMap.get(OciCfgEnum.OCI_CFG_REGION.getType()))
.ociKeyPath(ociCfgMap.get(OciCfgEnum.OCI_CFG_KEY_FILE.getType()))
.ociKeyPath(keyDirPath + File.separator + ociCfgMap.get(OciCfgEnum.OCI_CFG_KEY_FILE.getType()))
.build();
try {
OracleInstanceFetcher ociFetcher = getOciFetcher(ociUser);
Expand Down
6 changes: 6 additions & 0 deletions src/main/resources/application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,16 @@ spring:
mybatis-plus:
mapper-locations: classpath*:com/yohann/ocihelper/mapper/xml/*.xml

# 密钥文件存放目录(如果是docker部署则不用修改)
oci-cfg:
key-dir-path: /app/oci-helper/keys

# web登录管理员账号密码
web:
account: admin
password: mypwd

# TG接收消息通知的机器人token和个人ID (可选)
tg-cfg:
token: xxxx:xxxx
chat-id: xxxxxx

0 comments on commit 7599b9a

Please sign in to comment.