From f9b5a861d707016e9e39582561e6ff6b0d0003f3 Mon Sep 17 00:00:00 2001 From: "youji.zzl" Date: Thu, 21 Sep 2023 14:57:20 +0800 Subject: [PATCH 1/6] add plugin for base --- sofa-serverless-runtime/Formatter.xml | 278 ++++++++++++++++++ .../HEADER | 0 .../pom.xml | 127 +++++--- .../sofa-serverless-app-starter/pom.xml | 27 ++ .../java/com/alipay/sofa/serverless/.gitkeep | 0 .../src/main/resources/.gitkeep | 0 .../sofa-serverless-base-common/pom.xml | 38 +++ .../serverless/common/BizRuntimeContext.java | 76 +++++ .../common/BizRuntimeContextRegistry.java | 69 +++++ .../environment/ConditionalOnMasterBiz.java | 36 +++ .../ConditionalOnNotMasterBiz.java | 37 +++ .../common/environment/OnMasterBiz.java | 41 +++ .../common/environment/OnNotMasterBiz.java | 41 +++ .../common/exception/BizRuntimeException.java | 36 +++ .../common/exception/ErrorCodes.java | 32 ++ .../sofa-serverless-base-plugin/pom.xml | 62 ++++ .../plugin/BaseRuntimeAutoConfiguration.java | 36 +++ .../plugin/ServerlessRuntimeActivator.java | 46 +++ .../ApplicationContextEventHandler.java | 39 +++ .../handler/BeforeBizStartupEventHandler.java | 37 +++ .../handler/BizUninstallEventHandler.java | 46 +++ .../main/resources/META-INF/spring.factories | 4 + .../sofa-serverless-base-starter/pom.xml | 38 +++ 23 files changed, 1103 insertions(+), 43 deletions(-) create mode 100644 sofa-serverless-runtime/Formatter.xml rename {sofa-serverless-runtime-starter => sofa-serverless-runtime}/HEADER (100%) rename {sofa-serverless-runtime-starter => sofa-serverless-runtime}/pom.xml (79%) create mode 100644 sofa-serverless-runtime/sofa-serverless-app-starter/pom.xml create mode 100644 sofa-serverless-runtime/sofa-serverless-app-starter/src/main/java/com/alipay/sofa/serverless/.gitkeep create mode 100644 sofa-serverless-runtime/sofa-serverless-app-starter/src/main/resources/.gitkeep create mode 100644 sofa-serverless-runtime/sofa-serverless-base-common/pom.xml create mode 100644 sofa-serverless-runtime/sofa-serverless-base-common/src/main/java/com/alipay/sofa/serverless/common/BizRuntimeContext.java create mode 100644 sofa-serverless-runtime/sofa-serverless-base-common/src/main/java/com/alipay/sofa/serverless/common/BizRuntimeContextRegistry.java create mode 100644 sofa-serverless-runtime/sofa-serverless-base-common/src/main/java/com/alipay/sofa/serverless/common/environment/ConditionalOnMasterBiz.java create mode 100644 sofa-serverless-runtime/sofa-serverless-base-common/src/main/java/com/alipay/sofa/serverless/common/environment/ConditionalOnNotMasterBiz.java create mode 100644 sofa-serverless-runtime/sofa-serverless-base-common/src/main/java/com/alipay/sofa/serverless/common/environment/OnMasterBiz.java create mode 100644 sofa-serverless-runtime/sofa-serverless-base-common/src/main/java/com/alipay/sofa/serverless/common/environment/OnNotMasterBiz.java create mode 100644 sofa-serverless-runtime/sofa-serverless-base-common/src/main/java/com/alipay/sofa/serverless/common/exception/BizRuntimeException.java create mode 100644 sofa-serverless-runtime/sofa-serverless-base-common/src/main/java/com/alipay/sofa/serverless/common/exception/ErrorCodes.java create mode 100644 sofa-serverless-runtime/sofa-serverless-base-plugin/pom.xml create mode 100644 sofa-serverless-runtime/sofa-serverless-base-plugin/src/main/java/com/alipay/sofa/serverless/plugin/BaseRuntimeAutoConfiguration.java create mode 100644 sofa-serverless-runtime/sofa-serverless-base-plugin/src/main/java/com/alipay/sofa/serverless/plugin/ServerlessRuntimeActivator.java create mode 100644 sofa-serverless-runtime/sofa-serverless-base-plugin/src/main/java/com/alipay/sofa/serverless/plugin/manager/handler/ApplicationContextEventHandler.java create mode 100644 sofa-serverless-runtime/sofa-serverless-base-plugin/src/main/java/com/alipay/sofa/serverless/plugin/manager/handler/BeforeBizStartupEventHandler.java create mode 100644 sofa-serverless-runtime/sofa-serverless-base-plugin/src/main/java/com/alipay/sofa/serverless/plugin/manager/handler/BizUninstallEventHandler.java create mode 100644 sofa-serverless-runtime/sofa-serverless-base-plugin/src/main/resources/META-INF/spring.factories create mode 100644 sofa-serverless-runtime/sofa-serverless-base-starter/pom.xml diff --git a/sofa-serverless-runtime/Formatter.xml b/sofa-serverless-runtime/Formatter.xml new file mode 100644 index 000000000..1dc905447 --- /dev/null +++ b/sofa-serverless-runtime/Formatter.xml @@ -0,0 +1,278 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/sofa-serverless-runtime-starter/HEADER b/sofa-serverless-runtime/HEADER similarity index 100% rename from sofa-serverless-runtime-starter/HEADER rename to sofa-serverless-runtime/HEADER diff --git a/sofa-serverless-runtime-starter/pom.xml b/sofa-serverless-runtime/pom.xml similarity index 79% rename from sofa-serverless-runtime-starter/pom.xml rename to sofa-serverless-runtime/pom.xml index 1d0954718..1325d1c47 100644 --- a/sofa-serverless-runtime-starter/pom.xml +++ b/sofa-serverless-runtime/pom.xml @@ -3,9 +3,10 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> com.alipay.sofa.serverless - sofa-serverless-runtime-starter + sofa-serverless-runtime ${revision} 4.0.0 + pom 0.1.3 @@ -23,7 +24,7 @@ 8 8 1.5.0 - + 2.7.15 2.2.3 0.3.2 @@ -60,48 +61,88 @@ http://github.com/sofastack/sofa-serverless/tree/master - - - - com.alipay.sofa - sofa-ark-all - ${sofa.ark.version} - - - ch.qos.logback - logback-core - - - ch.qos.logback - logback-classic - - - - - com.alipay.sofa - sofa-ark-springboot-starter - ${sofa.ark.version} - - - com.alipay.sofa - sofa-ark-compatible-springboot1 - - - com.alipay.sofa - sofa-ark-compatible-springboot2 - - - - + + sofa-serverless-base-common + sofa-serverless-base-starter + sofa-serverless-base-plugin + sofa-serverless-app-starter + + + + + + com.alipay.sofa.serverless + sofa-serverless-base-common + ${revision} + + + com.alipay.sofa.serverless + sofa-serverless-base-starter + ${revision} + + + com.alipay.sofa.serverless + sofa-serverless-base-plugin + ${revision} + + + + + com.alipay.sofa + sofa-ark-all + ${sofa.ark.version} + + + ch.qos.logback + logback-core + + + ch.qos.logback + logback-classic + + + + + com.alipay.sofa + sofa-ark-spi + ${sofa.ark.version} + + + com.alipay.sofa + sofa-ark-api + ${sofa.ark.version} + + + com.alipay.sofa + sofa-ark-springboot-starter + ${sofa.ark.version} + + + com.alipay.sofa + sofa-ark-compatible-springboot1 + + + com.alipay.sofa + sofa-ark-compatible-springboot2 + + + + - - - com.alipay.sofa.serverless - arklet-springboot-starter - ${sofa.serverless.arklet.version} - - - + + + com.alipay.sofa.serverless + arklet-springboot-starter + ${sofa.serverless.arklet.version} + + + + org.springframework.boot + spring-boot-starter-actuator + ${spring.boot.version} + + + diff --git a/sofa-serverless-runtime/sofa-serverless-app-starter/pom.xml b/sofa-serverless-runtime/sofa-serverless-app-starter/pom.xml new file mode 100644 index 000000000..7eedb4842 --- /dev/null +++ b/sofa-serverless-runtime/sofa-serverless-app-starter/pom.xml @@ -0,0 +1,27 @@ + + + 4.0.0 + + com.alipay.sofa.serverless + sofa-serverless-runtime + 0.1.3 + + + sofa-serverless-app-starter + + + 8 + 8 + UTF-8 + + + + + com.alipay.sofa.serverless + sofa-serverless-base-common + + + + \ No newline at end of file diff --git a/sofa-serverless-runtime/sofa-serverless-app-starter/src/main/java/com/alipay/sofa/serverless/.gitkeep b/sofa-serverless-runtime/sofa-serverless-app-starter/src/main/java/com/alipay/sofa/serverless/.gitkeep new file mode 100644 index 000000000..e69de29bb diff --git a/sofa-serverless-runtime/sofa-serverless-app-starter/src/main/resources/.gitkeep b/sofa-serverless-runtime/sofa-serverless-app-starter/src/main/resources/.gitkeep new file mode 100644 index 000000000..e69de29bb diff --git a/sofa-serverless-runtime/sofa-serverless-base-common/pom.xml b/sofa-serverless-runtime/sofa-serverless-base-common/pom.xml new file mode 100644 index 000000000..282c3463a --- /dev/null +++ b/sofa-serverless-runtime/sofa-serverless-base-common/pom.xml @@ -0,0 +1,38 @@ + + + + sofa-serverless-runtime + com.alipay.sofa.serverless + ${revision} + ../pom.xml + + 4.0.0 + sofa-serverless-base-common + ${revision} + + + 8 + 8 + UTF-8 + + + + + com.alipay.sofa + sofa-ark-spi + provided + + + com.alipay.sofa + sofa-ark-api + provided + + + org.springframework.boot + spring-boot-starter-actuator + + + + \ No newline at end of file diff --git a/sofa-serverless-runtime/sofa-serverless-base-common/src/main/java/com/alipay/sofa/serverless/common/BizRuntimeContext.java b/sofa-serverless-runtime/sofa-serverless-base-common/src/main/java/com/alipay/sofa/serverless/common/BizRuntimeContext.java new file mode 100644 index 000000000..7aa43c88c --- /dev/null +++ b/sofa-serverless-runtime/sofa-serverless-base-common/src/main/java/com/alipay/sofa/serverless/common/BizRuntimeContext.java @@ -0,0 +1,76 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.alipay.sofa.serverless.common; + +import com.alipay.sofa.ark.spi.model.Biz; +import com.alipay.sofa.serverless.common.exception.BizRuntimeException; +import com.alipay.sofa.serverless.common.exception.ErrorCodes; +import org.springframework.context.ApplicationContext; +import org.springframework.context.support.AbstractApplicationContext; + +public class BizRuntimeContext { + + private String bizName; + + private ClassLoader appClassLoader; + + private ApplicationContext rootApplicationContext; + + public String getBizName() { + return bizName; + } + + public void setBizName(String bizName) { + this.bizName = bizName; + } + + public ClassLoader getAppClassLoader() { + return appClassLoader; + } + + public void setAppClassLoader(ClassLoader appClassLoader) { + this.appClassLoader = appClassLoader; + } + + public ApplicationContext getRootApplicationContext() { + return rootApplicationContext; + } + + public void setRootApplicationContext(ApplicationContext rootApplicationContext) { + this.rootApplicationContext = rootApplicationContext; + } + + public BizRuntimeContext(Biz biz, ApplicationContext applicationContext) { + this.bizName = biz.getBizName(); + this.appClassLoader = biz.getBizClassLoader(); + this.rootApplicationContext = applicationContext; + } + + public void shutdown() { + try { + AbstractApplicationContext applicationContext = (AbstractApplicationContext) rootApplicationContext; + // only need shutdown when root context is active + if (applicationContext.isActive()) { + applicationContext.close(); + } + appClassLoader = null; + } catch (Throwable throwable) { + throw new BizRuntimeException(ErrorCodes.SpringContextManager.E100001, throwable); + } + } + +} diff --git a/sofa-serverless-runtime/sofa-serverless-base-common/src/main/java/com/alipay/sofa/serverless/common/BizRuntimeContextRegistry.java b/sofa-serverless-runtime/sofa-serverless-base-common/src/main/java/com/alipay/sofa/serverless/common/BizRuntimeContextRegistry.java new file mode 100644 index 000000000..d7909d87c --- /dev/null +++ b/sofa-serverless-runtime/sofa-serverless-base-common/src/main/java/com/alipay/sofa/serverless/common/BizRuntimeContextRegistry.java @@ -0,0 +1,69 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.alipay.sofa.serverless.common; + +import com.alipay.sofa.ark.spi.model.Biz; +import com.alipay.sofa.serverless.common.exception.BizRuntimeException; +import com.alipay.sofa.serverless.common.exception.ErrorCodes; + +import java.util.Collections; +import java.util.Set; +import java.util.concurrent.ConcurrentHashMap; +import java.util.concurrent.CopyOnWriteArraySet; + +public class BizRuntimeContextRegistry { + private static ConcurrentHashMap contextMap = new ConcurrentHashMap<>(); + + public static void registerSpringContext(BizRuntimeContext bizRuntimeContext) { + contextMap.put(bizRuntimeContext.getAppClassLoader(), bizRuntimeContext); + } + + public static void unRegisterSofaRuntimeManager(BizRuntimeContext sofaRuntimeManager) { + contextMap.remove(sofaRuntimeManager.getAppClassLoader()); + } + + public static Set getRuntimeSet() { + return Collections.unmodifiableSet(new CopyOnWriteArraySet<>(contextMap.values())); + } + + public static ConcurrentHashMap getRuntimeMap() { + return contextMap; + } + + /** + * 获取 biz 对应的 SofaRuntimeManager + * @param biz + * @return + */ + public static BizRuntimeContext getBizRuntimeContext(Biz biz) { + if (BizRuntimeContextRegistry.getRuntimeMap().containsKey(biz.getBizClassLoader())) { + return BizRuntimeContextRegistry.getRuntimeMap().get(biz.getBizClassLoader()); + } + + throw new BizRuntimeException(ErrorCodes.SpringContextManager.E100002, + "No BizRuntimeContext found for biz: " + biz.getBizName()); + } + + public static BizRuntimeContext getBizRuntimeContextByClassLoader(ClassLoader classLoader) { + if (BizRuntimeContextRegistry.getRuntimeMap().containsKey(classLoader)) { + return BizRuntimeContextRegistry.getRuntimeMap().get(classLoader); + } + + throw new BizRuntimeException(ErrorCodes.SpringContextManager.E100002, + "No BizRuntimeContext found for classLoader: " + classLoader); + } +} diff --git a/sofa-serverless-runtime/sofa-serverless-base-common/src/main/java/com/alipay/sofa/serverless/common/environment/ConditionalOnMasterBiz.java b/sofa-serverless-runtime/sofa-serverless-base-common/src/main/java/com/alipay/sofa/serverless/common/environment/ConditionalOnMasterBiz.java new file mode 100644 index 000000000..7f696b76e --- /dev/null +++ b/sofa-serverless-runtime/sofa-serverless-base-common/src/main/java/com/alipay/sofa/serverless/common/environment/ConditionalOnMasterBiz.java @@ -0,0 +1,36 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.alipay.sofa.serverless.common.environment; + +import org.springframework.context.annotation.Conditional; + +import java.lang.annotation.Documented; +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +/** + * @author mingmen + * @date 2023/6/14 + */ +@Target({ ElementType.TYPE, ElementType.METHOD }) +@Retention(RetentionPolicy.RUNTIME) +@Documented +@Conditional(OnMasterBiz.class) +public @interface ConditionalOnMasterBiz { +} diff --git a/sofa-serverless-runtime/sofa-serverless-base-common/src/main/java/com/alipay/sofa/serverless/common/environment/ConditionalOnNotMasterBiz.java b/sofa-serverless-runtime/sofa-serverless-base-common/src/main/java/com/alipay/sofa/serverless/common/environment/ConditionalOnNotMasterBiz.java new file mode 100644 index 000000000..7f5a4d9bc --- /dev/null +++ b/sofa-serverless-runtime/sofa-serverless-base-common/src/main/java/com/alipay/sofa/serverless/common/environment/ConditionalOnNotMasterBiz.java @@ -0,0 +1,37 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.alipay.sofa.serverless.common.environment; + +import org.springframework.context.annotation.Conditional; + +import java.lang.annotation.Documented; +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +/** + * @author mingmen + * @date 2023/6/14 + * 模块biz才满足条件 + */ +@Target({ ElementType.TYPE, ElementType.METHOD }) +@Retention(RetentionPolicy.RUNTIME) +@Documented +@Conditional(OnNotMasterBiz.class) +public @interface ConditionalOnNotMasterBiz { +} diff --git a/sofa-serverless-runtime/sofa-serverless-base-common/src/main/java/com/alipay/sofa/serverless/common/environment/OnMasterBiz.java b/sofa-serverless-runtime/sofa-serverless-base-common/src/main/java/com/alipay/sofa/serverless/common/environment/OnMasterBiz.java new file mode 100644 index 000000000..f06f70c46 --- /dev/null +++ b/sofa-serverless-runtime/sofa-serverless-base-common/src/main/java/com/alipay/sofa/serverless/common/environment/OnMasterBiz.java @@ -0,0 +1,41 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.alipay.sofa.serverless.common.environment; + +import org.springframework.boot.autoconfigure.condition.ConditionOutcome; +import org.springframework.boot.autoconfigure.condition.SpringBootCondition; +import org.springframework.context.annotation.ConditionContext; +import org.springframework.core.type.AnnotatedTypeMetadata; + +/** + * @author mingmen + * @date 2023/6/14 + */ +public class OnMasterBiz extends SpringBootCondition { + + private static final String BIZ_CLASSLOADER = "com.alipay.sofa.ark.container.service.classloader.BizClassLoader"; + + @Override + public ConditionOutcome getMatchOutcome(ConditionContext context, AnnotatedTypeMetadata metadata) { + ClassLoader contextClassLoader = Thread.currentThread().getContextClassLoader(); + if (contextClassLoader == null + || BIZ_CLASSLOADER.equals(contextClassLoader.getClass().getName())) { + return new ConditionOutcome(false, "Current context classloader is biz classloader."); + } + return new ConditionOutcome(true, "Current context classloader is not biz classloader."); + } +} diff --git a/sofa-serverless-runtime/sofa-serverless-base-common/src/main/java/com/alipay/sofa/serverless/common/environment/OnNotMasterBiz.java b/sofa-serverless-runtime/sofa-serverless-base-common/src/main/java/com/alipay/sofa/serverless/common/environment/OnNotMasterBiz.java new file mode 100644 index 000000000..9529b99c5 --- /dev/null +++ b/sofa-serverless-runtime/sofa-serverless-base-common/src/main/java/com/alipay/sofa/serverless/common/environment/OnNotMasterBiz.java @@ -0,0 +1,41 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.alipay.sofa.serverless.common.environment; + +import org.springframework.boot.autoconfigure.condition.ConditionOutcome; +import org.springframework.boot.autoconfigure.condition.SpringBootCondition; +import org.springframework.context.annotation.ConditionContext; +import org.springframework.core.type.AnnotatedTypeMetadata; + +/** + * @author mingmen + * @date 2023/6/14 + */ +public class OnNotMasterBiz extends SpringBootCondition { + + private static final String BIZ_CLASSLOADER = "com.alipay.sofa.ark.container.service.classloader.BizClassLoader"; + + @Override + public ConditionOutcome getMatchOutcome(ConditionContext context, AnnotatedTypeMetadata metadata) { + ClassLoader contextClassLoader = Thread.currentThread().getContextClassLoader(); + if (contextClassLoader == null + || BIZ_CLASSLOADER.equals(contextClassLoader.getClass().getName())) { + return new ConditionOutcome(true, "Current context classloader is biz classloader."); + } + return new ConditionOutcome(false, "Current context classloader is not biz classloader."); + } +} diff --git a/sofa-serverless-runtime/sofa-serverless-base-common/src/main/java/com/alipay/sofa/serverless/common/exception/BizRuntimeException.java b/sofa-serverless-runtime/sofa-serverless-base-common/src/main/java/com/alipay/sofa/serverless/common/exception/BizRuntimeException.java new file mode 100644 index 000000000..b4bfa7379 --- /dev/null +++ b/sofa-serverless-runtime/sofa-serverless-base-common/src/main/java/com/alipay/sofa/serverless/common/exception/BizRuntimeException.java @@ -0,0 +1,36 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.alipay.sofa.serverless.common.exception; + +public class BizRuntimeException extends RuntimeException { + private String errorCode; + + public BizRuntimeException(String errorCode, String message) { + super(message); + this.errorCode = errorCode; + } + + public BizRuntimeException(String errorCode, Throwable cause) { + super(cause); + this.errorCode = errorCode; + } + + public BizRuntimeException(String errorCode, String message, Throwable cause) { + super(message, cause); + this.errorCode = errorCode; + } +} diff --git a/sofa-serverless-runtime/sofa-serverless-base-common/src/main/java/com/alipay/sofa/serverless/common/exception/ErrorCodes.java b/sofa-serverless-runtime/sofa-serverless-base-common/src/main/java/com/alipay/sofa/serverless/common/exception/ErrorCodes.java new file mode 100644 index 000000000..4526a6cbe --- /dev/null +++ b/sofa-serverless-runtime/sofa-serverless-base-common/src/main/java/com/alipay/sofa/serverless/common/exception/ErrorCodes.java @@ -0,0 +1,32 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.alipay.sofa.serverless.common.exception; + +public class ErrorCodes { + + public static class SpringContextManager { + /** + * 模块 SpringContext 关闭失败 + */ + public static final String E100001 = "100001"; + + /** + * 模块 SpringContext 找不到 + */ + public static final String E100002 = "100002"; + } +} diff --git a/sofa-serverless-runtime/sofa-serverless-base-plugin/pom.xml b/sofa-serverless-runtime/sofa-serverless-base-plugin/pom.xml new file mode 100644 index 000000000..58ec844b3 --- /dev/null +++ b/sofa-serverless-runtime/sofa-serverless-base-plugin/pom.xml @@ -0,0 +1,62 @@ + + + + sofa-serverless-runtime + com.alipay.sofa.serverless + ${revision} + ../pom.xml + + 4.0.0 + sofa-serverless-base-plugin + ${revision} + + + + com.alipay.sofa + sofa-ark-spi + provided + + + com.alipay.sofa + sofa-ark-api + provided + + + org.springframework.boot + spring-boot-starter-actuator + + + com.alipay.sofa.serverless + sofa-serverless-base-common + + + + + + + com.alipay.sofa + sofa-ark-plugin-maven-plugin + ${sofa.ark.version} + + + default-cli + + ark-plugin + + + + com.alipay.sofa.serverless.plugin.ServerlessRuntimeActivator + + + + + + + + + + + + \ No newline at end of file diff --git a/sofa-serverless-runtime/sofa-serverless-base-plugin/src/main/java/com/alipay/sofa/serverless/plugin/BaseRuntimeAutoConfiguration.java b/sofa-serverless-runtime/sofa-serverless-base-plugin/src/main/java/com/alipay/sofa/serverless/plugin/BaseRuntimeAutoConfiguration.java new file mode 100644 index 000000000..44452f45f --- /dev/null +++ b/sofa-serverless-runtime/sofa-serverless-base-plugin/src/main/java/com/alipay/sofa/serverless/plugin/BaseRuntimeAutoConfiguration.java @@ -0,0 +1,36 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.alipay.sofa.serverless.plugin; + +import com.alipay.sofa.serverless.common.environment.ConditionalOnNotMasterBiz; +import com.alipay.sofa.serverless.plugin.manager.handler.ApplicationContextEventHandler; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; + +/** + * @author mingmen + * @date 2023/6/14 + */ +@Configuration +public class BaseRuntimeAutoConfiguration { + + @Bean + @ConditionalOnNotMasterBiz + public ApplicationContextEventHandler applicationContextEventHandler() { + return new ApplicationContextEventHandler(); + } +} diff --git a/sofa-serverless-runtime/sofa-serverless-base-plugin/src/main/java/com/alipay/sofa/serverless/plugin/ServerlessRuntimeActivator.java b/sofa-serverless-runtime/sofa-serverless-base-plugin/src/main/java/com/alipay/sofa/serverless/plugin/ServerlessRuntimeActivator.java new file mode 100644 index 000000000..1befb65f7 --- /dev/null +++ b/sofa-serverless-runtime/sofa-serverless-base-plugin/src/main/java/com/alipay/sofa/serverless/plugin/ServerlessRuntimeActivator.java @@ -0,0 +1,46 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.alipay.sofa.serverless.plugin; + +import com.alipay.sofa.ark.spi.model.PluginContext; +import com.alipay.sofa.ark.spi.service.PluginActivator; +import com.alipay.sofa.ark.spi.service.event.EventAdminService; +import com.alipay.sofa.serverless.plugin.manager.handler.BeforeBizStartupEventHandler; +import com.alipay.sofa.serverless.plugin.manager.handler.BizUninstallEventHandler; + +/** + * @author qilong.zql + * @since 2.5.0 + */ +public class ServerlessRuntimeActivator implements PluginActivator { + @Override + public void start(PluginContext context) { + registerEventHandler(context); + } + + private void registerEventHandler(final PluginContext context) { + EventAdminService eventAdminService = context.referenceService(EventAdminService.class) + .getService(); + eventAdminService.register(new BizUninstallEventHandler()); + eventAdminService.register(new BeforeBizStartupEventHandler()); + } + + @Override + public void stop(PluginContext context) { + // no op + } +} \ No newline at end of file diff --git a/sofa-serverless-runtime/sofa-serverless-base-plugin/src/main/java/com/alipay/sofa/serverless/plugin/manager/handler/ApplicationContextEventHandler.java b/sofa-serverless-runtime/sofa-serverless-base-plugin/src/main/java/com/alipay/sofa/serverless/plugin/manager/handler/ApplicationContextEventHandler.java new file mode 100644 index 000000000..491f56fb3 --- /dev/null +++ b/sofa-serverless-runtime/sofa-serverless-base-plugin/src/main/java/com/alipay/sofa/serverless/plugin/manager/handler/ApplicationContextEventHandler.java @@ -0,0 +1,39 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.alipay.sofa.serverless.plugin.manager.handler; + +import com.alipay.sofa.serverless.common.BizRuntimeContext; +import com.alipay.sofa.serverless.common.BizRuntimeContextRegistry; +import org.springframework.beans.BeansException; +import org.springframework.context.ApplicationContext; +import org.springframework.context.ApplicationContextAware; +import org.springframework.stereotype.Service; + +/** + * TODO: 需要更改成只有在模块里才注册成bean + */ +@Service +public class ApplicationContextEventHandler implements ApplicationContextAware { + + @Override + public void setApplicationContext(ApplicationContext applicationContext) throws BeansException { + BizRuntimeContext bizRuntimeContext = BizRuntimeContextRegistry + .getBizRuntimeContextByClassLoader(applicationContext.getClassLoader()); + BizRuntimeContextRegistry.unRegisterSofaRuntimeManager(bizRuntimeContext); + bizRuntimeContext.setRootApplicationContext(applicationContext); + } +} \ No newline at end of file diff --git a/sofa-serverless-runtime/sofa-serverless-base-plugin/src/main/java/com/alipay/sofa/serverless/plugin/manager/handler/BeforeBizStartupEventHandler.java b/sofa-serverless-runtime/sofa-serverless-base-plugin/src/main/java/com/alipay/sofa/serverless/plugin/manager/handler/BeforeBizStartupEventHandler.java new file mode 100644 index 000000000..28213d650 --- /dev/null +++ b/sofa-serverless-runtime/sofa-serverless-base-plugin/src/main/java/com/alipay/sofa/serverless/plugin/manager/handler/BeforeBizStartupEventHandler.java @@ -0,0 +1,37 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.alipay.sofa.serverless.plugin.manager.handler; + +import com.alipay.sofa.ark.spi.event.biz.BeforeBizStartupEvent; +import com.alipay.sofa.ark.spi.model.Biz; +import com.alipay.sofa.ark.spi.service.event.EventHandler; +import com.alipay.sofa.serverless.common.BizRuntimeContext; +import com.alipay.sofa.serverless.common.BizRuntimeContextRegistry; + +public class BeforeBizStartupEventHandler implements EventHandler { + @Override + public void handleEvent(BeforeBizStartupEvent beforeBizStartupEvent) { + Biz biz = beforeBizStartupEvent.getSource(); + // can't get applicationContext here, so register a empty applicationContext + BizRuntimeContextRegistry.registerSpringContext(new BizRuntimeContext(biz, null)); + } + + @Override + public int getPriority() { + return 0; + } +} diff --git a/sofa-serverless-runtime/sofa-serverless-base-plugin/src/main/java/com/alipay/sofa/serverless/plugin/manager/handler/BizUninstallEventHandler.java b/sofa-serverless-runtime/sofa-serverless-base-plugin/src/main/java/com/alipay/sofa/serverless/plugin/manager/handler/BizUninstallEventHandler.java new file mode 100644 index 000000000..130e5ffe7 --- /dev/null +++ b/sofa-serverless-runtime/sofa-serverless-base-plugin/src/main/java/com/alipay/sofa/serverless/plugin/manager/handler/BizUninstallEventHandler.java @@ -0,0 +1,46 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.alipay.sofa.serverless.plugin.manager.handler; + +import com.alipay.sofa.ark.spi.event.biz.BeforeBizStopEvent; +import com.alipay.sofa.ark.spi.model.Biz; +import com.alipay.sofa.ark.spi.service.PriorityOrdered; +import com.alipay.sofa.ark.spi.service.event.EventHandler; +import com.alipay.sofa.serverless.common.BizRuntimeContext; +import com.alipay.sofa.serverless.common.BizRuntimeContextRegistry; + +/** + * @author qilong.zql + * @since 2.5.0 + */ +public class BizUninstallEventHandler implements EventHandler { + + @Override + public void handleEvent(BeforeBizStopEvent event) { + doUninstallBiz(event.getSource()); + } + + private void doUninstallBiz(Biz biz) { + BizRuntimeContext bizRuntimeContext = BizRuntimeContextRegistry.getBizRuntimeContext(biz); + bizRuntimeContext.shutdown(); + } + + @Override + public int getPriority() { + return PriorityOrdered.DEFAULT_PRECEDENCE; + } +} diff --git a/sofa-serverless-runtime/sofa-serverless-base-plugin/src/main/resources/META-INF/spring.factories b/sofa-serverless-runtime/sofa-serverless-base-plugin/src/main/resources/META-INF/spring.factories new file mode 100644 index 000000000..bbaaef622 --- /dev/null +++ b/sofa-serverless-runtime/sofa-serverless-base-plugin/src/main/resources/META-INF/spring.factories @@ -0,0 +1,4 @@ +org.springframework.boot.autoconfigure.EnableAutoConfiguration=\ + com.alipay.sofa.serverless.plugin.BaseRuntimeAutoConfiguration + + diff --git a/sofa-serverless-runtime/sofa-serverless-base-starter/pom.xml b/sofa-serverless-runtime/sofa-serverless-base-starter/pom.xml new file mode 100644 index 000000000..0a75bf765 --- /dev/null +++ b/sofa-serverless-runtime/sofa-serverless-base-starter/pom.xml @@ -0,0 +1,38 @@ + + + + sofa-serverless-runtime + com.alipay.sofa.serverless + ${revision} + ../pom.xml + + sofa-serverless-base-starter + ${revision} + 4.0.0 + + + + + com.alipay.sofa + sofa-ark-all + + + com.alipay.sofa + sofa-ark-springboot-starter + + + + + + com.alipay.sofa.serverless + arklet-springboot-starter + + + com.alipay.sofa.serverless + sofa-serverless-base-plugin + + + + \ No newline at end of file From b8584907adc59bf33c17630eff0df3d0ffd78cec Mon Sep 17 00:00:00 2001 From: "youji.zzl" Date: Thu, 21 Sep 2023 16:37:49 +0800 Subject: [PATCH 2/6] move arklet to runtime --- arklet/Formatter.xml | 278 ---------- arklet/HEADER | 14 - arklet/README.md | 428 ---------------- .../environment/ConditionalOnMasterBiz.java | 36 -- .../starter/environment/OnMasterBiz.java | 41 -- arklet/check_format.sh | 13 - arklet/integration-tests/.gitignore | 0 arklet/pom.xml | 475 ------------------ .../arklet-core/pom.xml | 2 +- .../arklet/core/ArkletComponent.java | 0 .../arklet/core/ArkletComponentRegistry.java | 0 .../serverless/arklet/core/api/ApiClient.java | 0 .../arklet/core/api/model/Response.java | 0 .../arklet/core/api/model/ResponseCode.java | 0 .../arklet/core/api/tunnel/Tunnel.java | 0 .../core/api/tunnel/http/HttpTunnel.java | 0 .../tunnel/http/netty/NettyHttpServer.java | 0 .../tunnel/http/netty/RequestValidation.java | 0 .../arklet/core/command/CommandService.java | 0 .../core/command/CommandServiceImpl.java | 0 .../core/command/builtin/BuiltinCommand.java | 0 .../builtin/handler/HealthHandler.java | 0 .../command/builtin/handler/HelpHandler.java | 0 .../builtin/handler/InstallBizHandler.java | 0 .../builtin/handler/QueryAllBizHandler.java | 0 .../builtin/handler/QueryBizOpsHandler.java | 0 .../builtin/handler/SwitchBizHandler.java | 0 .../builtin/handler/UninstallBizHandler.java | 0 .../core/command/builtin/model/BizInfo.java | 0 .../command/builtin/model/CommandModel.java | 0 .../command/builtin/model/PluginModel.java | 0 .../coordinate/BizOpsCommandCoordinator.java | 0 .../executor/ExecutorServiceManager.java | 0 .../command/executor/NamedThreadFactory.java | 0 .../command/meta/AbstractCommandHandler.java | 0 .../arklet/core/command/meta/Command.java | 0 .../arklet/core/command/meta/InputMeta.java | 0 .../arklet/core/command/meta/Output.java | 0 .../core/command/meta/bizops/ArkBizMeta.java | 0 .../core/command/meta/bizops/ArkBizOps.java | 0 .../core/command/record/ProcessRecord.java | 0 .../command/record/ProcessRecordHolder.java | 0 .../common/exception/ArkletException.java | 0 .../common/exception/ArkletInitException.java | 0 .../exception/ArkletRuntimeException.java | 0 .../exception/CommandValidationException.java | 0 .../arklet/core/common/log/ArkletLogger.java | 0 .../core/common/log/ArkletLoggerFactory.java | 0 .../arklet/core/health/HealthService.java | 0 .../arklet/core/health/HealthServiceImpl.java | 0 .../health/indicator/ArkletBaseIndicator.java | 0 .../core/health/indicator/CpuIndicator.java | 0 .../core/health/indicator/JvmIndicator.java | 0 .../core/health/model/BizHealthMeta.java | 0 .../arklet/core/health/model/Constants.java | 0 .../arklet/core/health/model/Health.java | 0 .../core/health/model/PluginHealthMeta.java | 0 .../core/ops/UnifiedOperationService.java | 0 .../core/ops/UnifiedOperationServiceImpl.java | 0 .../arklet/core/util/AssertUtils.java | 0 .../arklet/core/util/ConvertUtils.java | 0 .../alipay/sofa/arklet/log/log4j/log-conf.xml | 0 .../sofa/arklet/log/log4j2/log-conf.xml | 0 .../sofa/arklet/log/logback/log-conf.xml | 0 .../sofa/serverless/arklet/core/BaseTest.java | 0 .../BizOpsCommandCoordinatorTests.java | 0 .../arklet/core/command/CommandTests.java | 0 .../arklet/core/command/HelpHandlerTests.java | 0 .../core/command/InstallBizHandlerTests.java | 0 .../core/command/custom/CustomCommand.java | 0 .../command/custom/CustomCommandHandler.java | 0 .../arklet/core/command/custom/Input.java | 0 .../core/component/ComponentRegistryTest.java | 0 .../arklet/core/health/HealthTests.java | 0 .../core/health/custom/CustomIndicator.java | 0 .../core/health/indicator/IndicatorTests.java | 0 .../src/test/resources/test-biz.jar | Bin .../arklet-springboot-starter/pom.xml | 8 +- .../starter/ArkletAutoConfiguration.java | 2 +- .../command/MasterBizCmdHandlerCollector.java | 0 .../health/HealthAutoConfiguration.java | 2 +- .../endpoint/ArkHealthCodeEndpoint.java | 0 .../health/endpoint/ArkHealthzEndpoint.java | 0 .../endpoint/model/EndpointResponse.java | 0 .../endpoint/model/EndpointResponseCode.java | 0 .../indicator/MasterBizHealthIndicator.java | 0 .../listener/ArkletApplicationListener.java | 0 .../main/resources/META-INF/spring.factories | 0 .../arklet/spring/BaseSpringApplication.java | 0 .../arklet/spring/SpringbootBaseTest.java | 0 .../arklet/spring/SpringbootRunnerTest.java | 0 .../arklet/spring/common/SpringbootUtil.java | 0 .../endpoint/ArkHealthCodeEndpointTests.java | 0 .../endpoint/ArkHealthzEndpointTests.java | 0 .../MasterBizHealthIndicatorTests.java | 0 .../resources/config/application.properties | 0 .../src/test/resources/logback.xml | 0 sofa-serverless-runtime/pom.xml | 147 +++++- .../sofa-serverless-app-starter/pom.xml | 4 +- .../sofa-serverless-base-plugin/pom.xml | 2 +- .../ApplicationContextEventHandler.java | 6 - .../handler/BizUninstallEventHandler.java | 1 + .../pom.xml | 7 +- .../serverless/common/BizRuntimeContext.java | 0 .../common/BizRuntimeContextRegistry.java | 5 +- .../environment/ConditionalOnMasterBiz.java | 0 .../ConditionalOnNotMasterBiz.java | 0 .../common/environment/OnMasterBiz.java | 0 .../common/environment/OnNotMasterBiz.java | 0 .../common/exception/BizRuntimeException.java | 0 .../common/exception/ErrorCodes.java | 0 111 files changed, 149 insertions(+), 1322 deletions(-) delete mode 100644 arklet/Formatter.xml delete mode 100644 arklet/HEADER delete mode 100644 arklet/README.md delete mode 100644 arklet/arklet-springboot-starter/src/main/java/com/alipay/sofa/serverless/arklet/springboot/starter/environment/ConditionalOnMasterBiz.java delete mode 100644 arklet/arklet-springboot-starter/src/main/java/com/alipay/sofa/serverless/arklet/springboot/starter/environment/OnMasterBiz.java delete mode 100644 arklet/check_format.sh delete mode 100644 arklet/integration-tests/.gitignore delete mode 100644 arklet/pom.xml rename {arklet => sofa-serverless-runtime}/arklet-core/pom.xml (97%) rename {arklet => sofa-serverless-runtime}/arklet-core/src/main/java/com/alipay/sofa/serverless/arklet/core/ArkletComponent.java (100%) rename {arklet => sofa-serverless-runtime}/arklet-core/src/main/java/com/alipay/sofa/serverless/arklet/core/ArkletComponentRegistry.java (100%) rename {arklet => sofa-serverless-runtime}/arklet-core/src/main/java/com/alipay/sofa/serverless/arklet/core/api/ApiClient.java (100%) rename {arklet => sofa-serverless-runtime}/arklet-core/src/main/java/com/alipay/sofa/serverless/arklet/core/api/model/Response.java (100%) rename {arklet => sofa-serverless-runtime}/arklet-core/src/main/java/com/alipay/sofa/serverless/arklet/core/api/model/ResponseCode.java (100%) rename {arklet => sofa-serverless-runtime}/arklet-core/src/main/java/com/alipay/sofa/serverless/arklet/core/api/tunnel/Tunnel.java (100%) rename {arklet => sofa-serverless-runtime}/arklet-core/src/main/java/com/alipay/sofa/serverless/arklet/core/api/tunnel/http/HttpTunnel.java (100%) rename {arklet => sofa-serverless-runtime}/arklet-core/src/main/java/com/alipay/sofa/serverless/arklet/core/api/tunnel/http/netty/NettyHttpServer.java (100%) rename {arklet => sofa-serverless-runtime}/arklet-core/src/main/java/com/alipay/sofa/serverless/arklet/core/api/tunnel/http/netty/RequestValidation.java (100%) rename {arklet => sofa-serverless-runtime}/arklet-core/src/main/java/com/alipay/sofa/serverless/arklet/core/command/CommandService.java (100%) rename {arklet => sofa-serverless-runtime}/arklet-core/src/main/java/com/alipay/sofa/serverless/arklet/core/command/CommandServiceImpl.java (100%) rename {arklet => sofa-serverless-runtime}/arklet-core/src/main/java/com/alipay/sofa/serverless/arklet/core/command/builtin/BuiltinCommand.java (100%) rename {arklet => sofa-serverless-runtime}/arklet-core/src/main/java/com/alipay/sofa/serverless/arklet/core/command/builtin/handler/HealthHandler.java (100%) rename {arklet => sofa-serverless-runtime}/arklet-core/src/main/java/com/alipay/sofa/serverless/arklet/core/command/builtin/handler/HelpHandler.java (100%) rename {arklet => sofa-serverless-runtime}/arklet-core/src/main/java/com/alipay/sofa/serverless/arklet/core/command/builtin/handler/InstallBizHandler.java (100%) rename {arklet => sofa-serverless-runtime}/arklet-core/src/main/java/com/alipay/sofa/serverless/arklet/core/command/builtin/handler/QueryAllBizHandler.java (100%) rename {arklet => sofa-serverless-runtime}/arklet-core/src/main/java/com/alipay/sofa/serverless/arklet/core/command/builtin/handler/QueryBizOpsHandler.java (100%) rename {arklet => sofa-serverless-runtime}/arklet-core/src/main/java/com/alipay/sofa/serverless/arklet/core/command/builtin/handler/SwitchBizHandler.java (100%) rename {arklet => sofa-serverless-runtime}/arklet-core/src/main/java/com/alipay/sofa/serverless/arklet/core/command/builtin/handler/UninstallBizHandler.java (100%) rename {arklet => sofa-serverless-runtime}/arklet-core/src/main/java/com/alipay/sofa/serverless/arklet/core/command/builtin/model/BizInfo.java (100%) rename {arklet => sofa-serverless-runtime}/arklet-core/src/main/java/com/alipay/sofa/serverless/arklet/core/command/builtin/model/CommandModel.java (100%) rename {arklet => sofa-serverless-runtime}/arklet-core/src/main/java/com/alipay/sofa/serverless/arklet/core/command/builtin/model/PluginModel.java (100%) rename {arklet => sofa-serverless-runtime}/arklet-core/src/main/java/com/alipay/sofa/serverless/arklet/core/command/coordinate/BizOpsCommandCoordinator.java (100%) rename {arklet => sofa-serverless-runtime}/arklet-core/src/main/java/com/alipay/sofa/serverless/arklet/core/command/executor/ExecutorServiceManager.java (100%) rename {arklet => sofa-serverless-runtime}/arklet-core/src/main/java/com/alipay/sofa/serverless/arklet/core/command/executor/NamedThreadFactory.java (100%) rename {arklet => sofa-serverless-runtime}/arklet-core/src/main/java/com/alipay/sofa/serverless/arklet/core/command/meta/AbstractCommandHandler.java (100%) rename {arklet => sofa-serverless-runtime}/arklet-core/src/main/java/com/alipay/sofa/serverless/arklet/core/command/meta/Command.java (100%) rename {arklet => sofa-serverless-runtime}/arklet-core/src/main/java/com/alipay/sofa/serverless/arklet/core/command/meta/InputMeta.java (100%) rename {arklet => sofa-serverless-runtime}/arklet-core/src/main/java/com/alipay/sofa/serverless/arklet/core/command/meta/Output.java (100%) rename {arklet => sofa-serverless-runtime}/arklet-core/src/main/java/com/alipay/sofa/serverless/arklet/core/command/meta/bizops/ArkBizMeta.java (100%) rename {arklet => sofa-serverless-runtime}/arklet-core/src/main/java/com/alipay/sofa/serverless/arklet/core/command/meta/bizops/ArkBizOps.java (100%) rename {arklet => sofa-serverless-runtime}/arklet-core/src/main/java/com/alipay/sofa/serverless/arklet/core/command/record/ProcessRecord.java (100%) rename {arklet => sofa-serverless-runtime}/arklet-core/src/main/java/com/alipay/sofa/serverless/arklet/core/command/record/ProcessRecordHolder.java (100%) rename {arklet => sofa-serverless-runtime}/arklet-core/src/main/java/com/alipay/sofa/serverless/arklet/core/common/exception/ArkletException.java (100%) rename {arklet => sofa-serverless-runtime}/arklet-core/src/main/java/com/alipay/sofa/serverless/arklet/core/common/exception/ArkletInitException.java (100%) rename {arklet => sofa-serverless-runtime}/arklet-core/src/main/java/com/alipay/sofa/serverless/arklet/core/common/exception/ArkletRuntimeException.java (100%) rename {arklet => sofa-serverless-runtime}/arklet-core/src/main/java/com/alipay/sofa/serverless/arklet/core/common/exception/CommandValidationException.java (100%) rename {arklet => sofa-serverless-runtime}/arklet-core/src/main/java/com/alipay/sofa/serverless/arklet/core/common/log/ArkletLogger.java (100%) rename {arklet => sofa-serverless-runtime}/arklet-core/src/main/java/com/alipay/sofa/serverless/arklet/core/common/log/ArkletLoggerFactory.java (100%) rename {arklet => sofa-serverless-runtime}/arklet-core/src/main/java/com/alipay/sofa/serverless/arklet/core/health/HealthService.java (100%) rename {arklet => sofa-serverless-runtime}/arklet-core/src/main/java/com/alipay/sofa/serverless/arklet/core/health/HealthServiceImpl.java (100%) rename {arklet => sofa-serverless-runtime}/arklet-core/src/main/java/com/alipay/sofa/serverless/arklet/core/health/indicator/ArkletBaseIndicator.java (100%) rename {arklet => sofa-serverless-runtime}/arklet-core/src/main/java/com/alipay/sofa/serverless/arklet/core/health/indicator/CpuIndicator.java (100%) rename {arklet => sofa-serverless-runtime}/arklet-core/src/main/java/com/alipay/sofa/serverless/arklet/core/health/indicator/JvmIndicator.java (100%) rename {arklet => sofa-serverless-runtime}/arklet-core/src/main/java/com/alipay/sofa/serverless/arklet/core/health/model/BizHealthMeta.java (100%) rename {arklet => sofa-serverless-runtime}/arklet-core/src/main/java/com/alipay/sofa/serverless/arklet/core/health/model/Constants.java (100%) rename {arklet => sofa-serverless-runtime}/arklet-core/src/main/java/com/alipay/sofa/serverless/arklet/core/health/model/Health.java (100%) rename {arklet => sofa-serverless-runtime}/arklet-core/src/main/java/com/alipay/sofa/serverless/arklet/core/health/model/PluginHealthMeta.java (100%) rename {arklet => sofa-serverless-runtime}/arklet-core/src/main/java/com/alipay/sofa/serverless/arklet/core/ops/UnifiedOperationService.java (100%) rename {arklet => sofa-serverless-runtime}/arklet-core/src/main/java/com/alipay/sofa/serverless/arklet/core/ops/UnifiedOperationServiceImpl.java (100%) rename {arklet => sofa-serverless-runtime}/arklet-core/src/main/java/com/alipay/sofa/serverless/arklet/core/util/AssertUtils.java (100%) rename {arklet => sofa-serverless-runtime}/arklet-core/src/main/java/com/alipay/sofa/serverless/arklet/core/util/ConvertUtils.java (100%) rename {arklet => sofa-serverless-runtime}/arklet-core/src/main/resources/com/alipay/sofa/arklet/log/log4j/log-conf.xml (100%) rename {arklet => sofa-serverless-runtime}/arklet-core/src/main/resources/com/alipay/sofa/arklet/log/log4j2/log-conf.xml (100%) rename {arklet => sofa-serverless-runtime}/arklet-core/src/main/resources/com/alipay/sofa/arklet/log/logback/log-conf.xml (100%) rename {arklet => sofa-serverless-runtime}/arklet-core/src/test/java/com/alipay/sofa/serverless/arklet/core/BaseTest.java (100%) rename {arklet => sofa-serverless-runtime}/arklet-core/src/test/java/com/alipay/sofa/serverless/arklet/core/command/BizOpsCommandCoordinatorTests.java (100%) rename {arklet => sofa-serverless-runtime}/arklet-core/src/test/java/com/alipay/sofa/serverless/arklet/core/command/CommandTests.java (100%) rename {arklet => sofa-serverless-runtime}/arklet-core/src/test/java/com/alipay/sofa/serverless/arklet/core/command/HelpHandlerTests.java (100%) rename {arklet => sofa-serverless-runtime}/arklet-core/src/test/java/com/alipay/sofa/serverless/arklet/core/command/InstallBizHandlerTests.java (100%) rename {arklet => sofa-serverless-runtime}/arklet-core/src/test/java/com/alipay/sofa/serverless/arklet/core/command/custom/CustomCommand.java (100%) rename {arklet => sofa-serverless-runtime}/arklet-core/src/test/java/com/alipay/sofa/serverless/arklet/core/command/custom/CustomCommandHandler.java (100%) rename {arklet => sofa-serverless-runtime}/arklet-core/src/test/java/com/alipay/sofa/serverless/arklet/core/command/custom/Input.java (100%) rename {arklet => sofa-serverless-runtime}/arklet-core/src/test/java/com/alipay/sofa/serverless/arklet/core/component/ComponentRegistryTest.java (100%) rename {arklet => sofa-serverless-runtime}/arklet-core/src/test/java/com/alipay/sofa/serverless/arklet/core/health/HealthTests.java (100%) rename {arklet => sofa-serverless-runtime}/arklet-core/src/test/java/com/alipay/sofa/serverless/arklet/core/health/custom/CustomIndicator.java (100%) rename {arklet => sofa-serverless-runtime}/arklet-core/src/test/java/com/alipay/sofa/serverless/arklet/core/health/indicator/IndicatorTests.java (100%) rename {arklet => sofa-serverless-runtime}/arklet-core/src/test/resources/test-biz.jar (100%) rename {arklet => sofa-serverless-runtime}/arklet-springboot-starter/pom.xml (91%) rename {arklet => sofa-serverless-runtime}/arklet-springboot-starter/src/main/java/com/alipay/sofa/serverless/arklet/springboot/starter/ArkletAutoConfiguration.java (94%) rename {arklet => sofa-serverless-runtime}/arklet-springboot-starter/src/main/java/com/alipay/sofa/serverless/arklet/springboot/starter/command/MasterBizCmdHandlerCollector.java (100%) rename {arklet => sofa-serverless-runtime}/arklet-springboot-starter/src/main/java/com/alipay/sofa/serverless/arklet/springboot/starter/health/HealthAutoConfiguration.java (97%) rename {arklet => sofa-serverless-runtime}/arklet-springboot-starter/src/main/java/com/alipay/sofa/serverless/arklet/springboot/starter/health/endpoint/ArkHealthCodeEndpoint.java (100%) rename {arklet => sofa-serverless-runtime}/arklet-springboot-starter/src/main/java/com/alipay/sofa/serverless/arklet/springboot/starter/health/endpoint/ArkHealthzEndpoint.java (100%) rename {arklet => sofa-serverless-runtime}/arklet-springboot-starter/src/main/java/com/alipay/sofa/serverless/arklet/springboot/starter/health/endpoint/model/EndpointResponse.java (100%) rename {arklet => sofa-serverless-runtime}/arklet-springboot-starter/src/main/java/com/alipay/sofa/serverless/arklet/springboot/starter/health/endpoint/model/EndpointResponseCode.java (100%) rename {arklet => sofa-serverless-runtime}/arklet-springboot-starter/src/main/java/com/alipay/sofa/serverless/arklet/springboot/starter/health/extension/indicator/MasterBizHealthIndicator.java (100%) rename {arklet => sofa-serverless-runtime}/arklet-springboot-starter/src/main/java/com/alipay/sofa/serverless/arklet/springboot/starter/listener/ArkletApplicationListener.java (100%) rename {arklet => sofa-serverless-runtime}/arklet-springboot-starter/src/main/resources/META-INF/spring.factories (100%) rename {arklet => sofa-serverless-runtime}/arklet-springboot-starter/src/test/java/com/alipay/sofa/serverless/arklet/spring/BaseSpringApplication.java (100%) rename {arklet => sofa-serverless-runtime}/arklet-springboot-starter/src/test/java/com/alipay/sofa/serverless/arklet/spring/SpringbootBaseTest.java (100%) rename {arklet => sofa-serverless-runtime}/arklet-springboot-starter/src/test/java/com/alipay/sofa/serverless/arklet/spring/SpringbootRunnerTest.java (100%) rename {arklet => sofa-serverless-runtime}/arklet-springboot-starter/src/test/java/com/alipay/sofa/serverless/arklet/spring/common/SpringbootUtil.java (100%) rename {arklet => sofa-serverless-runtime}/arklet-springboot-starter/src/test/java/com/alipay/sofa/serverless/arklet/spring/health/endpoint/ArkHealthCodeEndpointTests.java (100%) rename {arklet => sofa-serverless-runtime}/arklet-springboot-starter/src/test/java/com/alipay/sofa/serverless/arklet/spring/health/endpoint/ArkHealthzEndpointTests.java (100%) rename {arklet => sofa-serverless-runtime}/arklet-springboot-starter/src/test/java/com/alipay/sofa/serverless/arklet/spring/health/extension/indicator/MasterBizHealthIndicatorTests.java (100%) rename {arklet => sofa-serverless-runtime}/arklet-springboot-starter/src/test/resources/config/application.properties (100%) rename {arklet => sofa-serverless-runtime}/arklet-springboot-starter/src/test/resources/logback.xml (100%) rename sofa-serverless-runtime/{sofa-serverless-base-common => sofa-serverless-common}/pom.xml (86%) rename sofa-serverless-runtime/{sofa-serverless-base-common => sofa-serverless-common}/src/main/java/com/alipay/sofa/serverless/common/BizRuntimeContext.java (100%) rename sofa-serverless-runtime/{sofa-serverless-base-common => sofa-serverless-common}/src/main/java/com/alipay/sofa/serverless/common/BizRuntimeContextRegistry.java (94%) rename sofa-serverless-runtime/{sofa-serverless-base-common => sofa-serverless-common}/src/main/java/com/alipay/sofa/serverless/common/environment/ConditionalOnMasterBiz.java (100%) rename sofa-serverless-runtime/{sofa-serverless-base-common => sofa-serverless-common}/src/main/java/com/alipay/sofa/serverless/common/environment/ConditionalOnNotMasterBiz.java (100%) rename sofa-serverless-runtime/{sofa-serverless-base-common => sofa-serverless-common}/src/main/java/com/alipay/sofa/serverless/common/environment/OnMasterBiz.java (100%) rename sofa-serverless-runtime/{sofa-serverless-base-common => sofa-serverless-common}/src/main/java/com/alipay/sofa/serverless/common/environment/OnNotMasterBiz.java (100%) rename sofa-serverless-runtime/{sofa-serverless-base-common => sofa-serverless-common}/src/main/java/com/alipay/sofa/serverless/common/exception/BizRuntimeException.java (100%) rename sofa-serverless-runtime/{sofa-serverless-base-common => sofa-serverless-common}/src/main/java/com/alipay/sofa/serverless/common/exception/ErrorCodes.java (100%) diff --git a/arklet/Formatter.xml b/arklet/Formatter.xml deleted file mode 100644 index 1dc905447..000000000 --- a/arklet/Formatter.xml +++ /dev/null @@ -1,278 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/arklet/HEADER b/arklet/HEADER deleted file mode 100644 index 1745cfe66..000000000 --- a/arklet/HEADER +++ /dev/null @@ -1,14 +0,0 @@ -Licensed to the Apache Software Foundation (ASF) under one or more -contributor license agreements. See the NOTICE file distributed with -this work for additional information regarding copyright ownership. -The ASF licenses this file to You under the Apache License, Version 2.0 -(the "License"); you may not use this file except in compliance with -the License. You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. diff --git a/arklet/README.md b/arklet/README.md deleted file mode 100644 index 339f2c850..000000000 --- a/arklet/README.md +++ /dev/null @@ -1,428 +0,0 @@ -# Overview - -Arklet provides an operational interface for delivery of SofaArk bases and modules. With Arklet, the release and operation of Ark Biz can be easily and flexibly operated. - -Arklet is internally constructed by **ArkletComponent** - -![image](https://github.com/sofastack/sofa-serverless/assets/11410549/a2740422-569e-4dd3-9c9a-1503996bd2f1) -- ApiClient: The core components responsible for interacting with the outside world -- CommandService: Arklet exposes capability instruction definition and extension -- OperationService: Ark Biz interacts with SofaArk to add, delete, modify, and encapsulate basic capabilities -- HealthService: Based on health and stability, base, Biz, system and other indicators are calculated - -The collaboration between them is shown in the figure -![overview](https://user-images.githubusercontent.com/11410549/266193839-7865e417-6909-4e89-bd48-c926162eaf83.jpg) - - -Of course, you can also extend Arklet's component capabilities by implementing the **ArkletComponent** interface - -# Command Extension -The Arklet exposes the instruction API externally and handles the instruction internally through a CommandHandler mapped from each API. -> CommandHandler related extensions belong to the unified management of the CommandService component - -You can customize extension commands by inheriting **AbstractCommandHandler** - -## Build-in Command API - -All of the following instruction apis access the arklet using the POST(application/json) request format - -The http protocol is enabled and the default port is 1238 -> You can set `sofa.serverless.arklet.http.port` JVM startup parameters override the default port - - -## Query the supported commands -- URL: 127.0.0.1:1238/help -- input sample: -```json -{} -``` -- output sample: -```json -{ - "code":"SUCCESS", - "data":[ - { - "desc":"query all ark biz(including master biz)", - "id":"queryAllBiz" - }, - { - "desc":"list all supported commands", - "id":"help" - }, - { - "desc":"uninstall one ark biz", - "id":"uninstallBiz" - }, - { - "desc":"switch one ark biz", - "id":"switchBiz" - }, - { - "desc":"install one ark biz", - "id":"installBiz" - } - ] -} -``` - -## Install a biz -- URL: 127.0.0.1:1238/installBiz -- input sample: -```json -{ - "bizName": "test", - "bizVersion": "1.0.0", - // local path should start with file://, alse support remote url which can be downloaded - "bizUrl": "file:///Users/jaimezhang/workspace/github/sofa-ark-dynamic-guides/dynamic-provider/target/dynamic-provider-1.0.0-ark-biz.jar" -} -``` - -- output sample(success): -```json -{ - "code":"SUCCESS", - "data":{ - "bizInfos":[ - { - "bizName":"dynamic-provider", - "bizState":"ACTIVATED", - "bizVersion":"1.0.0", - "declaredMode":true, - "identity":"dynamic-provider:1.0.0", - "mainClass":"io.sofastack.dynamic.provider.ProviderApplication", - "priority":100, - "webContextPath":"provider" - } - ], - "code":"SUCCESS", - "message":"Install Biz: dynamic-provider:1.0.0 success, cost: 1092 ms, started at: 16:07:47,769" - } -} -``` - -- output sample(failed): -```json -{ - "code":"FAILED", - "data":{ - "code":"REPEAT_BIZ", - "message":"Biz: dynamic-provider:1.0.0 has been installed or registered." - } -} -``` - - -## Uninstall a biz -- URL: 127.0.0.1:1238/uninstallBiz -- input sample: -```json -{ - "bizName":"dynamic-provider", - "bizVersion":"1.0.0" -} -``` -- output sample(success): -```json -{ - "code":"SUCCESS" -} -``` - -- output sample(failed): -```json -{ - "code":"FAILED", - "data":{ - "code":"NOT_FOUND_BIZ", - "message":"Uninstall biz: test:1.0.0 not found." - } -} -``` - -## Switch a biz -- URL: 127.0.0.1:1238/switchBiz -- input sample: -```json -{ - "bizName":"dynamic-provider", - "bizVersion":"1.0.0" -} -``` -- output sample: -```json -{ - "code":"SUCCESS" -} -``` - -## Query all Biz -- URL: 127.0.0.1:1238/queryAllBiz -- input sample: -```json -{} -``` -- output sample: -```json -{ - "code":"SUCCESS", - "data":[ - { - "bizName":"dynamic-provider", - "bizState":"ACTIVATED", - "bizVersion":"1.0.0", - "mainClass":"io.sofastack.dynamic.provider.ProviderApplication", - "webContextPath":"provider" - }, - { - "bizName":"stock-mng", - "bizState":"ACTIVATED", - "bizVersion":"1.0.0", - "mainClass":"embed main", - "webContextPath":"/" - } - ] -} -``` - -## Query Health -- URL: 127.0.0.1:1238/health - -### Query All Health Info -- input sample: -```json -{} -``` -- output sample: -```json -{ - "code": "SUCCESS", - "data": { - "healthData": { - "jvm": { - "max non heap memory(M)": -9.5367431640625E-7, - "java version": "1.8.0_331", - "max memory(M)": 885.5, - "max heap memory(M)": 885.5, - "used heap memory(M)": 137.14127349853516, - "used non heap memory(M)": 62.54662322998047, - "loaded class count": 10063, - "init non heap memory(M)": 2.4375, - "total memory(M)": 174.5, - "free memory(M)": 37.358726501464844, - "unload class count": 0, - "total class count": 10063, - "committed heap memory(M)": 174.5, - "java home": "****\\jre", - "init heap memory(M)": 64.0, - "committed non heap memory(M)": 66.203125, - "run time(s)": 34.432 - }, - "cpu": { - "count": 4, - "total used (%)": 131749.0, - "type": "****", - "user used (%)": 9.926451054656962, - "free (%)": 81.46475495070172, - "system used (%)": 6.249762806548817 - }, - "masterBizInfo": { - "webContextPath": "/", - "bizName": "bookstore-manager", - "bizState": "ACTIVATED", - "bizVersion": "1.0.0" - }, - "pluginListInfo": [ - { - "artifactId": "web-ark-plugin", - "groupId": "com.alipay.sofa", - "pluginActivator": "com.alipay.sofa.ark.web.embed.WebPluginActivator", - "pluginName": "web-ark-plugin", - "pluginUrl": "file:/****/2.2.3-SNAPSHOT/web-ark-plugin-2.2.3-20230901.090402-2.jar!/", - "pluginVersion": "2.2.3-SNAPSHOT" - }, - { - "artifactId": "runtime-sofa-boot-plugin", - "groupId": "com.alipay.sofa", - "pluginActivator": "com.alipay.sofa.runtime.ark.plugin.SofaRuntimeActivator", - "pluginName": "runtime-sofa-boot-plugin", - "pluginUrl": "file:/****/runtime-sofa-boot-plugin-3.11.0.jar!/", - "pluginVersion": "3.11.0" - } - ], - "masterBizHealth": { - "readinessState": "ACCEPTING_TRAFFIC" - }, - "bizListInfo": [ - { - "bizName": "bookstore-manager", - "bizState": "ACTIVATED", - "bizVersion": "1.0.0", - "webContextPath": "/" - } - ] - } - } -} -``` - -### Query System Health Info -- input sample: - -```json -{ - "type": "system", - // [OPTIONAL] if metrics is null -> query all system health info - "metrics": ["cpu", "jvm"] -} -``` -- output sample: -```json -{ - "code": "SUCCESS", - "data": { - "healthData": { - "jvm": {...}, - "cpu": {...}, -// "masterBizHealth": {...} - } - } -} -``` - -### Query Biz Health Info -- input sample: - -```json -{ - "type": "biz", - // [OPTIONAL] if moduleName is null and moduleVersion is null -> query all biz - "moduleName": "bookstore-manager", - // [OPTIONAL] if moduleVersion is null -> query all biz named moduleName - "moduleVersion": "1.0.0" -} -``` -- output sample: -```json -{ - "code": "SUCCESS", - "data": { - "healthData": { - "bizInfo": { - "bizName": "bookstore-manager", - "bizState": "ACTIVATED", - "bizVersion": "1.0.0", - "webContextPath": "/" - } -// "bizListInfo": [ -// { -// "bizName": "bookstore-manager", -// "bizState": "ACTIVATED", -// "bizVersion": "1.0.0", -// "webContextPath": "/" -// } -// ] - } - } -} -``` - -### Query Plugin Health Info -- input sample: - -```json -{ - "type": "plugin", - // [OPTIONAL] if moduleName is null -> query all biz - "moduleName": "web-ark-plugin" -} -``` -- output sample: -```json -{ - "code": "SUCCESS", - "data": { - "healthData": { - "pluginListInfo": [ - { - "artifactId": "web-ark-plugin", - "groupId": "com.alipay.sofa", - "pluginActivator": "com.alipay.sofa.ark.web.embed.WebPluginActivator", - "pluginName": "web-ark-plugin", - "pluginUrl": "file:/****/web-ark-plugin-2.2.3-20230901.090402-2.jar!/", - "pluginVersion": "2.2.3-SNAPSHOT" - } - ] - } - } -} -``` - -### Query Health Using Endpoint - -use endpoint for k8s module to get helath info - -**default config** -* endpoints exposure include: `*` -* endpoints base path: `/` -* endpoints sever port: `8080` - -**http code result** -* `HEALTHY(200)`: get health if all health indicator is healthy -* `UNHEALTHY(400)`: get health once a health indicator is unhealthy -* `ENDPOINT_NOT_FOUND(404)`: endpoint path or params not found -* `ENDPOINT_PROCESS_INTERNAL_ERROR(500)`: get health process throw an error - -### query all health info -- url: 127.0.0.1:8080/arkletHealth -- method: GET -- output sample - -```json -{ - "healthy": true, - "code": 200, - "codeType": "HEALTHY", - "data": { - "jvm": {...}, - "masterBizHealth": {...}, - "cpu": {...}, - "masterBizInfo": {...}, - "bizListInfo": [...], - "pluginListInfo": [...] - } -} -``` -### query all biz/plugin health info -- url: 127.0.0.1:8080/arkletHealth/{moduleType} (moduleType must in ['biz', 'plugin']) -- method: GET -- output sample - ```json -{ - "healthy": true, - "code": 200, - "codeType": "HEALTHY", - "data": { - "bizListInfo": [...], - // "pluginListInfo": [...] - } -} -``` - ### query single biz/plugin health info -- url: 127.0.0.1:8080/arkletHealth/{moduleType}/moduleName/moduleVersion (moduleType must in ['biz', 'plugin']) -- method: GET -- output sample - - ```json -{ - "healthy": true, - "code": 200, - "codeType": "HEALTHY", - "data": { - "bizInfo": {...}, - // "pluginInfo": {...} - } -} -``` - - - diff --git a/arklet/arklet-springboot-starter/src/main/java/com/alipay/sofa/serverless/arklet/springboot/starter/environment/ConditionalOnMasterBiz.java b/arklet/arklet-springboot-starter/src/main/java/com/alipay/sofa/serverless/arklet/springboot/starter/environment/ConditionalOnMasterBiz.java deleted file mode 100644 index e908c6be4..000000000 --- a/arklet/arklet-springboot-starter/src/main/java/com/alipay/sofa/serverless/arklet/springboot/starter/environment/ConditionalOnMasterBiz.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.alipay.sofa.serverless.arklet.springboot.starter.environment; - -import java.lang.annotation.Documented; -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -import org.springframework.context.annotation.Conditional; - -/** - * @author mingmen - * @date 2023/6/14 - */ -@Target({ ElementType.TYPE, ElementType.METHOD }) -@Retention(RetentionPolicy.RUNTIME) -@Documented -@Conditional(OnMasterBiz.class) -public @interface ConditionalOnMasterBiz { -} diff --git a/arklet/arklet-springboot-starter/src/main/java/com/alipay/sofa/serverless/arklet/springboot/starter/environment/OnMasterBiz.java b/arklet/arklet-springboot-starter/src/main/java/com/alipay/sofa/serverless/arklet/springboot/starter/environment/OnMasterBiz.java deleted file mode 100644 index 6926ef024..000000000 --- a/arklet/arklet-springboot-starter/src/main/java/com/alipay/sofa/serverless/arklet/springboot/starter/environment/OnMasterBiz.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.alipay.sofa.serverless.arklet.springboot.starter.environment; - -import org.springframework.boot.autoconfigure.condition.ConditionOutcome; -import org.springframework.boot.autoconfigure.condition.SpringBootCondition; -import org.springframework.context.annotation.ConditionContext; -import org.springframework.core.type.AnnotatedTypeMetadata; - -/** - * @author mingmen - * @date 2023/6/14 - */ -public class OnMasterBiz extends SpringBootCondition { - - private static final String BIZ_CLASSLOADER = "com.alipay.sofa.ark.container.service.classloader.BizClassLoader"; - - @Override - public ConditionOutcome getMatchOutcome(ConditionContext context, AnnotatedTypeMetadata metadata) { - ClassLoader contextClassLoader = Thread.currentThread().getContextClassLoader(); - if (contextClassLoader == null - || BIZ_CLASSLOADER.equals(contextClassLoader.getClass().getName())) { - return new ConditionOutcome(false, "Current context classloader is biz classloader."); - } - return new ConditionOutcome(true, "Current context classloader is not biz classloader."); - } -} diff --git a/arklet/check_format.sh b/arklet/check_format.sh deleted file mode 100644 index 061d8e8f0..000000000 --- a/arklet/check_format.sh +++ /dev/null @@ -1,13 +0,0 @@ -#!/bin/sh - -BASEDIR=$(dirname $0) - -cd ${BASEDIR} - -# make sure git has no un commit files -if [ -n "$(git status --untracked-files=no --porcelain)" ]; then - echo "Please commit your change before run this shell, un commit files:" - git status --untracked-files=no --porcelain - echo "Please run ## mvn clean install -DskipTests -Dmaven.javadoc.skip=true -B -U && sh ./check_format.sh ## locally, then push it." - exit -1 -fi \ No newline at end of file diff --git a/arklet/integration-tests/.gitignore b/arklet/integration-tests/.gitignore deleted file mode 100644 index e69de29bb..000000000 diff --git a/arklet/pom.xml b/arklet/pom.xml deleted file mode 100644 index 1f6ca915a..000000000 --- a/arklet/pom.xml +++ /dev/null @@ -1,475 +0,0 @@ - - - com.alipay.sofa.serverless - arklet - ${revision} - 4.0.0 - - 0.3.2 - UTF-8 - UTF-8 - 1.8 - 3.0 - 0.4 - 3.1 - 3.0.0 - 3.2.0 - 1.6.7 - 1.6 - 0.8.4 - 8 - 8 - 4.0 - 4.1.42.Final - 1.2.9 - 1.18.22 - 4.13.1 - 4.8.1 - 1.5.0 - 2.2.3-SNAPSHOT - 2.5.12 - 6.4.5 - 3.12.0 - 32.1.2-jre - 1.2.69 - - - ${project.groupId}:${project.artifactId} - todo - https://github.com/sofastack/sofa-serverless/arklet - - pom - - - arklet-core - arklet-springboot-starter - - - - - - The Apache License, Version 2.0 - http://www.apache.org/licenses/LICENSE-2.0.txt - - - - - - qilong - qilong.zql@antfin.com - Ant Financial - https://www.alipay.com/ - - - abby.zh - abby.zh@antfin.com - Ant Financial - https://www.alipay.com/ - - - - - scm:git:git://github.com/sofastack/sofa-serverless.git - scm:git:ssh://github.com/sofastack/sofa-serverless.git - http://github.com/sofastack/sofa-serverless/tree/master - - - - - - - com.alipay.sofa - sofa-ark-api - ${sofa.ark.version} - - - - com.alipay.sofa - sofa-ark-springboot-starter - ${sofa.ark.version} - - - - org.springframework.boot - spring-boot-autoconfigure - ${spring.boot.version} - - - - org.springframework.boot - spring-boot-loader - ${spring.boot.version} - - - - org.springframework.boot - spring-boot-starter-actuator - ${spring.boot.version} - - - - org.springframework.boot - spring-boot-starter-test - ${spring.boot.version} - - - - org.springframework.boot - spring-boot-starter-logging - ${spring.boot.version} - - - - com.google.inject - guice - ${guice.version} - - - - com.google.inject.extensions - guice-multibindings - ${guice.version} - - - - com.google.guava - guava - ${guava.version} - - - - com.alibaba - fastjson - ${fastjson.version} - - - - io.netty - netty-all - ${netty.version} - - - - ch.qos.logback - logback-classic - ${logback.version} - - - - ch.qos.logback - logback-core - ${logback.version} - - - - org.projectlombok - lombok - ${lombok.version} - - - - com.github.oshi - oshi-core - ${oshi.version} - - - - org.apache.commons - commons-lang3 - ${commons.lang3.version} - - - - - com.alipay.sofa.serverless - arklet-core - ${revision} - - - - com.alipay.sofa.serverless - arklet-springboot-starter - ${revision} - - - - - junit - junit - ${junit.version} - test - - - - org.mockito - mockito-core - ${mockito.version} - test - - - - - - - - - com.mycila - license-maven-plugin - ${license.maven.plugin} - - - generate-sources - - remove - format - - - - - true -
${user.dir}/HEADER
- - **/src/main/java/** - **/src/test/java/** - - true - - SLASHSTAR_STYLE - -
-
- - - com.googlecode.maven-java-formatter-plugin - maven-java-formatter-plugin - ${maven.java.formatter.plugin} - - - - format - - - - - ${user.dir}/Formatter.xml - ${project.encoding} - - - - - org.codehaus.mojo - flatten-maven-plugin - ${flatten-maven-plugin.version} - - - flatten - process-resources - - flatten - - - - flatten.clean - clean - - clean - - - - true - - - true - resolveCiFriendliesOnly - - - - - org.apache.maven.plugins - maven-compiler-plugin - ${maven.compiler.plugin} - - ${project.encoding} - ${java.version} - ${java.version} - - -parameters - - - - - - org.apache.maven.plugins - maven-source-plugin - ${maven.source.plugin} - - - attach-sources - - jar - - - - - - - org.jacoco - jacoco-maven-plugin - ${jacoco.maven.plugin} - - false - - - - default-prepare-agent - - prepare-agent - - - - default-report - test - - report-aggregate - - - - -
-
- - - - - release - - - - org.apache.maven.plugins - maven-javadoc-plugin - 2.9.1 - - - attach-javadocs - - jar - - - -Xdoclint:none - - - - - - org.sonatype.plugins - nexus-staging-maven-plugin - ${maven.staging.plugin} - true - - ossrh - https://oss.sonatype.org/ - false - - - - org.apache.maven.plugins - maven-gpg-plugin - ${maven.gpg.pluign} - - - sign-artifacts - verify - - sign - - - - - - --pinentry-mode - loopback - - - - - - - - ossrh - https://oss.sonatype.org/content/repositories/snapshots - - - ossrh - https://oss.sonatype.org/service/local/staging/deploy/maven2/ - - - - - - snapshot - - - - org.sonatype.plugins - nexus-staging-maven-plugin - ${maven.staging.plugin} - true - - ossrh - https://oss.sonatype.org/ - false - - - - org.apache.maven.plugins - maven-gpg-plugin - ${maven.gpg.pluign} - - - sign-artifacts - verify - - sign - - - - - - - - - ossrh - https://oss.sonatype.org/content/repositories/snapshots - - - - - - default - - true - - - - - true - - maven-snapshot - https://oss.sonatype.org/content/repositories/snapshots - - - - - - true - - maven-snapshot - https://oss.sonatype.org/content/repositories/snapshots - - - - - -
\ No newline at end of file diff --git a/arklet/arklet-core/pom.xml b/sofa-serverless-runtime/arklet-core/pom.xml similarity index 97% rename from arklet/arklet-core/pom.xml rename to sofa-serverless-runtime/arklet-core/pom.xml index a21b972a8..b64313f26 100644 --- a/arklet/arklet-core/pom.xml +++ b/sofa-serverless-runtime/arklet-core/pom.xml @@ -3,7 +3,7 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> - arklet + sofa-serverless-runtime com.alipay.sofa.serverless ${revision} ../pom.xml diff --git a/arklet/arklet-core/src/main/java/com/alipay/sofa/serverless/arklet/core/ArkletComponent.java b/sofa-serverless-runtime/arklet-core/src/main/java/com/alipay/sofa/serverless/arklet/core/ArkletComponent.java similarity index 100% rename from arklet/arklet-core/src/main/java/com/alipay/sofa/serverless/arklet/core/ArkletComponent.java rename to sofa-serverless-runtime/arklet-core/src/main/java/com/alipay/sofa/serverless/arklet/core/ArkletComponent.java diff --git a/arklet/arklet-core/src/main/java/com/alipay/sofa/serverless/arklet/core/ArkletComponentRegistry.java b/sofa-serverless-runtime/arklet-core/src/main/java/com/alipay/sofa/serverless/arklet/core/ArkletComponentRegistry.java similarity index 100% rename from arklet/arklet-core/src/main/java/com/alipay/sofa/serverless/arklet/core/ArkletComponentRegistry.java rename to sofa-serverless-runtime/arklet-core/src/main/java/com/alipay/sofa/serverless/arklet/core/ArkletComponentRegistry.java diff --git a/arklet/arklet-core/src/main/java/com/alipay/sofa/serverless/arklet/core/api/ApiClient.java b/sofa-serverless-runtime/arklet-core/src/main/java/com/alipay/sofa/serverless/arklet/core/api/ApiClient.java similarity index 100% rename from arklet/arklet-core/src/main/java/com/alipay/sofa/serverless/arklet/core/api/ApiClient.java rename to sofa-serverless-runtime/arklet-core/src/main/java/com/alipay/sofa/serverless/arklet/core/api/ApiClient.java diff --git a/arklet/arklet-core/src/main/java/com/alipay/sofa/serverless/arklet/core/api/model/Response.java b/sofa-serverless-runtime/arklet-core/src/main/java/com/alipay/sofa/serverless/arklet/core/api/model/Response.java similarity index 100% rename from arklet/arklet-core/src/main/java/com/alipay/sofa/serverless/arklet/core/api/model/Response.java rename to sofa-serverless-runtime/arklet-core/src/main/java/com/alipay/sofa/serverless/arklet/core/api/model/Response.java diff --git a/arklet/arklet-core/src/main/java/com/alipay/sofa/serverless/arklet/core/api/model/ResponseCode.java b/sofa-serverless-runtime/arklet-core/src/main/java/com/alipay/sofa/serverless/arklet/core/api/model/ResponseCode.java similarity index 100% rename from arklet/arklet-core/src/main/java/com/alipay/sofa/serverless/arklet/core/api/model/ResponseCode.java rename to sofa-serverless-runtime/arklet-core/src/main/java/com/alipay/sofa/serverless/arklet/core/api/model/ResponseCode.java diff --git a/arklet/arklet-core/src/main/java/com/alipay/sofa/serverless/arklet/core/api/tunnel/Tunnel.java b/sofa-serverless-runtime/arklet-core/src/main/java/com/alipay/sofa/serverless/arklet/core/api/tunnel/Tunnel.java similarity index 100% rename from arklet/arklet-core/src/main/java/com/alipay/sofa/serverless/arklet/core/api/tunnel/Tunnel.java rename to sofa-serverless-runtime/arklet-core/src/main/java/com/alipay/sofa/serverless/arklet/core/api/tunnel/Tunnel.java diff --git a/arklet/arklet-core/src/main/java/com/alipay/sofa/serverless/arklet/core/api/tunnel/http/HttpTunnel.java b/sofa-serverless-runtime/arklet-core/src/main/java/com/alipay/sofa/serverless/arklet/core/api/tunnel/http/HttpTunnel.java similarity index 100% rename from arklet/arklet-core/src/main/java/com/alipay/sofa/serverless/arklet/core/api/tunnel/http/HttpTunnel.java rename to sofa-serverless-runtime/arklet-core/src/main/java/com/alipay/sofa/serverless/arklet/core/api/tunnel/http/HttpTunnel.java diff --git a/arklet/arklet-core/src/main/java/com/alipay/sofa/serverless/arklet/core/api/tunnel/http/netty/NettyHttpServer.java b/sofa-serverless-runtime/arklet-core/src/main/java/com/alipay/sofa/serverless/arklet/core/api/tunnel/http/netty/NettyHttpServer.java similarity index 100% rename from arklet/arklet-core/src/main/java/com/alipay/sofa/serverless/arklet/core/api/tunnel/http/netty/NettyHttpServer.java rename to sofa-serverless-runtime/arklet-core/src/main/java/com/alipay/sofa/serverless/arklet/core/api/tunnel/http/netty/NettyHttpServer.java diff --git a/arklet/arklet-core/src/main/java/com/alipay/sofa/serverless/arklet/core/api/tunnel/http/netty/RequestValidation.java b/sofa-serverless-runtime/arklet-core/src/main/java/com/alipay/sofa/serverless/arklet/core/api/tunnel/http/netty/RequestValidation.java similarity index 100% rename from arklet/arklet-core/src/main/java/com/alipay/sofa/serverless/arklet/core/api/tunnel/http/netty/RequestValidation.java rename to sofa-serverless-runtime/arklet-core/src/main/java/com/alipay/sofa/serverless/arklet/core/api/tunnel/http/netty/RequestValidation.java diff --git a/arklet/arklet-core/src/main/java/com/alipay/sofa/serverless/arklet/core/command/CommandService.java b/sofa-serverless-runtime/arklet-core/src/main/java/com/alipay/sofa/serverless/arklet/core/command/CommandService.java similarity index 100% rename from arklet/arklet-core/src/main/java/com/alipay/sofa/serverless/arklet/core/command/CommandService.java rename to sofa-serverless-runtime/arklet-core/src/main/java/com/alipay/sofa/serverless/arklet/core/command/CommandService.java diff --git a/arklet/arklet-core/src/main/java/com/alipay/sofa/serverless/arklet/core/command/CommandServiceImpl.java b/sofa-serverless-runtime/arklet-core/src/main/java/com/alipay/sofa/serverless/arklet/core/command/CommandServiceImpl.java similarity index 100% rename from arklet/arklet-core/src/main/java/com/alipay/sofa/serverless/arklet/core/command/CommandServiceImpl.java rename to sofa-serverless-runtime/arklet-core/src/main/java/com/alipay/sofa/serverless/arklet/core/command/CommandServiceImpl.java diff --git a/arklet/arklet-core/src/main/java/com/alipay/sofa/serverless/arklet/core/command/builtin/BuiltinCommand.java b/sofa-serverless-runtime/arklet-core/src/main/java/com/alipay/sofa/serverless/arklet/core/command/builtin/BuiltinCommand.java similarity index 100% rename from arklet/arklet-core/src/main/java/com/alipay/sofa/serverless/arklet/core/command/builtin/BuiltinCommand.java rename to sofa-serverless-runtime/arklet-core/src/main/java/com/alipay/sofa/serverless/arklet/core/command/builtin/BuiltinCommand.java diff --git a/arklet/arklet-core/src/main/java/com/alipay/sofa/serverless/arklet/core/command/builtin/handler/HealthHandler.java b/sofa-serverless-runtime/arklet-core/src/main/java/com/alipay/sofa/serverless/arklet/core/command/builtin/handler/HealthHandler.java similarity index 100% rename from arklet/arklet-core/src/main/java/com/alipay/sofa/serverless/arklet/core/command/builtin/handler/HealthHandler.java rename to sofa-serverless-runtime/arklet-core/src/main/java/com/alipay/sofa/serverless/arklet/core/command/builtin/handler/HealthHandler.java diff --git a/arklet/arklet-core/src/main/java/com/alipay/sofa/serverless/arklet/core/command/builtin/handler/HelpHandler.java b/sofa-serverless-runtime/arklet-core/src/main/java/com/alipay/sofa/serverless/arklet/core/command/builtin/handler/HelpHandler.java similarity index 100% rename from arklet/arklet-core/src/main/java/com/alipay/sofa/serverless/arklet/core/command/builtin/handler/HelpHandler.java rename to sofa-serverless-runtime/arklet-core/src/main/java/com/alipay/sofa/serverless/arklet/core/command/builtin/handler/HelpHandler.java diff --git a/arklet/arklet-core/src/main/java/com/alipay/sofa/serverless/arklet/core/command/builtin/handler/InstallBizHandler.java b/sofa-serverless-runtime/arklet-core/src/main/java/com/alipay/sofa/serverless/arklet/core/command/builtin/handler/InstallBizHandler.java similarity index 100% rename from arklet/arklet-core/src/main/java/com/alipay/sofa/serverless/arklet/core/command/builtin/handler/InstallBizHandler.java rename to sofa-serverless-runtime/arklet-core/src/main/java/com/alipay/sofa/serverless/arklet/core/command/builtin/handler/InstallBizHandler.java diff --git a/arklet/arklet-core/src/main/java/com/alipay/sofa/serverless/arklet/core/command/builtin/handler/QueryAllBizHandler.java b/sofa-serverless-runtime/arklet-core/src/main/java/com/alipay/sofa/serverless/arklet/core/command/builtin/handler/QueryAllBizHandler.java similarity index 100% rename from arklet/arklet-core/src/main/java/com/alipay/sofa/serverless/arklet/core/command/builtin/handler/QueryAllBizHandler.java rename to sofa-serverless-runtime/arklet-core/src/main/java/com/alipay/sofa/serverless/arklet/core/command/builtin/handler/QueryAllBizHandler.java diff --git a/arklet/arklet-core/src/main/java/com/alipay/sofa/serverless/arklet/core/command/builtin/handler/QueryBizOpsHandler.java b/sofa-serverless-runtime/arklet-core/src/main/java/com/alipay/sofa/serverless/arklet/core/command/builtin/handler/QueryBizOpsHandler.java similarity index 100% rename from arklet/arklet-core/src/main/java/com/alipay/sofa/serverless/arklet/core/command/builtin/handler/QueryBizOpsHandler.java rename to sofa-serverless-runtime/arklet-core/src/main/java/com/alipay/sofa/serverless/arklet/core/command/builtin/handler/QueryBizOpsHandler.java diff --git a/arklet/arklet-core/src/main/java/com/alipay/sofa/serverless/arklet/core/command/builtin/handler/SwitchBizHandler.java b/sofa-serverless-runtime/arklet-core/src/main/java/com/alipay/sofa/serverless/arklet/core/command/builtin/handler/SwitchBizHandler.java similarity index 100% rename from arklet/arklet-core/src/main/java/com/alipay/sofa/serverless/arklet/core/command/builtin/handler/SwitchBizHandler.java rename to sofa-serverless-runtime/arklet-core/src/main/java/com/alipay/sofa/serverless/arklet/core/command/builtin/handler/SwitchBizHandler.java diff --git a/arklet/arklet-core/src/main/java/com/alipay/sofa/serverless/arklet/core/command/builtin/handler/UninstallBizHandler.java b/sofa-serverless-runtime/arklet-core/src/main/java/com/alipay/sofa/serverless/arklet/core/command/builtin/handler/UninstallBizHandler.java similarity index 100% rename from arklet/arklet-core/src/main/java/com/alipay/sofa/serverless/arklet/core/command/builtin/handler/UninstallBizHandler.java rename to sofa-serverless-runtime/arklet-core/src/main/java/com/alipay/sofa/serverless/arklet/core/command/builtin/handler/UninstallBizHandler.java diff --git a/arklet/arklet-core/src/main/java/com/alipay/sofa/serverless/arklet/core/command/builtin/model/BizInfo.java b/sofa-serverless-runtime/arklet-core/src/main/java/com/alipay/sofa/serverless/arklet/core/command/builtin/model/BizInfo.java similarity index 100% rename from arklet/arklet-core/src/main/java/com/alipay/sofa/serverless/arklet/core/command/builtin/model/BizInfo.java rename to sofa-serverless-runtime/arklet-core/src/main/java/com/alipay/sofa/serverless/arklet/core/command/builtin/model/BizInfo.java diff --git a/arklet/arklet-core/src/main/java/com/alipay/sofa/serverless/arklet/core/command/builtin/model/CommandModel.java b/sofa-serverless-runtime/arklet-core/src/main/java/com/alipay/sofa/serverless/arklet/core/command/builtin/model/CommandModel.java similarity index 100% rename from arklet/arklet-core/src/main/java/com/alipay/sofa/serverless/arklet/core/command/builtin/model/CommandModel.java rename to sofa-serverless-runtime/arklet-core/src/main/java/com/alipay/sofa/serverless/arklet/core/command/builtin/model/CommandModel.java diff --git a/arklet/arklet-core/src/main/java/com/alipay/sofa/serverless/arklet/core/command/builtin/model/PluginModel.java b/sofa-serverless-runtime/arklet-core/src/main/java/com/alipay/sofa/serverless/arklet/core/command/builtin/model/PluginModel.java similarity index 100% rename from arklet/arklet-core/src/main/java/com/alipay/sofa/serverless/arklet/core/command/builtin/model/PluginModel.java rename to sofa-serverless-runtime/arklet-core/src/main/java/com/alipay/sofa/serverless/arklet/core/command/builtin/model/PluginModel.java diff --git a/arklet/arklet-core/src/main/java/com/alipay/sofa/serverless/arklet/core/command/coordinate/BizOpsCommandCoordinator.java b/sofa-serverless-runtime/arklet-core/src/main/java/com/alipay/sofa/serverless/arklet/core/command/coordinate/BizOpsCommandCoordinator.java similarity index 100% rename from arklet/arklet-core/src/main/java/com/alipay/sofa/serverless/arklet/core/command/coordinate/BizOpsCommandCoordinator.java rename to sofa-serverless-runtime/arklet-core/src/main/java/com/alipay/sofa/serverless/arklet/core/command/coordinate/BizOpsCommandCoordinator.java diff --git a/arklet/arklet-core/src/main/java/com/alipay/sofa/serverless/arklet/core/command/executor/ExecutorServiceManager.java b/sofa-serverless-runtime/arklet-core/src/main/java/com/alipay/sofa/serverless/arklet/core/command/executor/ExecutorServiceManager.java similarity index 100% rename from arklet/arklet-core/src/main/java/com/alipay/sofa/serverless/arklet/core/command/executor/ExecutorServiceManager.java rename to sofa-serverless-runtime/arklet-core/src/main/java/com/alipay/sofa/serverless/arklet/core/command/executor/ExecutorServiceManager.java diff --git a/arklet/arklet-core/src/main/java/com/alipay/sofa/serverless/arklet/core/command/executor/NamedThreadFactory.java b/sofa-serverless-runtime/arklet-core/src/main/java/com/alipay/sofa/serverless/arklet/core/command/executor/NamedThreadFactory.java similarity index 100% rename from arklet/arklet-core/src/main/java/com/alipay/sofa/serverless/arklet/core/command/executor/NamedThreadFactory.java rename to sofa-serverless-runtime/arklet-core/src/main/java/com/alipay/sofa/serverless/arklet/core/command/executor/NamedThreadFactory.java diff --git a/arklet/arklet-core/src/main/java/com/alipay/sofa/serverless/arklet/core/command/meta/AbstractCommandHandler.java b/sofa-serverless-runtime/arklet-core/src/main/java/com/alipay/sofa/serverless/arklet/core/command/meta/AbstractCommandHandler.java similarity index 100% rename from arklet/arklet-core/src/main/java/com/alipay/sofa/serverless/arklet/core/command/meta/AbstractCommandHandler.java rename to sofa-serverless-runtime/arklet-core/src/main/java/com/alipay/sofa/serverless/arklet/core/command/meta/AbstractCommandHandler.java diff --git a/arklet/arklet-core/src/main/java/com/alipay/sofa/serverless/arklet/core/command/meta/Command.java b/sofa-serverless-runtime/arklet-core/src/main/java/com/alipay/sofa/serverless/arklet/core/command/meta/Command.java similarity index 100% rename from arklet/arklet-core/src/main/java/com/alipay/sofa/serverless/arklet/core/command/meta/Command.java rename to sofa-serverless-runtime/arklet-core/src/main/java/com/alipay/sofa/serverless/arklet/core/command/meta/Command.java diff --git a/arklet/arklet-core/src/main/java/com/alipay/sofa/serverless/arklet/core/command/meta/InputMeta.java b/sofa-serverless-runtime/arklet-core/src/main/java/com/alipay/sofa/serverless/arklet/core/command/meta/InputMeta.java similarity index 100% rename from arklet/arklet-core/src/main/java/com/alipay/sofa/serverless/arklet/core/command/meta/InputMeta.java rename to sofa-serverless-runtime/arklet-core/src/main/java/com/alipay/sofa/serverless/arklet/core/command/meta/InputMeta.java diff --git a/arklet/arklet-core/src/main/java/com/alipay/sofa/serverless/arklet/core/command/meta/Output.java b/sofa-serverless-runtime/arklet-core/src/main/java/com/alipay/sofa/serverless/arklet/core/command/meta/Output.java similarity index 100% rename from arklet/arklet-core/src/main/java/com/alipay/sofa/serverless/arklet/core/command/meta/Output.java rename to sofa-serverless-runtime/arklet-core/src/main/java/com/alipay/sofa/serverless/arklet/core/command/meta/Output.java diff --git a/arklet/arklet-core/src/main/java/com/alipay/sofa/serverless/arklet/core/command/meta/bizops/ArkBizMeta.java b/sofa-serverless-runtime/arklet-core/src/main/java/com/alipay/sofa/serverless/arklet/core/command/meta/bizops/ArkBizMeta.java similarity index 100% rename from arklet/arklet-core/src/main/java/com/alipay/sofa/serverless/arklet/core/command/meta/bizops/ArkBizMeta.java rename to sofa-serverless-runtime/arklet-core/src/main/java/com/alipay/sofa/serverless/arklet/core/command/meta/bizops/ArkBizMeta.java diff --git a/arklet/arklet-core/src/main/java/com/alipay/sofa/serverless/arklet/core/command/meta/bizops/ArkBizOps.java b/sofa-serverless-runtime/arklet-core/src/main/java/com/alipay/sofa/serverless/arklet/core/command/meta/bizops/ArkBizOps.java similarity index 100% rename from arklet/arklet-core/src/main/java/com/alipay/sofa/serverless/arklet/core/command/meta/bizops/ArkBizOps.java rename to sofa-serverless-runtime/arklet-core/src/main/java/com/alipay/sofa/serverless/arklet/core/command/meta/bizops/ArkBizOps.java diff --git a/arklet/arklet-core/src/main/java/com/alipay/sofa/serverless/arklet/core/command/record/ProcessRecord.java b/sofa-serverless-runtime/arklet-core/src/main/java/com/alipay/sofa/serverless/arklet/core/command/record/ProcessRecord.java similarity index 100% rename from arklet/arklet-core/src/main/java/com/alipay/sofa/serverless/arklet/core/command/record/ProcessRecord.java rename to sofa-serverless-runtime/arklet-core/src/main/java/com/alipay/sofa/serverless/arklet/core/command/record/ProcessRecord.java diff --git a/arklet/arklet-core/src/main/java/com/alipay/sofa/serverless/arklet/core/command/record/ProcessRecordHolder.java b/sofa-serverless-runtime/arklet-core/src/main/java/com/alipay/sofa/serverless/arklet/core/command/record/ProcessRecordHolder.java similarity index 100% rename from arklet/arklet-core/src/main/java/com/alipay/sofa/serverless/arklet/core/command/record/ProcessRecordHolder.java rename to sofa-serverless-runtime/arklet-core/src/main/java/com/alipay/sofa/serverless/arklet/core/command/record/ProcessRecordHolder.java diff --git a/arklet/arklet-core/src/main/java/com/alipay/sofa/serverless/arklet/core/common/exception/ArkletException.java b/sofa-serverless-runtime/arklet-core/src/main/java/com/alipay/sofa/serverless/arklet/core/common/exception/ArkletException.java similarity index 100% rename from arklet/arklet-core/src/main/java/com/alipay/sofa/serverless/arklet/core/common/exception/ArkletException.java rename to sofa-serverless-runtime/arklet-core/src/main/java/com/alipay/sofa/serverless/arklet/core/common/exception/ArkletException.java diff --git a/arklet/arklet-core/src/main/java/com/alipay/sofa/serverless/arklet/core/common/exception/ArkletInitException.java b/sofa-serverless-runtime/arklet-core/src/main/java/com/alipay/sofa/serverless/arklet/core/common/exception/ArkletInitException.java similarity index 100% rename from arklet/arklet-core/src/main/java/com/alipay/sofa/serverless/arklet/core/common/exception/ArkletInitException.java rename to sofa-serverless-runtime/arklet-core/src/main/java/com/alipay/sofa/serverless/arklet/core/common/exception/ArkletInitException.java diff --git a/arklet/arklet-core/src/main/java/com/alipay/sofa/serverless/arklet/core/common/exception/ArkletRuntimeException.java b/sofa-serverless-runtime/arklet-core/src/main/java/com/alipay/sofa/serverless/arklet/core/common/exception/ArkletRuntimeException.java similarity index 100% rename from arklet/arklet-core/src/main/java/com/alipay/sofa/serverless/arklet/core/common/exception/ArkletRuntimeException.java rename to sofa-serverless-runtime/arklet-core/src/main/java/com/alipay/sofa/serverless/arklet/core/common/exception/ArkletRuntimeException.java diff --git a/arklet/arklet-core/src/main/java/com/alipay/sofa/serverless/arklet/core/common/exception/CommandValidationException.java b/sofa-serverless-runtime/arklet-core/src/main/java/com/alipay/sofa/serverless/arklet/core/common/exception/CommandValidationException.java similarity index 100% rename from arklet/arklet-core/src/main/java/com/alipay/sofa/serverless/arklet/core/common/exception/CommandValidationException.java rename to sofa-serverless-runtime/arklet-core/src/main/java/com/alipay/sofa/serverless/arklet/core/common/exception/CommandValidationException.java diff --git a/arklet/arklet-core/src/main/java/com/alipay/sofa/serverless/arklet/core/common/log/ArkletLogger.java b/sofa-serverless-runtime/arklet-core/src/main/java/com/alipay/sofa/serverless/arklet/core/common/log/ArkletLogger.java similarity index 100% rename from arklet/arklet-core/src/main/java/com/alipay/sofa/serverless/arklet/core/common/log/ArkletLogger.java rename to sofa-serverless-runtime/arklet-core/src/main/java/com/alipay/sofa/serverless/arklet/core/common/log/ArkletLogger.java diff --git a/arklet/arklet-core/src/main/java/com/alipay/sofa/serverless/arklet/core/common/log/ArkletLoggerFactory.java b/sofa-serverless-runtime/arklet-core/src/main/java/com/alipay/sofa/serverless/arklet/core/common/log/ArkletLoggerFactory.java similarity index 100% rename from arklet/arklet-core/src/main/java/com/alipay/sofa/serverless/arklet/core/common/log/ArkletLoggerFactory.java rename to sofa-serverless-runtime/arklet-core/src/main/java/com/alipay/sofa/serverless/arklet/core/common/log/ArkletLoggerFactory.java diff --git a/arklet/arklet-core/src/main/java/com/alipay/sofa/serverless/arklet/core/health/HealthService.java b/sofa-serverless-runtime/arklet-core/src/main/java/com/alipay/sofa/serverless/arklet/core/health/HealthService.java similarity index 100% rename from arklet/arklet-core/src/main/java/com/alipay/sofa/serverless/arklet/core/health/HealthService.java rename to sofa-serverless-runtime/arklet-core/src/main/java/com/alipay/sofa/serverless/arklet/core/health/HealthService.java diff --git a/arklet/arklet-core/src/main/java/com/alipay/sofa/serverless/arklet/core/health/HealthServiceImpl.java b/sofa-serverless-runtime/arklet-core/src/main/java/com/alipay/sofa/serverless/arklet/core/health/HealthServiceImpl.java similarity index 100% rename from arklet/arklet-core/src/main/java/com/alipay/sofa/serverless/arklet/core/health/HealthServiceImpl.java rename to sofa-serverless-runtime/arklet-core/src/main/java/com/alipay/sofa/serverless/arklet/core/health/HealthServiceImpl.java diff --git a/arklet/arklet-core/src/main/java/com/alipay/sofa/serverless/arklet/core/health/indicator/ArkletBaseIndicator.java b/sofa-serverless-runtime/arklet-core/src/main/java/com/alipay/sofa/serverless/arklet/core/health/indicator/ArkletBaseIndicator.java similarity index 100% rename from arklet/arklet-core/src/main/java/com/alipay/sofa/serverless/arklet/core/health/indicator/ArkletBaseIndicator.java rename to sofa-serverless-runtime/arklet-core/src/main/java/com/alipay/sofa/serverless/arklet/core/health/indicator/ArkletBaseIndicator.java diff --git a/arklet/arklet-core/src/main/java/com/alipay/sofa/serverless/arklet/core/health/indicator/CpuIndicator.java b/sofa-serverless-runtime/arklet-core/src/main/java/com/alipay/sofa/serverless/arklet/core/health/indicator/CpuIndicator.java similarity index 100% rename from arklet/arklet-core/src/main/java/com/alipay/sofa/serverless/arklet/core/health/indicator/CpuIndicator.java rename to sofa-serverless-runtime/arklet-core/src/main/java/com/alipay/sofa/serverless/arklet/core/health/indicator/CpuIndicator.java diff --git a/arklet/arklet-core/src/main/java/com/alipay/sofa/serverless/arklet/core/health/indicator/JvmIndicator.java b/sofa-serverless-runtime/arklet-core/src/main/java/com/alipay/sofa/serverless/arklet/core/health/indicator/JvmIndicator.java similarity index 100% rename from arklet/arklet-core/src/main/java/com/alipay/sofa/serverless/arklet/core/health/indicator/JvmIndicator.java rename to sofa-serverless-runtime/arklet-core/src/main/java/com/alipay/sofa/serverless/arklet/core/health/indicator/JvmIndicator.java diff --git a/arklet/arklet-core/src/main/java/com/alipay/sofa/serverless/arklet/core/health/model/BizHealthMeta.java b/sofa-serverless-runtime/arklet-core/src/main/java/com/alipay/sofa/serverless/arklet/core/health/model/BizHealthMeta.java similarity index 100% rename from arklet/arklet-core/src/main/java/com/alipay/sofa/serverless/arklet/core/health/model/BizHealthMeta.java rename to sofa-serverless-runtime/arklet-core/src/main/java/com/alipay/sofa/serverless/arklet/core/health/model/BizHealthMeta.java diff --git a/arklet/arklet-core/src/main/java/com/alipay/sofa/serverless/arklet/core/health/model/Constants.java b/sofa-serverless-runtime/arklet-core/src/main/java/com/alipay/sofa/serverless/arklet/core/health/model/Constants.java similarity index 100% rename from arklet/arklet-core/src/main/java/com/alipay/sofa/serverless/arklet/core/health/model/Constants.java rename to sofa-serverless-runtime/arklet-core/src/main/java/com/alipay/sofa/serverless/arklet/core/health/model/Constants.java diff --git a/arklet/arklet-core/src/main/java/com/alipay/sofa/serverless/arklet/core/health/model/Health.java b/sofa-serverless-runtime/arklet-core/src/main/java/com/alipay/sofa/serverless/arklet/core/health/model/Health.java similarity index 100% rename from arklet/arklet-core/src/main/java/com/alipay/sofa/serverless/arklet/core/health/model/Health.java rename to sofa-serverless-runtime/arklet-core/src/main/java/com/alipay/sofa/serverless/arklet/core/health/model/Health.java diff --git a/arklet/arklet-core/src/main/java/com/alipay/sofa/serverless/arklet/core/health/model/PluginHealthMeta.java b/sofa-serverless-runtime/arklet-core/src/main/java/com/alipay/sofa/serverless/arklet/core/health/model/PluginHealthMeta.java similarity index 100% rename from arklet/arklet-core/src/main/java/com/alipay/sofa/serverless/arklet/core/health/model/PluginHealthMeta.java rename to sofa-serverless-runtime/arklet-core/src/main/java/com/alipay/sofa/serverless/arklet/core/health/model/PluginHealthMeta.java diff --git a/arklet/arklet-core/src/main/java/com/alipay/sofa/serverless/arklet/core/ops/UnifiedOperationService.java b/sofa-serverless-runtime/arklet-core/src/main/java/com/alipay/sofa/serverless/arklet/core/ops/UnifiedOperationService.java similarity index 100% rename from arklet/arklet-core/src/main/java/com/alipay/sofa/serverless/arklet/core/ops/UnifiedOperationService.java rename to sofa-serverless-runtime/arklet-core/src/main/java/com/alipay/sofa/serverless/arklet/core/ops/UnifiedOperationService.java diff --git a/arklet/arklet-core/src/main/java/com/alipay/sofa/serverless/arklet/core/ops/UnifiedOperationServiceImpl.java b/sofa-serverless-runtime/arklet-core/src/main/java/com/alipay/sofa/serverless/arklet/core/ops/UnifiedOperationServiceImpl.java similarity index 100% rename from arklet/arklet-core/src/main/java/com/alipay/sofa/serverless/arklet/core/ops/UnifiedOperationServiceImpl.java rename to sofa-serverless-runtime/arklet-core/src/main/java/com/alipay/sofa/serverless/arklet/core/ops/UnifiedOperationServiceImpl.java diff --git a/arklet/arklet-core/src/main/java/com/alipay/sofa/serverless/arklet/core/util/AssertUtils.java b/sofa-serverless-runtime/arklet-core/src/main/java/com/alipay/sofa/serverless/arklet/core/util/AssertUtils.java similarity index 100% rename from arklet/arklet-core/src/main/java/com/alipay/sofa/serverless/arklet/core/util/AssertUtils.java rename to sofa-serverless-runtime/arklet-core/src/main/java/com/alipay/sofa/serverless/arklet/core/util/AssertUtils.java diff --git a/arklet/arklet-core/src/main/java/com/alipay/sofa/serverless/arklet/core/util/ConvertUtils.java b/sofa-serverless-runtime/arklet-core/src/main/java/com/alipay/sofa/serverless/arklet/core/util/ConvertUtils.java similarity index 100% rename from arklet/arklet-core/src/main/java/com/alipay/sofa/serverless/arklet/core/util/ConvertUtils.java rename to sofa-serverless-runtime/arklet-core/src/main/java/com/alipay/sofa/serverless/arklet/core/util/ConvertUtils.java diff --git a/arklet/arklet-core/src/main/resources/com/alipay/sofa/arklet/log/log4j/log-conf.xml b/sofa-serverless-runtime/arklet-core/src/main/resources/com/alipay/sofa/arklet/log/log4j/log-conf.xml similarity index 100% rename from arklet/arklet-core/src/main/resources/com/alipay/sofa/arklet/log/log4j/log-conf.xml rename to sofa-serverless-runtime/arklet-core/src/main/resources/com/alipay/sofa/arklet/log/log4j/log-conf.xml diff --git a/arklet/arklet-core/src/main/resources/com/alipay/sofa/arklet/log/log4j2/log-conf.xml b/sofa-serverless-runtime/arklet-core/src/main/resources/com/alipay/sofa/arklet/log/log4j2/log-conf.xml similarity index 100% rename from arklet/arklet-core/src/main/resources/com/alipay/sofa/arklet/log/log4j2/log-conf.xml rename to sofa-serverless-runtime/arklet-core/src/main/resources/com/alipay/sofa/arklet/log/log4j2/log-conf.xml diff --git a/arklet/arklet-core/src/main/resources/com/alipay/sofa/arklet/log/logback/log-conf.xml b/sofa-serverless-runtime/arklet-core/src/main/resources/com/alipay/sofa/arklet/log/logback/log-conf.xml similarity index 100% rename from arklet/arklet-core/src/main/resources/com/alipay/sofa/arklet/log/logback/log-conf.xml rename to sofa-serverless-runtime/arklet-core/src/main/resources/com/alipay/sofa/arklet/log/logback/log-conf.xml diff --git a/arklet/arklet-core/src/test/java/com/alipay/sofa/serverless/arklet/core/BaseTest.java b/sofa-serverless-runtime/arklet-core/src/test/java/com/alipay/sofa/serverless/arklet/core/BaseTest.java similarity index 100% rename from arklet/arklet-core/src/test/java/com/alipay/sofa/serverless/arklet/core/BaseTest.java rename to sofa-serverless-runtime/arklet-core/src/test/java/com/alipay/sofa/serverless/arklet/core/BaseTest.java diff --git a/arklet/arklet-core/src/test/java/com/alipay/sofa/serverless/arklet/core/command/BizOpsCommandCoordinatorTests.java b/sofa-serverless-runtime/arklet-core/src/test/java/com/alipay/sofa/serverless/arklet/core/command/BizOpsCommandCoordinatorTests.java similarity index 100% rename from arklet/arklet-core/src/test/java/com/alipay/sofa/serverless/arklet/core/command/BizOpsCommandCoordinatorTests.java rename to sofa-serverless-runtime/arklet-core/src/test/java/com/alipay/sofa/serverless/arklet/core/command/BizOpsCommandCoordinatorTests.java diff --git a/arklet/arklet-core/src/test/java/com/alipay/sofa/serverless/arklet/core/command/CommandTests.java b/sofa-serverless-runtime/arklet-core/src/test/java/com/alipay/sofa/serverless/arklet/core/command/CommandTests.java similarity index 100% rename from arklet/arklet-core/src/test/java/com/alipay/sofa/serverless/arklet/core/command/CommandTests.java rename to sofa-serverless-runtime/arklet-core/src/test/java/com/alipay/sofa/serverless/arklet/core/command/CommandTests.java diff --git a/arklet/arklet-core/src/test/java/com/alipay/sofa/serverless/arklet/core/command/HelpHandlerTests.java b/sofa-serverless-runtime/arklet-core/src/test/java/com/alipay/sofa/serverless/arklet/core/command/HelpHandlerTests.java similarity index 100% rename from arklet/arklet-core/src/test/java/com/alipay/sofa/serverless/arklet/core/command/HelpHandlerTests.java rename to sofa-serverless-runtime/arklet-core/src/test/java/com/alipay/sofa/serverless/arklet/core/command/HelpHandlerTests.java diff --git a/arklet/arklet-core/src/test/java/com/alipay/sofa/serverless/arklet/core/command/InstallBizHandlerTests.java b/sofa-serverless-runtime/arklet-core/src/test/java/com/alipay/sofa/serverless/arklet/core/command/InstallBizHandlerTests.java similarity index 100% rename from arklet/arklet-core/src/test/java/com/alipay/sofa/serverless/arklet/core/command/InstallBizHandlerTests.java rename to sofa-serverless-runtime/arklet-core/src/test/java/com/alipay/sofa/serverless/arklet/core/command/InstallBizHandlerTests.java diff --git a/arklet/arklet-core/src/test/java/com/alipay/sofa/serverless/arklet/core/command/custom/CustomCommand.java b/sofa-serverless-runtime/arklet-core/src/test/java/com/alipay/sofa/serverless/arklet/core/command/custom/CustomCommand.java similarity index 100% rename from arklet/arklet-core/src/test/java/com/alipay/sofa/serverless/arklet/core/command/custom/CustomCommand.java rename to sofa-serverless-runtime/arklet-core/src/test/java/com/alipay/sofa/serverless/arklet/core/command/custom/CustomCommand.java diff --git a/arklet/arklet-core/src/test/java/com/alipay/sofa/serverless/arklet/core/command/custom/CustomCommandHandler.java b/sofa-serverless-runtime/arklet-core/src/test/java/com/alipay/sofa/serverless/arklet/core/command/custom/CustomCommandHandler.java similarity index 100% rename from arklet/arklet-core/src/test/java/com/alipay/sofa/serverless/arklet/core/command/custom/CustomCommandHandler.java rename to sofa-serverless-runtime/arklet-core/src/test/java/com/alipay/sofa/serverless/arklet/core/command/custom/CustomCommandHandler.java diff --git a/arklet/arklet-core/src/test/java/com/alipay/sofa/serverless/arklet/core/command/custom/Input.java b/sofa-serverless-runtime/arklet-core/src/test/java/com/alipay/sofa/serverless/arklet/core/command/custom/Input.java similarity index 100% rename from arklet/arklet-core/src/test/java/com/alipay/sofa/serverless/arklet/core/command/custom/Input.java rename to sofa-serverless-runtime/arklet-core/src/test/java/com/alipay/sofa/serverless/arklet/core/command/custom/Input.java diff --git a/arklet/arklet-core/src/test/java/com/alipay/sofa/serverless/arklet/core/component/ComponentRegistryTest.java b/sofa-serverless-runtime/arklet-core/src/test/java/com/alipay/sofa/serverless/arklet/core/component/ComponentRegistryTest.java similarity index 100% rename from arklet/arklet-core/src/test/java/com/alipay/sofa/serverless/arklet/core/component/ComponentRegistryTest.java rename to sofa-serverless-runtime/arklet-core/src/test/java/com/alipay/sofa/serverless/arklet/core/component/ComponentRegistryTest.java diff --git a/arklet/arklet-core/src/test/java/com/alipay/sofa/serverless/arklet/core/health/HealthTests.java b/sofa-serverless-runtime/arklet-core/src/test/java/com/alipay/sofa/serverless/arklet/core/health/HealthTests.java similarity index 100% rename from arklet/arklet-core/src/test/java/com/alipay/sofa/serverless/arklet/core/health/HealthTests.java rename to sofa-serverless-runtime/arklet-core/src/test/java/com/alipay/sofa/serverless/arklet/core/health/HealthTests.java diff --git a/arklet/arklet-core/src/test/java/com/alipay/sofa/serverless/arklet/core/health/custom/CustomIndicator.java b/sofa-serverless-runtime/arklet-core/src/test/java/com/alipay/sofa/serverless/arklet/core/health/custom/CustomIndicator.java similarity index 100% rename from arklet/arklet-core/src/test/java/com/alipay/sofa/serverless/arklet/core/health/custom/CustomIndicator.java rename to sofa-serverless-runtime/arklet-core/src/test/java/com/alipay/sofa/serverless/arklet/core/health/custom/CustomIndicator.java diff --git a/arklet/arklet-core/src/test/java/com/alipay/sofa/serverless/arklet/core/health/indicator/IndicatorTests.java b/sofa-serverless-runtime/arklet-core/src/test/java/com/alipay/sofa/serverless/arklet/core/health/indicator/IndicatorTests.java similarity index 100% rename from arklet/arklet-core/src/test/java/com/alipay/sofa/serverless/arklet/core/health/indicator/IndicatorTests.java rename to sofa-serverless-runtime/arklet-core/src/test/java/com/alipay/sofa/serverless/arklet/core/health/indicator/IndicatorTests.java diff --git a/arklet/arklet-core/src/test/resources/test-biz.jar b/sofa-serverless-runtime/arklet-core/src/test/resources/test-biz.jar similarity index 100% rename from arklet/arklet-core/src/test/resources/test-biz.jar rename to sofa-serverless-runtime/arklet-core/src/test/resources/test-biz.jar diff --git a/arklet/arklet-springboot-starter/pom.xml b/sofa-serverless-runtime/arklet-springboot-starter/pom.xml similarity index 91% rename from arklet/arklet-springboot-starter/pom.xml rename to sofa-serverless-runtime/arklet-springboot-starter/pom.xml index 7ec92f8ea..7de80dc29 100644 --- a/arklet/arklet-springboot-starter/pom.xml +++ b/sofa-serverless-runtime/arklet-springboot-starter/pom.xml @@ -3,7 +3,7 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> - arklet + sofa-serverless-runtime com.alipay.sofa.serverless ${revision} ../pom.xml @@ -36,6 +36,12 @@ provided + + com.alipay.sofa.serverless + sofa-serverless-common + provided + + org.springframework.boot diff --git a/arklet/arklet-springboot-starter/src/main/java/com/alipay/sofa/serverless/arklet/springboot/starter/ArkletAutoConfiguration.java b/sofa-serverless-runtime/arklet-springboot-starter/src/main/java/com/alipay/sofa/serverless/arklet/springboot/starter/ArkletAutoConfiguration.java similarity index 94% rename from arklet/arklet-springboot-starter/src/main/java/com/alipay/sofa/serverless/arklet/springboot/starter/ArkletAutoConfiguration.java rename to sofa-serverless-runtime/arklet-springboot-starter/src/main/java/com/alipay/sofa/serverless/arklet/springboot/starter/ArkletAutoConfiguration.java index e95915e31..422b11e42 100644 --- a/arklet/arklet-springboot-starter/src/main/java/com/alipay/sofa/serverless/arklet/springboot/starter/ArkletAutoConfiguration.java +++ b/sofa-serverless-runtime/arklet-springboot-starter/src/main/java/com/alipay/sofa/serverless/arklet/springboot/starter/ArkletAutoConfiguration.java @@ -18,7 +18,7 @@ import com.alipay.sofa.serverless.arklet.core.ArkletComponentRegistry; import com.alipay.sofa.serverless.arklet.springboot.starter.command.MasterBizCmdHandlerCollector; -import com.alipay.sofa.serverless.arklet.springboot.starter.environment.ConditionalOnMasterBiz; +import com.alipay.sofa.serverless.common.environment.ConditionalOnMasterBiz; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.DependsOn; diff --git a/arklet/arklet-springboot-starter/src/main/java/com/alipay/sofa/serverless/arklet/springboot/starter/command/MasterBizCmdHandlerCollector.java b/sofa-serverless-runtime/arklet-springboot-starter/src/main/java/com/alipay/sofa/serverless/arklet/springboot/starter/command/MasterBizCmdHandlerCollector.java similarity index 100% rename from arklet/arklet-springboot-starter/src/main/java/com/alipay/sofa/serverless/arklet/springboot/starter/command/MasterBizCmdHandlerCollector.java rename to sofa-serverless-runtime/arklet-springboot-starter/src/main/java/com/alipay/sofa/serverless/arklet/springboot/starter/command/MasterBizCmdHandlerCollector.java diff --git a/arklet/arklet-springboot-starter/src/main/java/com/alipay/sofa/serverless/arklet/springboot/starter/health/HealthAutoConfiguration.java b/sofa-serverless-runtime/arklet-springboot-starter/src/main/java/com/alipay/sofa/serverless/arklet/springboot/starter/health/HealthAutoConfiguration.java similarity index 97% rename from arklet/arklet-springboot-starter/src/main/java/com/alipay/sofa/serverless/arklet/springboot/starter/health/HealthAutoConfiguration.java rename to sofa-serverless-runtime/arklet-springboot-starter/src/main/java/com/alipay/sofa/serverless/arklet/springboot/starter/health/HealthAutoConfiguration.java index 962b99875..c83be2610 100644 --- a/arklet/arklet-springboot-starter/src/main/java/com/alipay/sofa/serverless/arklet/springboot/starter/health/HealthAutoConfiguration.java +++ b/sofa-serverless-runtime/arklet-springboot-starter/src/main/java/com/alipay/sofa/serverless/arklet/springboot/starter/health/HealthAutoConfiguration.java @@ -20,7 +20,7 @@ import com.alipay.sofa.serverless.arklet.springboot.starter.health.endpoint.ArkHealthCodeEndpoint; import com.alipay.sofa.serverless.arklet.springboot.starter.health.endpoint.ArkHealthzEndpoint; import com.alipay.sofa.serverless.arklet.springboot.starter.health.extension.indicator.MasterBizHealthIndicator; -import com.alipay.sofa.serverless.arklet.springboot.starter.environment.ConditionalOnMasterBiz; +import com.alipay.sofa.serverless.common.environment.ConditionalOnMasterBiz; import org.springframework.beans.BeansException; import org.springframework.boot.actuate.autoconfigure.endpoint.condition.ConditionalOnAvailableEndpoint; import org.springframework.boot.actuate.autoconfigure.endpoint.web.WebEndpointProperties; diff --git a/arklet/arklet-springboot-starter/src/main/java/com/alipay/sofa/serverless/arklet/springboot/starter/health/endpoint/ArkHealthCodeEndpoint.java b/sofa-serverless-runtime/arklet-springboot-starter/src/main/java/com/alipay/sofa/serverless/arklet/springboot/starter/health/endpoint/ArkHealthCodeEndpoint.java similarity index 100% rename from arklet/arklet-springboot-starter/src/main/java/com/alipay/sofa/serverless/arklet/springboot/starter/health/endpoint/ArkHealthCodeEndpoint.java rename to sofa-serverless-runtime/arklet-springboot-starter/src/main/java/com/alipay/sofa/serverless/arklet/springboot/starter/health/endpoint/ArkHealthCodeEndpoint.java diff --git a/arklet/arklet-springboot-starter/src/main/java/com/alipay/sofa/serverless/arklet/springboot/starter/health/endpoint/ArkHealthzEndpoint.java b/sofa-serverless-runtime/arklet-springboot-starter/src/main/java/com/alipay/sofa/serverless/arklet/springboot/starter/health/endpoint/ArkHealthzEndpoint.java similarity index 100% rename from arklet/arklet-springboot-starter/src/main/java/com/alipay/sofa/serverless/arklet/springboot/starter/health/endpoint/ArkHealthzEndpoint.java rename to sofa-serverless-runtime/arklet-springboot-starter/src/main/java/com/alipay/sofa/serverless/arklet/springboot/starter/health/endpoint/ArkHealthzEndpoint.java diff --git a/arklet/arklet-springboot-starter/src/main/java/com/alipay/sofa/serverless/arklet/springboot/starter/health/endpoint/model/EndpointResponse.java b/sofa-serverless-runtime/arklet-springboot-starter/src/main/java/com/alipay/sofa/serverless/arklet/springboot/starter/health/endpoint/model/EndpointResponse.java similarity index 100% rename from arklet/arklet-springboot-starter/src/main/java/com/alipay/sofa/serverless/arklet/springboot/starter/health/endpoint/model/EndpointResponse.java rename to sofa-serverless-runtime/arklet-springboot-starter/src/main/java/com/alipay/sofa/serverless/arklet/springboot/starter/health/endpoint/model/EndpointResponse.java diff --git a/arklet/arklet-springboot-starter/src/main/java/com/alipay/sofa/serverless/arklet/springboot/starter/health/endpoint/model/EndpointResponseCode.java b/sofa-serverless-runtime/arklet-springboot-starter/src/main/java/com/alipay/sofa/serverless/arklet/springboot/starter/health/endpoint/model/EndpointResponseCode.java similarity index 100% rename from arklet/arklet-springboot-starter/src/main/java/com/alipay/sofa/serverless/arklet/springboot/starter/health/endpoint/model/EndpointResponseCode.java rename to sofa-serverless-runtime/arklet-springboot-starter/src/main/java/com/alipay/sofa/serverless/arklet/springboot/starter/health/endpoint/model/EndpointResponseCode.java diff --git a/arklet/arklet-springboot-starter/src/main/java/com/alipay/sofa/serverless/arklet/springboot/starter/health/extension/indicator/MasterBizHealthIndicator.java b/sofa-serverless-runtime/arklet-springboot-starter/src/main/java/com/alipay/sofa/serverless/arklet/springboot/starter/health/extension/indicator/MasterBizHealthIndicator.java similarity index 100% rename from arklet/arklet-springboot-starter/src/main/java/com/alipay/sofa/serverless/arklet/springboot/starter/health/extension/indicator/MasterBizHealthIndicator.java rename to sofa-serverless-runtime/arklet-springboot-starter/src/main/java/com/alipay/sofa/serverless/arklet/springboot/starter/health/extension/indicator/MasterBizHealthIndicator.java diff --git a/arklet/arklet-springboot-starter/src/main/java/com/alipay/sofa/serverless/arklet/springboot/starter/listener/ArkletApplicationListener.java b/sofa-serverless-runtime/arklet-springboot-starter/src/main/java/com/alipay/sofa/serverless/arklet/springboot/starter/listener/ArkletApplicationListener.java similarity index 100% rename from arklet/arklet-springboot-starter/src/main/java/com/alipay/sofa/serverless/arklet/springboot/starter/listener/ArkletApplicationListener.java rename to sofa-serverless-runtime/arklet-springboot-starter/src/main/java/com/alipay/sofa/serverless/arklet/springboot/starter/listener/ArkletApplicationListener.java diff --git a/arklet/arklet-springboot-starter/src/main/resources/META-INF/spring.factories b/sofa-serverless-runtime/arklet-springboot-starter/src/main/resources/META-INF/spring.factories similarity index 100% rename from arklet/arklet-springboot-starter/src/main/resources/META-INF/spring.factories rename to sofa-serverless-runtime/arklet-springboot-starter/src/main/resources/META-INF/spring.factories diff --git a/arklet/arklet-springboot-starter/src/test/java/com/alipay/sofa/serverless/arklet/spring/BaseSpringApplication.java b/sofa-serverless-runtime/arklet-springboot-starter/src/test/java/com/alipay/sofa/serverless/arklet/spring/BaseSpringApplication.java similarity index 100% rename from arklet/arklet-springboot-starter/src/test/java/com/alipay/sofa/serverless/arklet/spring/BaseSpringApplication.java rename to sofa-serverless-runtime/arklet-springboot-starter/src/test/java/com/alipay/sofa/serverless/arklet/spring/BaseSpringApplication.java diff --git a/arklet/arklet-springboot-starter/src/test/java/com/alipay/sofa/serverless/arklet/spring/SpringbootBaseTest.java b/sofa-serverless-runtime/arklet-springboot-starter/src/test/java/com/alipay/sofa/serverless/arklet/spring/SpringbootBaseTest.java similarity index 100% rename from arklet/arklet-springboot-starter/src/test/java/com/alipay/sofa/serverless/arklet/spring/SpringbootBaseTest.java rename to sofa-serverless-runtime/arklet-springboot-starter/src/test/java/com/alipay/sofa/serverless/arklet/spring/SpringbootBaseTest.java diff --git a/arklet/arklet-springboot-starter/src/test/java/com/alipay/sofa/serverless/arklet/spring/SpringbootRunnerTest.java b/sofa-serverless-runtime/arklet-springboot-starter/src/test/java/com/alipay/sofa/serverless/arklet/spring/SpringbootRunnerTest.java similarity index 100% rename from arklet/arklet-springboot-starter/src/test/java/com/alipay/sofa/serverless/arklet/spring/SpringbootRunnerTest.java rename to sofa-serverless-runtime/arklet-springboot-starter/src/test/java/com/alipay/sofa/serverless/arklet/spring/SpringbootRunnerTest.java diff --git a/arklet/arklet-springboot-starter/src/test/java/com/alipay/sofa/serverless/arklet/spring/common/SpringbootUtil.java b/sofa-serverless-runtime/arklet-springboot-starter/src/test/java/com/alipay/sofa/serverless/arklet/spring/common/SpringbootUtil.java similarity index 100% rename from arklet/arklet-springboot-starter/src/test/java/com/alipay/sofa/serverless/arklet/spring/common/SpringbootUtil.java rename to sofa-serverless-runtime/arklet-springboot-starter/src/test/java/com/alipay/sofa/serverless/arklet/spring/common/SpringbootUtil.java diff --git a/arklet/arklet-springboot-starter/src/test/java/com/alipay/sofa/serverless/arklet/spring/health/endpoint/ArkHealthCodeEndpointTests.java b/sofa-serverless-runtime/arklet-springboot-starter/src/test/java/com/alipay/sofa/serverless/arklet/spring/health/endpoint/ArkHealthCodeEndpointTests.java similarity index 100% rename from arklet/arklet-springboot-starter/src/test/java/com/alipay/sofa/serverless/arklet/spring/health/endpoint/ArkHealthCodeEndpointTests.java rename to sofa-serverless-runtime/arklet-springboot-starter/src/test/java/com/alipay/sofa/serverless/arklet/spring/health/endpoint/ArkHealthCodeEndpointTests.java diff --git a/arklet/arklet-springboot-starter/src/test/java/com/alipay/sofa/serverless/arklet/spring/health/endpoint/ArkHealthzEndpointTests.java b/sofa-serverless-runtime/arklet-springboot-starter/src/test/java/com/alipay/sofa/serverless/arklet/spring/health/endpoint/ArkHealthzEndpointTests.java similarity index 100% rename from arklet/arklet-springboot-starter/src/test/java/com/alipay/sofa/serverless/arklet/spring/health/endpoint/ArkHealthzEndpointTests.java rename to sofa-serverless-runtime/arklet-springboot-starter/src/test/java/com/alipay/sofa/serverless/arklet/spring/health/endpoint/ArkHealthzEndpointTests.java diff --git a/arklet/arklet-springboot-starter/src/test/java/com/alipay/sofa/serverless/arklet/spring/health/extension/indicator/MasterBizHealthIndicatorTests.java b/sofa-serverless-runtime/arklet-springboot-starter/src/test/java/com/alipay/sofa/serverless/arklet/spring/health/extension/indicator/MasterBizHealthIndicatorTests.java similarity index 100% rename from arklet/arklet-springboot-starter/src/test/java/com/alipay/sofa/serverless/arklet/spring/health/extension/indicator/MasterBizHealthIndicatorTests.java rename to sofa-serverless-runtime/arklet-springboot-starter/src/test/java/com/alipay/sofa/serverless/arklet/spring/health/extension/indicator/MasterBizHealthIndicatorTests.java diff --git a/arklet/arklet-springboot-starter/src/test/resources/config/application.properties b/sofa-serverless-runtime/arklet-springboot-starter/src/test/resources/config/application.properties similarity index 100% rename from arklet/arklet-springboot-starter/src/test/resources/config/application.properties rename to sofa-serverless-runtime/arklet-springboot-starter/src/test/resources/config/application.properties diff --git a/arklet/arklet-springboot-starter/src/test/resources/logback.xml b/sofa-serverless-runtime/arklet-springboot-starter/src/test/resources/logback.xml similarity index 100% rename from arklet/arklet-springboot-starter/src/test/resources/logback.xml rename to sofa-serverless-runtime/arklet-springboot-starter/src/test/resources/logback.xml diff --git a/sofa-serverless-runtime/pom.xml b/sofa-serverless-runtime/pom.xml index 1325d1c47..d0aff5dfb 100644 --- a/sofa-serverless-runtime/pom.xml +++ b/sofa-serverless-runtime/pom.xml @@ -9,7 +9,7 @@ pom - 0.1.3 + 0.3.3 UTF-8 UTF-8 1.8 @@ -24,9 +24,18 @@ 8 8 1.5.0 + 6.4.5 + 3.12.0 + 4.0 + 4.1.42.Final + 1.2.9 + 1.18.22 + 32.1.2-jre + 1.2.69 2.7.15 + 4.13.1 + 4.8.1 2.2.3 - 0.3.2 ${project.groupId}:${project.artifactId} @@ -62,17 +71,29 @@ - sofa-serverless-base-common + sofa-serverless-common sofa-serverless-base-starter sofa-serverless-base-plugin sofa-serverless-app-starter + arklet-core + arklet-springboot-starter com.alipay.sofa.serverless - sofa-serverless-base-common + arklet-core + ${revision} + + + com.alipay.sofa.serverless + arklet-springboot-starter + ${revision} + + + com.alipay.sofa.serverless + sofa-serverless-common ${revision} @@ -112,35 +133,119 @@ sofa-ark-api ${sofa.ark.version} + + + + + org.springframework.boot + spring-boot-starter-actuator + ${spring.boot.version} + com.alipay.sofa sofa-ark-springboot-starter ${sofa.ark.version} - - - com.alipay.sofa - sofa-ark-compatible-springboot1 - - - com.alipay.sofa - sofa-ark-compatible-springboot2 - - - - - com.alipay.sofa.serverless - arklet-springboot-starter - ${sofa.serverless.arklet.version} + org.springframework.boot + spring-boot-autoconfigure + ${spring.boot.version} - + org.springframework.boot - spring-boot-starter-actuator + spring-boot-loader ${spring.boot.version} + + + org.springframework.boot + spring-boot-starter-test + ${spring.boot.version} + + + + org.springframework.boot + spring-boot-starter-logging + ${spring.boot.version} + + + + + com.google.inject + guice + ${guice.version} + + + + com.google.inject.extensions + guice-multibindings + ${guice.version} + + + + com.google.guava + guava + ${guava.version} + + + + com.alibaba + fastjson + ${fastjson.version} + + + + io.netty + netty-all + ${netty.version} + + + + ch.qos.logback + logback-classic + ${logback.version} + + + + ch.qos.logback + logback-core + ${logback.version} + + + + org.projectlombok + lombok + ${lombok.version} + + + + + junit + junit + ${junit.version} + test + + + + org.mockito + mockito-core + ${mockito.version} + test + + + + com.github.oshi + oshi-core + ${oshi.version} + + + + org.apache.commons + commons-lang3 + ${commons.lang3.version} + diff --git a/sofa-serverless-runtime/sofa-serverless-app-starter/pom.xml b/sofa-serverless-runtime/sofa-serverless-app-starter/pom.xml index 7eedb4842..7a847d39e 100644 --- a/sofa-serverless-runtime/sofa-serverless-app-starter/pom.xml +++ b/sofa-serverless-runtime/sofa-serverless-app-starter/pom.xml @@ -6,7 +6,7 @@ com.alipay.sofa.serverless sofa-serverless-runtime - 0.1.3 + ${revision} sofa-serverless-app-starter @@ -20,7 +20,7 @@ com.alipay.sofa.serverless - sofa-serverless-base-common + sofa-serverless-common diff --git a/sofa-serverless-runtime/sofa-serverless-base-plugin/pom.xml b/sofa-serverless-runtime/sofa-serverless-base-plugin/pom.xml index 58ec844b3..86591aa31 100644 --- a/sofa-serverless-runtime/sofa-serverless-base-plugin/pom.xml +++ b/sofa-serverless-runtime/sofa-serverless-base-plugin/pom.xml @@ -29,7 +29,7 @@ com.alipay.sofa.serverless - sofa-serverless-base-common + sofa-serverless-common diff --git a/sofa-serverless-runtime/sofa-serverless-base-plugin/src/main/java/com/alipay/sofa/serverless/plugin/manager/handler/ApplicationContextEventHandler.java b/sofa-serverless-runtime/sofa-serverless-base-plugin/src/main/java/com/alipay/sofa/serverless/plugin/manager/handler/ApplicationContextEventHandler.java index 491f56fb3..6c13c9463 100644 --- a/sofa-serverless-runtime/sofa-serverless-base-plugin/src/main/java/com/alipay/sofa/serverless/plugin/manager/handler/ApplicationContextEventHandler.java +++ b/sofa-serverless-runtime/sofa-serverless-base-plugin/src/main/java/com/alipay/sofa/serverless/plugin/manager/handler/ApplicationContextEventHandler.java @@ -21,19 +21,13 @@ import org.springframework.beans.BeansException; import org.springframework.context.ApplicationContext; import org.springframework.context.ApplicationContextAware; -import org.springframework.stereotype.Service; -/** - * TODO: 需要更改成只有在模块里才注册成bean - */ -@Service public class ApplicationContextEventHandler implements ApplicationContextAware { @Override public void setApplicationContext(ApplicationContext applicationContext) throws BeansException { BizRuntimeContext bizRuntimeContext = BizRuntimeContextRegistry .getBizRuntimeContextByClassLoader(applicationContext.getClassLoader()); - BizRuntimeContextRegistry.unRegisterSofaRuntimeManager(bizRuntimeContext); bizRuntimeContext.setRootApplicationContext(applicationContext); } } \ No newline at end of file diff --git a/sofa-serverless-runtime/sofa-serverless-base-plugin/src/main/java/com/alipay/sofa/serverless/plugin/manager/handler/BizUninstallEventHandler.java b/sofa-serverless-runtime/sofa-serverless-base-plugin/src/main/java/com/alipay/sofa/serverless/plugin/manager/handler/BizUninstallEventHandler.java index 130e5ffe7..ea2741c77 100644 --- a/sofa-serverless-runtime/sofa-serverless-base-plugin/src/main/java/com/alipay/sofa/serverless/plugin/manager/handler/BizUninstallEventHandler.java +++ b/sofa-serverless-runtime/sofa-serverless-base-plugin/src/main/java/com/alipay/sofa/serverless/plugin/manager/handler/BizUninstallEventHandler.java @@ -36,6 +36,7 @@ public void handleEvent(BeforeBizStopEvent event) { private void doUninstallBiz(Biz biz) { BizRuntimeContext bizRuntimeContext = BizRuntimeContextRegistry.getBizRuntimeContext(biz); + BizRuntimeContextRegistry.unRegisterBizRuntimeManager(bizRuntimeContext); bizRuntimeContext.shutdown(); } diff --git a/sofa-serverless-runtime/sofa-serverless-base-common/pom.xml b/sofa-serverless-runtime/sofa-serverless-common/pom.xml similarity index 86% rename from sofa-serverless-runtime/sofa-serverless-base-common/pom.xml rename to sofa-serverless-runtime/sofa-serverless-common/pom.xml index 282c3463a..40f4ad0eb 100644 --- a/sofa-serverless-runtime/sofa-serverless-base-common/pom.xml +++ b/sofa-serverless-runtime/sofa-serverless-common/pom.xml @@ -9,7 +9,7 @@ ../pom.xml 4.0.0 - sofa-serverless-base-common + sofa-serverless-common ${revision} @@ -33,6 +33,11 @@ org.springframework.boot spring-boot-starter-actuator + + junit + junit + test + \ No newline at end of file diff --git a/sofa-serverless-runtime/sofa-serverless-base-common/src/main/java/com/alipay/sofa/serverless/common/BizRuntimeContext.java b/sofa-serverless-runtime/sofa-serverless-common/src/main/java/com/alipay/sofa/serverless/common/BizRuntimeContext.java similarity index 100% rename from sofa-serverless-runtime/sofa-serverless-base-common/src/main/java/com/alipay/sofa/serverless/common/BizRuntimeContext.java rename to sofa-serverless-runtime/sofa-serverless-common/src/main/java/com/alipay/sofa/serverless/common/BizRuntimeContext.java diff --git a/sofa-serverless-runtime/sofa-serverless-base-common/src/main/java/com/alipay/sofa/serverless/common/BizRuntimeContextRegistry.java b/sofa-serverless-runtime/sofa-serverless-common/src/main/java/com/alipay/sofa/serverless/common/BizRuntimeContextRegistry.java similarity index 94% rename from sofa-serverless-runtime/sofa-serverless-base-common/src/main/java/com/alipay/sofa/serverless/common/BizRuntimeContextRegistry.java rename to sofa-serverless-runtime/sofa-serverless-common/src/main/java/com/alipay/sofa/serverless/common/BizRuntimeContextRegistry.java index d7909d87c..2af91e8e4 100644 --- a/sofa-serverless-runtime/sofa-serverless-base-common/src/main/java/com/alipay/sofa/serverless/common/BizRuntimeContextRegistry.java +++ b/sofa-serverless-runtime/sofa-serverless-common/src/main/java/com/alipay/sofa/serverless/common/BizRuntimeContextRegistry.java @@ -32,8 +32,9 @@ public static void registerSpringContext(BizRuntimeContext bizRuntimeContext) { contextMap.put(bizRuntimeContext.getAppClassLoader(), bizRuntimeContext); } - public static void unRegisterSofaRuntimeManager(BizRuntimeContext sofaRuntimeManager) { - contextMap.remove(sofaRuntimeManager.getAppClassLoader()); + public static void unRegisterBizRuntimeManager(BizRuntimeContext bizRuntimeContext) { + contextMap.remove(bizRuntimeContext.getAppClassLoader()); + } public static Set getRuntimeSet() { diff --git a/sofa-serverless-runtime/sofa-serverless-base-common/src/main/java/com/alipay/sofa/serverless/common/environment/ConditionalOnMasterBiz.java b/sofa-serverless-runtime/sofa-serverless-common/src/main/java/com/alipay/sofa/serverless/common/environment/ConditionalOnMasterBiz.java similarity index 100% rename from sofa-serverless-runtime/sofa-serverless-base-common/src/main/java/com/alipay/sofa/serverless/common/environment/ConditionalOnMasterBiz.java rename to sofa-serverless-runtime/sofa-serverless-common/src/main/java/com/alipay/sofa/serverless/common/environment/ConditionalOnMasterBiz.java diff --git a/sofa-serverless-runtime/sofa-serverless-base-common/src/main/java/com/alipay/sofa/serverless/common/environment/ConditionalOnNotMasterBiz.java b/sofa-serverless-runtime/sofa-serverless-common/src/main/java/com/alipay/sofa/serverless/common/environment/ConditionalOnNotMasterBiz.java similarity index 100% rename from sofa-serverless-runtime/sofa-serverless-base-common/src/main/java/com/alipay/sofa/serverless/common/environment/ConditionalOnNotMasterBiz.java rename to sofa-serverless-runtime/sofa-serverless-common/src/main/java/com/alipay/sofa/serverless/common/environment/ConditionalOnNotMasterBiz.java diff --git a/sofa-serverless-runtime/sofa-serverless-base-common/src/main/java/com/alipay/sofa/serverless/common/environment/OnMasterBiz.java b/sofa-serverless-runtime/sofa-serverless-common/src/main/java/com/alipay/sofa/serverless/common/environment/OnMasterBiz.java similarity index 100% rename from sofa-serverless-runtime/sofa-serverless-base-common/src/main/java/com/alipay/sofa/serverless/common/environment/OnMasterBiz.java rename to sofa-serverless-runtime/sofa-serverless-common/src/main/java/com/alipay/sofa/serverless/common/environment/OnMasterBiz.java diff --git a/sofa-serverless-runtime/sofa-serverless-base-common/src/main/java/com/alipay/sofa/serverless/common/environment/OnNotMasterBiz.java b/sofa-serverless-runtime/sofa-serverless-common/src/main/java/com/alipay/sofa/serverless/common/environment/OnNotMasterBiz.java similarity index 100% rename from sofa-serverless-runtime/sofa-serverless-base-common/src/main/java/com/alipay/sofa/serverless/common/environment/OnNotMasterBiz.java rename to sofa-serverless-runtime/sofa-serverless-common/src/main/java/com/alipay/sofa/serverless/common/environment/OnNotMasterBiz.java diff --git a/sofa-serverless-runtime/sofa-serverless-base-common/src/main/java/com/alipay/sofa/serverless/common/exception/BizRuntimeException.java b/sofa-serverless-runtime/sofa-serverless-common/src/main/java/com/alipay/sofa/serverless/common/exception/BizRuntimeException.java similarity index 100% rename from sofa-serverless-runtime/sofa-serverless-base-common/src/main/java/com/alipay/sofa/serverless/common/exception/BizRuntimeException.java rename to sofa-serverless-runtime/sofa-serverless-common/src/main/java/com/alipay/sofa/serverless/common/exception/BizRuntimeException.java diff --git a/sofa-serverless-runtime/sofa-serverless-base-common/src/main/java/com/alipay/sofa/serverless/common/exception/ErrorCodes.java b/sofa-serverless-runtime/sofa-serverless-common/src/main/java/com/alipay/sofa/serverless/common/exception/ErrorCodes.java similarity index 100% rename from sofa-serverless-runtime/sofa-serverless-base-common/src/main/java/com/alipay/sofa/serverless/common/exception/ErrorCodes.java rename to sofa-serverless-runtime/sofa-serverless-common/src/main/java/com/alipay/sofa/serverless/common/exception/ErrorCodes.java From 90f07f1f677406850ea2e53aabf2331ed4c161b2 Mon Sep 17 00:00:00 2001 From: "youji.zzl" Date: Mon, 25 Sep 2023 16:48:39 +0800 Subject: [PATCH 3/6] add test --- .../sofa-serverless-base-plugin/pom.xml | 10 +++ .../plugin/BaseRuntimeAutoConfiguration.java | 2 +- .../handler/BizUninstallEventHandlerTest.java | 77 +++++++++++++++++++ .../sofa-serverless-common/pom.xml | 5 ++ .../serverless/common/ConditionalTest.java | 61 +++++++++++++++ 5 files changed, 154 insertions(+), 1 deletion(-) create mode 100644 sofa-serverless-runtime/sofa-serverless-base-plugin/src/test/java/com/alipay/sofa/serverless/plugin/manager/handler/BizUninstallEventHandlerTest.java create mode 100644 sofa-serverless-runtime/sofa-serverless-common/src/test/java/com/alipay/sofa/serverless/common/ConditionalTest.java diff --git a/sofa-serverless-runtime/sofa-serverless-base-plugin/pom.xml b/sofa-serverless-runtime/sofa-serverless-base-plugin/pom.xml index 86591aa31..88af56b27 100644 --- a/sofa-serverless-runtime/sofa-serverless-base-plugin/pom.xml +++ b/sofa-serverless-runtime/sofa-serverless-base-plugin/pom.xml @@ -31,6 +31,16 @@ com.alipay.sofa.serverless sofa-serverless-common + + org.springframework.boot + spring-boot-starter-test + test + + + junit + junit + test + diff --git a/sofa-serverless-runtime/sofa-serverless-base-plugin/src/main/java/com/alipay/sofa/serverless/plugin/BaseRuntimeAutoConfiguration.java b/sofa-serverless-runtime/sofa-serverless-base-plugin/src/main/java/com/alipay/sofa/serverless/plugin/BaseRuntimeAutoConfiguration.java index 44452f45f..6c94b978b 100644 --- a/sofa-serverless-runtime/sofa-serverless-base-plugin/src/main/java/com/alipay/sofa/serverless/plugin/BaseRuntimeAutoConfiguration.java +++ b/sofa-serverless-runtime/sofa-serverless-base-plugin/src/main/java/com/alipay/sofa/serverless/plugin/BaseRuntimeAutoConfiguration.java @@ -29,7 +29,7 @@ public class BaseRuntimeAutoConfiguration { @Bean - @ConditionalOnNotMasterBiz + // @ConditionalOnNotMasterBiz public ApplicationContextEventHandler applicationContextEventHandler() { return new ApplicationContextEventHandler(); } diff --git a/sofa-serverless-runtime/sofa-serverless-base-plugin/src/test/java/com/alipay/sofa/serverless/plugin/manager/handler/BizUninstallEventHandlerTest.java b/sofa-serverless-runtime/sofa-serverless-base-plugin/src/test/java/com/alipay/sofa/serverless/plugin/manager/handler/BizUninstallEventHandlerTest.java new file mode 100644 index 000000000..f53a047de --- /dev/null +++ b/sofa-serverless-runtime/sofa-serverless-base-plugin/src/test/java/com/alipay/sofa/serverless/plugin/manager/handler/BizUninstallEventHandlerTest.java @@ -0,0 +1,77 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.alipay.sofa.serverless.plugin.manager.handler; + +import com.alipay.sofa.ark.spi.event.biz.BeforeBizStartupEvent; +import com.alipay.sofa.ark.spi.event.biz.BeforeBizStopEvent; +import com.alipay.sofa.ark.spi.model.Biz; +import com.alipay.sofa.serverless.common.BizRuntimeContext; +import com.alipay.sofa.serverless.common.BizRuntimeContextRegistry; +import com.alipay.sofa.serverless.plugin.BaseRuntimeAutoConfiguration; +import org.junit.Assert; +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.mockito.Mock; +import org.mockito.Mockito; +import org.mockito.junit.MockitoJUnitRunner; +import org.springframework.boot.SpringApplication; +import org.springframework.boot.WebApplicationType; +import org.springframework.context.ConfigurableApplicationContext; + +import java.util.Properties; + +@RunWith(MockitoJUnitRunner.class) +public class BizUninstallEventHandlerTest { + private static final String bizName = "eventHandlerTest"; + @Mock + private Biz biz; + + private ConfigurableApplicationContext ctx; + + private SpringApplication springApplication; + + @Before + public void before() { + Properties properties = new Properties(); + properties.setProperty("spring.application.name", bizName); + + springApplication = new SpringApplication(BaseRuntimeAutoConfiguration.class); + springApplication.setDefaultProperties(properties); + + springApplication.setWebApplicationType(WebApplicationType.NONE); + // ctx = springApplication.run(); + } + + @Test + public void handleEvent() { + Mockito.when(biz.getBizName()).thenReturn(bizName); + Mockito.when(biz.getBizClassLoader()).thenReturn(this.getClass().getClassLoader()); + + BeforeBizStartupEventHandler beforeBizStartupEventHandler = new BeforeBizStartupEventHandler(); + beforeBizStartupEventHandler.handleEvent(new BeforeBizStartupEvent(biz)); + + ctx = springApplication.run(); + + BizRuntimeContext bizRuntimeContext = BizRuntimeContextRegistry.getBizRuntimeContext(biz); + Assert.assertEquals(bizRuntimeContext.getRootApplicationContext(), ctx); + + BizUninstallEventHandler bizUninstallEventHandler = new BizUninstallEventHandler(); + bizUninstallEventHandler.handleEvent(new BeforeBizStopEvent(biz)); + Assert.assertFalse(ctx.isActive()); + } +} \ No newline at end of file diff --git a/sofa-serverless-runtime/sofa-serverless-common/pom.xml b/sofa-serverless-runtime/sofa-serverless-common/pom.xml index 40f4ad0eb..6c7b62479 100644 --- a/sofa-serverless-runtime/sofa-serverless-common/pom.xml +++ b/sofa-serverless-runtime/sofa-serverless-common/pom.xml @@ -33,6 +33,11 @@ org.springframework.boot spring-boot-starter-actuator + + org.springframework.boot + spring-boot-starter-test + test + junit junit diff --git a/sofa-serverless-runtime/sofa-serverless-common/src/test/java/com/alipay/sofa/serverless/common/ConditionalTest.java b/sofa-serverless-runtime/sofa-serverless-common/src/test/java/com/alipay/sofa/serverless/common/ConditionalTest.java new file mode 100644 index 000000000..01f2cce0a --- /dev/null +++ b/sofa-serverless-runtime/sofa-serverless-common/src/test/java/com/alipay/sofa/serverless/common/ConditionalTest.java @@ -0,0 +1,61 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.alipay.sofa.serverless.common; + +import com.alipay.sofa.serverless.common.environment.ConditionalOnMasterBiz; +import com.alipay.sofa.serverless.common.environment.ConditionalOnNotMasterBiz; +import com.alipay.sofa.serverless.common.exception.BizRuntimeException; +import com.alipay.sofa.serverless.common.exception.ErrorCodes; +import org.junit.Test; +import org.springframework.boot.context.annotation.UserConfigurations; +import org.springframework.boot.test.context.runner.ApplicationContextRunner; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; + +public class ConditionalTest { + private final ApplicationContextRunner runner = new ApplicationContextRunner() + .withConfiguration(UserConfigurations + .of(ConditionalAutoConfiguration.class)); + + @Test + public void testConditional() { + runner.run(context -> { + context.assertThat().doesNotHaveBean("nonMasterBizRuntimeException"); + context.assertThat().hasBean("masterBizRuntimeException"); + }); + } + + /** + * @author mingmen + * @date 2023/6/14 + */ + @Configuration + public static class ConditionalAutoConfiguration { + + @Bean + @ConditionalOnNotMasterBiz + public BizRuntimeException nonMasterBizRuntimeException() { + return new BizRuntimeException(ErrorCodes.SpringContextManager.E100001, "error test."); + } + + @Bean + @ConditionalOnMasterBiz + public BizRuntimeException masterBizRuntimeException() { + return new BizRuntimeException(ErrorCodes.SpringContextManager.E100002, "error test."); + } + } +} \ No newline at end of file From 1d0a82137ea8a367af0a35a6e460be5ae7b019fa Mon Sep 17 00:00:00 2001 From: "youji.zzl" Date: Mon, 25 Sep 2023 17:07:08 +0800 Subject: [PATCH 4/6] modify github workflow arklet path --- .github/workflows/arklet_release.yml | 6 +- .github/workflows/arklet_unit_test.yml | 12 +- .github/workflows/base_runtime_release.yml | 33 -- sofa-serverless-runtime/README.md | 427 +++++++++++++++++++++ sofa-serverless-runtime/check_format.sh | 13 + 5 files changed, 449 insertions(+), 42 deletions(-) delete mode 100644 .github/workflows/base_runtime_release.yml create mode 100644 sofa-serverless-runtime/README.md create mode 100644 sofa-serverless-runtime/check_format.sh diff --git a/.github/workflows/arklet_release.yml b/.github/workflows/arklet_release.yml index d63c244fe..3bce83201 100644 --- a/.github/workflows/arklet_release.yml +++ b/.github/workflows/arklet_release.yml @@ -1,7 +1,7 @@ # This workflow will build a Java project with Maven, and cache/restore any dependencies to improve the workflow execution time # For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven -name: Arklet Release +name: SOFA Serverless Runtime Release ## https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#release ## trigger manually @@ -21,7 +21,7 @@ jobs: distribution: 'temurin' cache: maven - name: Build with Maven - working-directory: arklet + working-directory: sofa-serverless-runtime run: mvn clean install -DskipTests -B -U -e && sh ./check_format.sh release: needs: build @@ -41,7 +41,7 @@ jobs: gpg-passphrase: MAVEN_GPG_PASSPHRASE # env variable for GPG private key passphrase - name: Build with Maven run: mvn --batch-mode deploy -DskipTests -Prelease - working-directory: arklet + working-directory: sofa-serverless-runtime env: MAVEN_USERNAME: ${{ secrets.MAVEN_USERNAME }} MAVEN_PASSWORD: ${{ secrets.MAVEN_PASSWORD }} diff --git a/.github/workflows/arklet_unit_test.yml b/.github/workflows/arklet_unit_test.yml index f212424e1..dc55233fa 100644 --- a/.github/workflows/arklet_unit_test.yml +++ b/.github/workflows/arklet_unit_test.yml @@ -1,28 +1,28 @@ -name: Arklet Unit Test -run-name: ${{ github.actor }} pushed arklet code +name: SOFAServerless Runtime Unit Test +run-name: ${{ github.actor }} pushed code on: push: branches: - master paths: - - 'arklet/**' + - 'sofa-serverless-runtime/**' pull_request: branches: - master paths: - - 'arklet/**' + - 'sofa-serverless-runtime/**' # enable manually running the workflow workflow_dispatch: env: - WORK_DIR: arklet + WORK_DIR: sofa-serverless-runtime defaults: run: - working-directory: arklet + working-directory: sofa-serverless-runtime jobs: unit-test: diff --git a/.github/workflows/base_runtime_release.yml b/.github/workflows/base_runtime_release.yml deleted file mode 100644 index e1278d8cc..000000000 --- a/.github/workflows/base_runtime_release.yml +++ /dev/null @@ -1,33 +0,0 @@ -# This workflow will build a Java project with Maven, and cache/restore any dependencies to improve the workflow execution time -# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven - -name: Base Runtime Release - -## https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#release -## trigger manually -on: - workflow_dispatch: - -jobs: - release: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - name: Set up JDK 8 - uses: actions/setup-java@v3 - with: - java-version: '8' - distribution: 'temurin' - cache: maven - server-id: ossrh - server-username: MAVEN_USERNAME - server-password: MAVEN_PASSWORD - gpg-private-key: ${{ secrets.MAVEN_GPG_PRIVATE_KEY }} # Value of the GPG private key to import - gpg-passphrase: MAVEN_GPG_PASSPHRASE # env variable for GPG private key passphrase - - name: Build with Maven - run: mvn --batch-mode deploy -DskipTests -Prelease - working-directory: sofa-serverless-runtime-starter - env: - MAVEN_USERNAME: ${{ secrets.MAVEN_USERNAME }} - MAVEN_PASSWORD: ${{ secrets.MAVEN_PASSWORD }} - MAVEN_GPG_PASSPHRASE: ${{ secrets.MAVEN_GPG_PASSPHRASE }} diff --git a/sofa-serverless-runtime/README.md b/sofa-serverless-runtime/README.md new file mode 100644 index 000000000..03a0ab662 --- /dev/null +++ b/sofa-serverless-runtime/README.md @@ -0,0 +1,427 @@ +# Overview + +Arklet provides an operational interface for delivery of SofaArk bases and modules. With Arklet, the release and operation of Ark Biz can be easily and flexibly operated. + +Arklet is internally constructed by **ArkletComponent** + +![image](https://github.com/sofastack/sofa-serverless/assets/11410549/a2740422-569e-4dd3-9c9a-1503996bd2f1) +- ApiClient: The core components responsible for interacting with the outside world +- CommandService: Arklet exposes capability instruction definition and extension +- OperationService: Ark Biz interacts with SofaArk to add, delete, modify, and encapsulate basic capabilities +- HealthService: Based on health and stability, base, Biz, system and other indicators are calculated + +The collaboration between them is shown in the figure +![overview](https://user-images.githubusercontent.com/11410549/266193839-7865e417-6909-4e89-bd48-c926162eaf83.jpg) + + +Of course, you can also extend Arklet's component capabilities by implementing the **ArkletComponent** interface + +# Command Extension +The Arklet exposes the instruction API externally and handles the instruction internally through a CommandHandler mapped from each API. +> CommandHandler related extensions belong to the unified management of the CommandService component + +You can customize extension commands by inheriting **AbstractCommandHandler** + +## Build-in Command API + +All of the following instruction apis access the arklet using the POST(application/json) request format + +The http protocol is enabled and the default port is 1238 +> You can set `sofa.serverless.arklet.http.port` JVM startup parameters override the default port + + +## Query the supported commands +- URL: 127.0.0.1:1238/help +- input sample: +```json +{} +``` +- output sample: +```json +{ + "code":"SUCCESS", + "data":[ + { + "desc":"query all ark biz(including master biz)", + "id":"queryAllBiz" + }, + { + "desc":"list all supported commands", + "id":"help" + }, + { + "desc":"uninstall one ark biz", + "id":"uninstallBiz" + }, + { + "desc":"switch one ark biz", + "id":"switchBiz" + }, + { + "desc":"install one ark biz", + "id":"installBiz" + } + ] +} +``` + +## Install a biz +- URL: 127.0.0.1:1238/installBiz +- input sample: +```json +{ + "bizName": "test", + "bizVersion": "1.0.0", + // local path should start with file://, alse support remote url which can be downloaded + "bizUrl": "file:///Users/jaimezhang/workspace/github/sofa-ark-dynamic-guides/dynamic-provider/target/dynamic-provider-1.0.0-ark-biz.jar" +} +``` + +- output sample(success): +```json +{ + "code":"SUCCESS", + "data":{ + "bizInfos":[ + { + "bizName":"dynamic-provider", + "bizState":"ACTIVATED", + "bizVersion":"1.0.0", + "declaredMode":true, + "identity":"dynamic-provider:1.0.0", + "mainClass":"io.sofastack.dynamic.provider.ProviderApplication", + "priority":100, + "webContextPath":"provider" + } + ], + "code":"SUCCESS", + "message":"Install Biz: dynamic-provider:1.0.0 success, cost: 1092 ms, started at: 16:07:47,769" + } +} +``` + +- output sample(failed): +```json +{ + "code":"FAILED", + "data":{ + "code":"REPEAT_BIZ", + "message":"Biz: dynamic-provider:1.0.0 has been installed or registered." + } +} +``` + + +## Uninstall a biz +- URL: 127.0.0.1:1238/uninstallBiz +- input sample: +```json +{ + "bizName":"dynamic-provider", + "bizVersion":"1.0.0" +} +``` +- output sample(success): +```json +{ + "code":"SUCCESS" +} +``` + +- output sample(failed): +```json +{ + "code":"FAILED", + "data":{ + "code":"NOT_FOUND_BIZ", + "message":"Uninstall biz: test:1.0.0 not found." + } +} +``` + +## Switch a biz +- URL: 127.0.0.1:1238/switchBiz +- input sample: +```json +{ + "bizName":"dynamic-provider", + "bizVersion":"1.0.0" +} +``` +- output sample: +```json +{ + "code":"SUCCESS" +} +``` + +## Query all Biz +- URL: 127.0.0.1:1238/queryAllBiz +- input sample: +```json +{} +``` +- output sample: +```json +{ + "code":"SUCCESS", + "data":[ + { + "bizName":"dynamic-provider", + "bizState":"ACTIVATED", + "bizVersion":"1.0.0", + "mainClass":"io.sofastack.dynamic.provider.ProviderApplication", + "webContextPath":"provider" + }, + { + "bizName":"stock-mng", + "bizState":"ACTIVATED", + "bizVersion":"1.0.0", + "mainClass":"embed main", + "webContextPath":"/" + } + ] +} +``` + +## Query Health +- URL: 127.0.0.1:1238/health + +### Query All Health Info +- input sample: +```json +{} +``` +- output sample: +```json +{ + "code": "SUCCESS", + "data": { + "healthData": { + "jvm": { + "max non heap memory(M)": -9.5367431640625E-7, + "java version": "1.8.0_331", + "max memory(M)": 885.5, + "max heap memory(M)": 885.5, + "used heap memory(M)": 137.14127349853516, + "used non heap memory(M)": 62.54662322998047, + "loaded class count": 10063, + "init non heap memory(M)": 2.4375, + "total memory(M)": 174.5, + "free memory(M)": 37.358726501464844, + "unload class count": 0, + "total class count": 10063, + "committed heap memory(M)": 174.5, + "java home": "****\\jre", + "init heap memory(M)": 64.0, + "committed non heap memory(M)": 66.203125, + "run time(s)": 34.432 + }, + "cpu": { + "count": 4, + "total used (%)": 131749.0, + "type": "****", + "user used (%)": 9.926451054656962, + "free (%)": 81.46475495070172, + "system used (%)": 6.249762806548817 + }, + "masterBizInfo": { + "webContextPath": "/", + "bizName": "bookstore-manager", + "bizState": "ACTIVATED", + "bizVersion": "1.0.0" + }, + "pluginListInfo": [ + { + "artifactId": "web-ark-plugin", + "groupId": "com.alipay.sofa", + "pluginActivator": "com.alipay.sofa.ark.web.embed.WebPluginActivator", + "pluginName": "web-ark-plugin", + "pluginUrl": "file:/****/2.2.3-SNAPSHOT/web-ark-plugin-2.2.3-20230901.090402-2.jar!/", + "pluginVersion": "2.2.3-SNAPSHOT" + }, + { + "artifactId": "runtime-sofa-boot-plugin", + "groupId": "com.alipay.sofa", + "pluginActivator": "com.alipay.sofa.runtime.ark.plugin.SofaRuntimeActivator", + "pluginName": "runtime-sofa-boot-plugin", + "pluginUrl": "file:/****/runtime-sofa-boot-plugin-3.11.0.jar!/", + "pluginVersion": "3.11.0" + } + ], + "masterBizHealth": { + "readinessState": "ACCEPTING_TRAFFIC" + }, + "bizListInfo": [ + { + "bizName": "bookstore-manager", + "bizState": "ACTIVATED", + "bizVersion": "1.0.0", + "webContextPath": "/" + } + ] + } + } +} +``` + +### Query System Health Info +- input sample: + +```json +{ + "type": "system", + // [OPTIONAL] if metrics is null -> query all system health info + "metrics": ["cpu", "jvm"] +} +``` +- output sample: +```json +{ + "code": "SUCCESS", + "data": { + "healthData": { + "jvm": {...}, + "cpu": {...}, +// "masterBizHealth": {...} + } + } +} +``` + +### Query Biz Health Info +- input sample: + +```json +{ + "type": "biz", + // [OPTIONAL] if moduleName is null and moduleVersion is null -> query all biz + "moduleName": "bookstore-manager", + // [OPTIONAL] if moduleVersion is null -> query all biz named moduleName + "moduleVersion": "1.0.0" +} +``` +- output sample: +```json +{ + "code": "SUCCESS", + "data": { + "healthData": { + "bizInfo": { + "bizName": "bookstore-manager", + "bizState": "ACTIVATED", + "bizVersion": "1.0.0", + "webContextPath": "/" + } +// "bizListInfo": [ +// { +// "bizName": "bookstore-manager", +// "bizState": "ACTIVATED", +// "bizVersion": "1.0.0", +// "webContextPath": "/" +// } +// ] + } + } +} +``` + +### Query Plugin Health Info +- input sample: + +```json +{ + "type": "plugin", + // [OPTIONAL] if moduleName is null -> query all biz + "moduleName": "web-ark-plugin" +} +``` +- output sample: +```json +{ + "code": "SUCCESS", + "data": { + "healthData": { + "pluginListInfo": [ + { + "artifactId": "web-ark-plugin", + "groupId": "com.alipay.sofa", + "pluginActivator": "com.alipay.sofa.ark.web.embed.WebPluginActivator", + "pluginName": "web-ark-plugin", + "pluginUrl": "file:/****/web-ark-plugin-2.2.3-20230901.090402-2.jar!/", + "pluginVersion": "2.2.3-SNAPSHOT" + } + ] + } + } +} +``` + +### Query Health Using Endpoint + +use endpoint for k8s module to get helath info + +**default config** +* endpoints exposure include: `*` +* endpoints base path: `/` +* endpoints sever port: `8080` + +**http code result** +* `HEALTHY(200)`: get health if all health indicator is healthy +* `UNHEALTHY(400)`: get health once a health indicator is unhealthy +* `ENDPOINT_NOT_FOUND(404)`: endpoint path or params not found +* `ENDPOINT_PROCESS_INTERNAL_ERROR(500)`: get health process throw an error + +### query all health info +- url: 127.0.0.1:8080/arkletHealth +- method: GET +- output sample + +```json +{ + "healthy": true, + "code": 200, + "codeType": "HEALTHY", + "data": { + "jvm": {...}, + "masterBizHealth": {...}, + "cpu": {...}, + "masterBizInfo": {...}, + "bizListInfo": [...], + "pluginListInfo": [...] + } +} +``` +### query all biz/plugin health info +- url: 127.0.0.1:8080/arkletHealth/{moduleType} (moduleType must in ['biz', 'plugin']) +- method: GET +- output sample + ```json +{ + "healthy": true, + "code": 200, + "codeType": "HEALTHY", + "data": { + "bizListInfo": [...], + // "pluginListInfo": [...] + } +} +``` +### query single biz/plugin health info +- url: 127.0.0.1:8080/arkletHealth/{moduleType}/moduleName/moduleVersion (moduleType must in ['biz', 'plugin']) +- method: GET +- output sample + + ```json +{ + "healthy": true, + "code": 200, + "codeType": "HEALTHY", + "data": { + "bizInfo": {...}, + // "pluginInfo": {...} + } +} +``` + + diff --git a/sofa-serverless-runtime/check_format.sh b/sofa-serverless-runtime/check_format.sh new file mode 100644 index 000000000..061d8e8f0 --- /dev/null +++ b/sofa-serverless-runtime/check_format.sh @@ -0,0 +1,13 @@ +#!/bin/sh + +BASEDIR=$(dirname $0) + +cd ${BASEDIR} + +# make sure git has no un commit files +if [ -n "$(git status --untracked-files=no --porcelain)" ]; then + echo "Please commit your change before run this shell, un commit files:" + git status --untracked-files=no --porcelain + echo "Please run ## mvn clean install -DskipTests -Dmaven.javadoc.skip=true -B -U && sh ./check_format.sh ## locally, then push it." + exit -1 +fi \ No newline at end of file From 7d5213b8324e104bf08278da878b10d1556f19e6 Mon Sep 17 00:00:00 2001 From: "youji.zzl" Date: Tue, 26 Sep 2023 16:25:09 +0800 Subject: [PATCH 5/6] simple applicationcontext aware --- .../sofa-serverless-base-plugin/pom.xml | 1 + .../plugin/BaseRuntimeAutoConfiguration.java | 16 +++++--- .../plugin/ServerlessRuntimeActivator.java | 2 - .../ApplicationContextEventHandler.java | 33 ----------------- .../handler/BeforeBizStartupEventHandler.java | 37 ------------------- .../handler/BizUninstallEventHandlerTest.java | 13 +++++-- .../common/BizRuntimeContextRegistry.java | 1 - 7 files changed, 21 insertions(+), 82 deletions(-) delete mode 100644 sofa-serverless-runtime/sofa-serverless-base-plugin/src/main/java/com/alipay/sofa/serverless/plugin/manager/handler/ApplicationContextEventHandler.java delete mode 100644 sofa-serverless-runtime/sofa-serverless-base-plugin/src/main/java/com/alipay/sofa/serverless/plugin/manager/handler/BeforeBizStartupEventHandler.java diff --git a/sofa-serverless-runtime/sofa-serverless-base-plugin/pom.xml b/sofa-serverless-runtime/sofa-serverless-base-plugin/pom.xml index 88af56b27..7c2535b25 100644 --- a/sofa-serverless-runtime/sofa-serverless-base-plugin/pom.xml +++ b/sofa-serverless-runtime/sofa-serverless-base-plugin/pom.xml @@ -60,6 +60,7 @@ com.alipay.sofa.serverless.plugin.ServerlessRuntimeActivator + com.alipay.sofa.serverless.plugin.* diff --git a/sofa-serverless-runtime/sofa-serverless-base-plugin/src/main/java/com/alipay/sofa/serverless/plugin/BaseRuntimeAutoConfiguration.java b/sofa-serverless-runtime/sofa-serverless-base-plugin/src/main/java/com/alipay/sofa/serverless/plugin/BaseRuntimeAutoConfiguration.java index 6c94b978b..9fa172722 100644 --- a/sofa-serverless-runtime/sofa-serverless-base-plugin/src/main/java/com/alipay/sofa/serverless/plugin/BaseRuntimeAutoConfiguration.java +++ b/sofa-serverless-runtime/sofa-serverless-base-plugin/src/main/java/com/alipay/sofa/serverless/plugin/BaseRuntimeAutoConfiguration.java @@ -16,8 +16,11 @@ */ package com.alipay.sofa.serverless.plugin; -import com.alipay.sofa.serverless.common.environment.ConditionalOnNotMasterBiz; -import com.alipay.sofa.serverless.plugin.manager.handler.ApplicationContextEventHandler; +import com.alipay.sofa.ark.api.ArkClient; +import com.alipay.sofa.ark.spi.model.Biz; +import com.alipay.sofa.serverless.common.BizRuntimeContext; +import com.alipay.sofa.serverless.common.BizRuntimeContextRegistry; +import org.springframework.context.ApplicationContext; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; @@ -29,8 +32,11 @@ public class BaseRuntimeAutoConfiguration { @Bean - // @ConditionalOnNotMasterBiz - public ApplicationContextEventHandler applicationContextEventHandler() { - return new ApplicationContextEventHandler(); + public BizRuntimeContext bizRuntimeContext(ApplicationContext applicationContext) { + ClassLoader classLoader = applicationContext.getClassLoader(); + Biz biz = ArkClient.getBizManagerService().getBizByClassLoader(classLoader); + BizRuntimeContext bizRuntimeContext = new BizRuntimeContext(biz, applicationContext); + BizRuntimeContextRegistry.registerSpringContext(bizRuntimeContext); + return bizRuntimeContext; } } diff --git a/sofa-serverless-runtime/sofa-serverless-base-plugin/src/main/java/com/alipay/sofa/serverless/plugin/ServerlessRuntimeActivator.java b/sofa-serverless-runtime/sofa-serverless-base-plugin/src/main/java/com/alipay/sofa/serverless/plugin/ServerlessRuntimeActivator.java index 1befb65f7..9cca184c4 100644 --- a/sofa-serverless-runtime/sofa-serverless-base-plugin/src/main/java/com/alipay/sofa/serverless/plugin/ServerlessRuntimeActivator.java +++ b/sofa-serverless-runtime/sofa-serverless-base-plugin/src/main/java/com/alipay/sofa/serverless/plugin/ServerlessRuntimeActivator.java @@ -19,7 +19,6 @@ import com.alipay.sofa.ark.spi.model.PluginContext; import com.alipay.sofa.ark.spi.service.PluginActivator; import com.alipay.sofa.ark.spi.service.event.EventAdminService; -import com.alipay.sofa.serverless.plugin.manager.handler.BeforeBizStartupEventHandler; import com.alipay.sofa.serverless.plugin.manager.handler.BizUninstallEventHandler; /** @@ -36,7 +35,6 @@ private void registerEventHandler(final PluginContext context) { EventAdminService eventAdminService = context.referenceService(EventAdminService.class) .getService(); eventAdminService.register(new BizUninstallEventHandler()); - eventAdminService.register(new BeforeBizStartupEventHandler()); } @Override diff --git a/sofa-serverless-runtime/sofa-serverless-base-plugin/src/main/java/com/alipay/sofa/serverless/plugin/manager/handler/ApplicationContextEventHandler.java b/sofa-serverless-runtime/sofa-serverless-base-plugin/src/main/java/com/alipay/sofa/serverless/plugin/manager/handler/ApplicationContextEventHandler.java deleted file mode 100644 index 6c13c9463..000000000 --- a/sofa-serverless-runtime/sofa-serverless-base-plugin/src/main/java/com/alipay/sofa/serverless/plugin/manager/handler/ApplicationContextEventHandler.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.alipay.sofa.serverless.plugin.manager.handler; - -import com.alipay.sofa.serverless.common.BizRuntimeContext; -import com.alipay.sofa.serverless.common.BizRuntimeContextRegistry; -import org.springframework.beans.BeansException; -import org.springframework.context.ApplicationContext; -import org.springframework.context.ApplicationContextAware; - -public class ApplicationContextEventHandler implements ApplicationContextAware { - - @Override - public void setApplicationContext(ApplicationContext applicationContext) throws BeansException { - BizRuntimeContext bizRuntimeContext = BizRuntimeContextRegistry - .getBizRuntimeContextByClassLoader(applicationContext.getClassLoader()); - bizRuntimeContext.setRootApplicationContext(applicationContext); - } -} \ No newline at end of file diff --git a/sofa-serverless-runtime/sofa-serverless-base-plugin/src/main/java/com/alipay/sofa/serverless/plugin/manager/handler/BeforeBizStartupEventHandler.java b/sofa-serverless-runtime/sofa-serverless-base-plugin/src/main/java/com/alipay/sofa/serverless/plugin/manager/handler/BeforeBizStartupEventHandler.java deleted file mode 100644 index 28213d650..000000000 --- a/sofa-serverless-runtime/sofa-serverless-base-plugin/src/main/java/com/alipay/sofa/serverless/plugin/manager/handler/BeforeBizStartupEventHandler.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.alipay.sofa.serverless.plugin.manager.handler; - -import com.alipay.sofa.ark.spi.event.biz.BeforeBizStartupEvent; -import com.alipay.sofa.ark.spi.model.Biz; -import com.alipay.sofa.ark.spi.service.event.EventHandler; -import com.alipay.sofa.serverless.common.BizRuntimeContext; -import com.alipay.sofa.serverless.common.BizRuntimeContextRegistry; - -public class BeforeBizStartupEventHandler implements EventHandler { - @Override - public void handleEvent(BeforeBizStartupEvent beforeBizStartupEvent) { - Biz biz = beforeBizStartupEvent.getSource(); - // can't get applicationContext here, so register a empty applicationContext - BizRuntimeContextRegistry.registerSpringContext(new BizRuntimeContext(biz, null)); - } - - @Override - public int getPriority() { - return 0; - } -} diff --git a/sofa-serverless-runtime/sofa-serverless-base-plugin/src/test/java/com/alipay/sofa/serverless/plugin/manager/handler/BizUninstallEventHandlerTest.java b/sofa-serverless-runtime/sofa-serverless-base-plugin/src/test/java/com/alipay/sofa/serverless/plugin/manager/handler/BizUninstallEventHandlerTest.java index f53a047de..fb8e5d443 100644 --- a/sofa-serverless-runtime/sofa-serverless-base-plugin/src/test/java/com/alipay/sofa/serverless/plugin/manager/handler/BizUninstallEventHandlerTest.java +++ b/sofa-serverless-runtime/sofa-serverless-base-plugin/src/test/java/com/alipay/sofa/serverless/plugin/manager/handler/BizUninstallEventHandlerTest.java @@ -16,9 +16,10 @@ */ package com.alipay.sofa.serverless.plugin.manager.handler; -import com.alipay.sofa.ark.spi.event.biz.BeforeBizStartupEvent; +import com.alipay.sofa.ark.api.ArkClient; import com.alipay.sofa.ark.spi.event.biz.BeforeBizStopEvent; import com.alipay.sofa.ark.spi.model.Biz; +import com.alipay.sofa.ark.spi.service.biz.BizManagerService; import com.alipay.sofa.serverless.common.BizRuntimeContext; import com.alipay.sofa.serverless.common.BizRuntimeContextRegistry; import com.alipay.sofa.serverless.plugin.BaseRuntimeAutoConfiguration; @@ -41,6 +42,9 @@ public class BizUninstallEventHandlerTest { @Mock private Biz biz; + @Mock + private BizManagerService bizManagerService; + private ConfigurableApplicationContext ctx; private SpringApplication springApplication; @@ -50,11 +54,12 @@ public void before() { Properties properties = new Properties(); properties.setProperty("spring.application.name", bizName); + ArkClient.setBizManagerService(bizManagerService); + springApplication = new SpringApplication(BaseRuntimeAutoConfiguration.class); springApplication.setDefaultProperties(properties); springApplication.setWebApplicationType(WebApplicationType.NONE); - // ctx = springApplication.run(); } @Test @@ -62,8 +67,7 @@ public void handleEvent() { Mockito.when(biz.getBizName()).thenReturn(bizName); Mockito.when(biz.getBizClassLoader()).thenReturn(this.getClass().getClassLoader()); - BeforeBizStartupEventHandler beforeBizStartupEventHandler = new BeforeBizStartupEventHandler(); - beforeBizStartupEventHandler.handleEvent(new BeforeBizStartupEvent(biz)); + Mockito.when(bizManagerService.getBizByClassLoader(this.getClass().getClassLoader())).thenReturn(biz); ctx = springApplication.run(); @@ -74,4 +78,5 @@ public void handleEvent() { bizUninstallEventHandler.handleEvent(new BeforeBizStopEvent(biz)); Assert.assertFalse(ctx.isActive()); } + } \ No newline at end of file diff --git a/sofa-serverless-runtime/sofa-serverless-common/src/main/java/com/alipay/sofa/serverless/common/BizRuntimeContextRegistry.java b/sofa-serverless-runtime/sofa-serverless-common/src/main/java/com/alipay/sofa/serverless/common/BizRuntimeContextRegistry.java index 2af91e8e4..26ad5465f 100644 --- a/sofa-serverless-runtime/sofa-serverless-common/src/main/java/com/alipay/sofa/serverless/common/BizRuntimeContextRegistry.java +++ b/sofa-serverless-runtime/sofa-serverless-common/src/main/java/com/alipay/sofa/serverless/common/BizRuntimeContextRegistry.java @@ -34,7 +34,6 @@ public static void registerSpringContext(BizRuntimeContext bizRuntimeContext) { public static void unRegisterBizRuntimeManager(BizRuntimeContext bizRuntimeContext) { contextMap.remove(bizRuntimeContext.getAppClassLoader()); - } public static Set getRuntimeSet() { From 24e2dde11f5d23ed5e8822005e8fa6a89729f753 Mon Sep 17 00:00:00 2001 From: "youji.zzl" Date: Tue, 26 Sep 2023 17:18:38 +0800 Subject: [PATCH 6/6] update version to 0.3.4 --- sofa-serverless-runtime/pom.xml | 2 +- .../plugin/manager/handler/BizUninstallEventHandlerTest.java | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/sofa-serverless-runtime/pom.xml b/sofa-serverless-runtime/pom.xml index 6604a9377..4e9b3c51f 100644 --- a/sofa-serverless-runtime/pom.xml +++ b/sofa-serverless-runtime/pom.xml @@ -9,7 +9,7 @@ pom - 0.3.3 + 0.3.4 UTF-8 UTF-8 1.8 diff --git a/sofa-serverless-runtime/sofa-serverless-base-plugin/src/test/java/com/alipay/sofa/serverless/plugin/manager/handler/BizUninstallEventHandlerTest.java b/sofa-serverless-runtime/sofa-serverless-base-plugin/src/test/java/com/alipay/sofa/serverless/plugin/manager/handler/BizUninstallEventHandlerTest.java index fb8e5d443..d288d7275 100644 --- a/sofa-serverless-runtime/sofa-serverless-base-plugin/src/test/java/com/alipay/sofa/serverless/plugin/manager/handler/BizUninstallEventHandlerTest.java +++ b/sofa-serverless-runtime/sofa-serverless-base-plugin/src/test/java/com/alipay/sofa/serverless/plugin/manager/handler/BizUninstallEventHandlerTest.java @@ -43,7 +43,7 @@ public class BizUninstallEventHandlerTest { private Biz biz; @Mock - private BizManagerService bizManagerService; + private BizManagerService bizManagerService; private ConfigurableApplicationContext ctx; @@ -67,7 +67,8 @@ public void handleEvent() { Mockito.when(biz.getBizName()).thenReturn(bizName); Mockito.when(biz.getBizClassLoader()).thenReturn(this.getClass().getClassLoader()); - Mockito.when(bizManagerService.getBizByClassLoader(this.getClass().getClassLoader())).thenReturn(biz); + Mockito.when(bizManagerService.getBizByClassLoader(this.getClass().getClassLoader())) + .thenReturn(biz); ctx = springApplication.run();