Procházet zdrojové kódy

nacos持久化

master
wangjx před 3 roky
rodič
revize
7e63602280
5 změnil soubory, kde provedl 24 přidání a 13 odebrání
  1. +3
    -2
      Dockerfile
  2. +9
    -0
      sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/controller/AppController.java
  3. +2
    -1
      sentinel-dashboard/src/main/resources/application.properties
  4. +5
    -5
      sentinel-dashboard/src/main/resources/bootstrap-test.yaml
  5. +5
    -5
      sentinel-dashboard/src/main/resources/bootstrap.yaml

+ 3
- 2
Dockerfile Zobrazit soubor

@@ -1,11 +1,12 @@
FROM java:8
MAINTAINER king <1609724385@qq.com>
VOLUME /tmp
COPY sentinel-dashboard/target/sentinel-dashboard.jar sentinel_dashboard.jar
COPY sentinel-dashboard/target/sentinel-dashboard.jar app.jar
COPY --from=hengyunabc/arthas:latest /opt/arthas /opt/arthas
ENV TimeZone=Asia/Shanghai
ENV active=dev
ENV JAVA_OPTS="-Xmx512M -Xms512M"
RUN ln -snf /usr/share/zoneinfo/$TimeZone /etc/localtime && echo $TimeZone > /etc/timezone
#EXPOSE 8098
ENTRYPOINT java $JAVA_OPTS -Dserver.port=7777 -Dcsp.sentinel.dashboard.server=$IP:7777 -Dproject.name=sentinel-dashboard -Dsentinel.dashboard.auth.username=telpo -Dsentinel.dashboard.auth.password=telpo#1234 -jar /sentinel_dashboard.jar --spring.profiles.active=$active
ENTRYPOINT java $JAVA_OPTS -Dserver.port=7777 -Dcsp.sentinel.dashboard.server=$IP:7777 -Dproject
.name=sentinel-dashboard -Dsentinel.dashboard.auth.username=telpo -Dsentinel.dashboard.auth.password=telpo#1234 -jar /app.jar --spring.profiles.active=$active

+ 9
- 0
sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/controller/AppController.java Zobrazit soubor

@@ -27,6 +27,8 @@ import com.alibaba.csp.sentinel.dashboard.discovery.AppManagement;
import com.alibaba.csp.sentinel.dashboard.discovery.MachineInfo;
import com.alibaba.csp.sentinel.dashboard.domain.Result;
import com.alibaba.csp.sentinel.dashboard.domain.vo.MachineInfoVo;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
@@ -41,9 +43,16 @@ import org.springframework.web.bind.annotation.RestController;
@RequestMapping(value = "/app")
public class AppController {

@Autowired
private static Logger logger = LoggerFactory.getLogger(AppController.class);
@Autowired
private AppManagement appManagement;

@GetMapping("/app.json")
public Result<List<String>> queryApp(HttpServletRequest request) {
return Result.ofSuccess(appManagement.getAppNames());
}

@GetMapping("/names.json")
public Result<List<String>> queryApps(HttpServletRequest request) {
return Result.ofSuccess(appManagement.getAppNames());


+ 2
- 1
sentinel-dashboard/src/main/resources/application.properties Zobrazit soubor

@@ -7,7 +7,8 @@ spring.http.encoding.enabled=true
server.servlet.session.cookie.name=sentinel_dashboard_cookie

#logging settings
logging.level.org.springframework.web=INFO
logging.level.org.springframework.web=DEBUG
#logging.file=${user.home}/logs/csp/sentinel-dashboard.log
logging.file=${user.home}/logs/csp/sentinel-dashboard.log
logging.pattern.file= %d{yyyy-MM-dd HH:mm:ss} [%thread] %-5level %logger{36} - %msg%n
#logging.pattern.console= %d{yyyy-MM-dd HH:mm:ss} [%thread] %-5level %logger{36} - %msg%n


+ 5
- 5
sentinel-dashboard/src/main/resources/bootstrap-test.yaml Zobrazit soubor

@@ -13,8 +13,8 @@ spring:
port: 8719
datasource:
- nacos:
server-addr: 172.19.42.44:8848
data-id: ${spring.application.name}-sentinel-flow
group-id: DEFAULT_GROUP
data-type: json
rule-type: flow
server-addr: 172.19.42.44:8848
data-id: ${spring.application.name}-sentinel-flow
group-id: DEFAULT_GROUP
data-type: json
rule-type: flow

+ 5
- 5
sentinel-dashboard/src/main/resources/bootstrap.yaml Zobrazit soubor

@@ -12,8 +12,8 @@ spring:
dashboard: 172.19.192.44:7777
datasource:
- nacos:
server-addr: 172.19.42.44:8848
data-id: ${spring.application.name}-sentinel-flow
group-id: DEFAULT_GROUP
data-type: json
rule-type: flow
server-addr: 172.19.42.44:8848
data-id: ${spring.application.name}-sentinel-flow
group-id: DEFAULT_GROUP
data-type: json
rule-type: flow

Načítá se…
Zrušit
Uložit