diff --git a/escheduler-api/pom.xml b/escheduler-api/pom.xml index b0d92d54a888e7bc44f9b25a66ef431588dc36f5..2ac260f31448b5116bb46de6e6ee388ca78eecdb 100644 --- a/escheduler-api/pom.xml +++ b/escheduler-api/pom.xml @@ -9,9 +9,11 @@ jar - - - + + cn.analysys + escheduler-alert + + cn.analysys escheduler-server diff --git a/escheduler-api/src/main/java/cn/escheduler/api/CombinedApplicationServer.java b/escheduler-api/src/main/java/cn/escheduler/api/CombinedApplicationServer.java new file mode 100644 index 0000000000000000000000000000000000000000..5f5927ea65540a3015a23cb9f9947a7c04b04d63 --- /dev/null +++ b/escheduler-api/src/main/java/cn/escheduler/api/CombinedApplicationServer.java @@ -0,0 +1,54 @@ +/* + * 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 cn.escheduler.api; + +import cn.escheduler.alert.AlertServer; +import cn.escheduler.dao.ProcessDao; +import cn.escheduler.server.master.MasterServer; +import cn.escheduler.server.rpc.LoggerServer; +import cn.escheduler.server.worker.WorkerServer; +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.boot.web.servlet.ServletComponentScan; +import org.springframework.boot.web.servlet.support.SpringBootServletInitializer; +import org.springframework.context.ConfigurableApplicationContext; +import org.springframework.context.annotation.ComponentScan; +import springfox.documentation.swagger2.annotations.EnableSwagger2; + +@SpringBootApplication +@ServletComponentScan +@ComponentScan("cn.escheduler") +@EnableSwagger2 +public class CombinedApplicationServer extends SpringBootServletInitializer { + + public static void main(String[] args) throws Exception { + + ConfigurableApplicationContext context = SpringApplication.run(ApiApplicationServer.class, args); + ProcessDao processDao = context.getBean(ProcessDao.class); + MasterServer master = new MasterServer(processDao); + master.run(processDao); + + WorkerServer workerServer = new WorkerServer(); + workerServer.run(); + + LoggerServer server = new LoggerServer(); + server.start(); + + AlertServer alertServer = AlertServer.getInstance(); + alertServer.start(); + } +} diff --git a/escheduler-api/src/main/java/cn/escheduler/api/configuration/AppConfiguration.java b/escheduler-api/src/main/java/cn/escheduler/api/configuration/AppConfiguration.java index b9b69c0a9c42e57af527d17903d8aece0ff628f3..de0331cc00e73d034f96440870dbf418e047626c 100644 --- a/escheduler-api/src/main/java/cn/escheduler/api/configuration/AppConfiguration.java +++ b/escheduler-api/src/main/java/cn/escheduler/api/configuration/AppConfiguration.java @@ -75,7 +75,7 @@ public class AppConfiguration implements WebMvcConfigurer { //i18n registry.addInterceptor(localeChangeInterceptor()); - registry.addInterceptor(loginInterceptor()).addPathPatterns(LOGIN_INTERCEPTOR_PATH_PATTERN).excludePathPatterns(LOGIN_PATH_PATTERN,"/swagger-resources/**", "/webjars/**", "/v2/**", "/doc.html", "*.html"); + registry.addInterceptor(loginInterceptor()).addPathPatterns(LOGIN_INTERCEPTOR_PATH_PATTERN).excludePathPatterns(LOGIN_PATH_PATTERN,"/swagger-resources/**", "/webjars/**", "/v2/**", "/doc.html", "*.html", "/ui/**"); } @@ -84,6 +84,13 @@ public class AppConfiguration implements WebMvcConfigurer { registry.addResourceHandler("/static/**").addResourceLocations("classpath:/static/"); registry.addResourceHandler("doc.html").addResourceLocations("classpath:/META-INF/resources/"); registry.addResourceHandler("/webjars/**").addResourceLocations("classpath:/META-INF/resources/webjars/"); + registry.addResourceHandler("/ui/**").addResourceLocations("file:ui/"); + } + + @Override + public void addViewControllers(ViewControllerRegistry registry) { + registry.addViewController("/ui/").setViewName("forward:/ui/index.html"); + registry.addViewController("/").setViewName("forward:/ui/index.html"); } @Override diff --git a/escheduler-api/src/main/resources/combined_logback.xml b/escheduler-api/src/main/resources/combined_logback.xml new file mode 100644 index 0000000000000000000000000000000000000000..d9c5b80ecfc11125b796514ce1bac0519747ce0b --- /dev/null +++ b/escheduler-api/src/main/resources/combined_logback.xml @@ -0,0 +1,54 @@ + + + + + + + %highlight([%level]) %date{yyyy-MM-dd HH:mm:ss.SSS} %logger{10}:[%line] - %msg%n + + UTF-8 + + + + + INFO + + + ${log.base}/{processDefinitionId}/{processInstanceId}/{taskInstanceId}.log + + + [%level] %date{yyyy-MM-dd HH:mm:ss.SSS} %logger{96}:[%line] - %msg%n + + UTF-8 + + true + + + + ${log.base}/escheduler-combined.log + + INFO + + + + ${log.base}/escheduler-combined.%d{yyyy-MM-dd_HH}.%i.log + 168 + 200MB + +       + + + [%level] %date{yyyy-MM-dd HH:mm:ss.SSS} %logger{96}:[%line] - %msg%n + + UTF-8 + +    + + + + + + + + + \ No newline at end of file diff --git a/escheduler-server/src/main/java/cn/escheduler/server/rpc/LoggerServer.java b/escheduler-server/src/main/java/cn/escheduler/server/rpc/LoggerServer.java index 8913cdda06f95ce68d852b5986b352ba7890e3a4..ab9e79524b7ece27bd822ea99497299a55cacb3e 100644 --- a/escheduler-server/src/main/java/cn/escheduler/server/rpc/LoggerServer.java +++ b/escheduler-server/src/main/java/cn/escheduler/server/rpc/LoggerServer.java @@ -44,7 +44,7 @@ public class LoggerServer { */ private Server server; - private void start() throws IOException { + public void start() throws IOException { /* The port on which the server should run */ int port = Constants.RPC_PORT; server = ServerBuilder.forPort(port) diff --git a/escheduler-ui/build/config.js b/escheduler-ui/build/config.js index 72416712622ba38558626ae83c7ea9456608fdca..f0c555c7737c6d5a8e5fdb1a5d8e896bbb7a55c7 100644 --- a/escheduler-ui/build/config.js +++ b/escheduler-ui/build/config.js @@ -189,11 +189,15 @@ const baseConfig = { }, plugins: [ new webpack.ProvidePlugin({ vue: 'Vue', _: 'lodash' }), + new webpack.DefinePlugin({ + PUBLIC_PATH: JSON.stringify(process.env.PUBLIC_PATH ? process.env.PUBLIC_PATH : '') + }), new HtmlWebpackExtPlugin({ cache: true, delimiter: '$', locals: { - NODE_ENV:isProduction + NODE_ENV:isProduction, + PUBLIC_PATH: process.env.PUBLIC_PATH ? process.env.PUBLIC_PATH : '' } }), ...pages diff --git a/escheduler-ui/build/webpack.config.combined.js b/escheduler-ui/build/webpack.config.combined.js new file mode 100644 index 0000000000000000000000000000000000000000..cae3eb92a8b9a45a8e38a9600a228f710b4afe16 --- /dev/null +++ b/escheduler-ui/build/webpack.config.combined.js @@ -0,0 +1,26 @@ +/* + * 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. + */ +const merge = require('webpack-merge') +const prodConfig = require('./webpack.config.prod') + +const config = merge.smart(prodConfig, { + output: { + publicPath: '/escheduler/ui/' + } +}) + +module.exports = config diff --git a/escheduler-ui/package.json b/escheduler-ui/package.json index 291c653b79470266ca896ab5aaa43207ef3631fb..acfa498a5403c72085a5a719f8e0ab82bd009481 100644 --- a/escheduler-ui/package.json +++ b/escheduler-ui/package.json @@ -10,7 +10,8 @@ "lint": "standard \"**/*.{js,vue}\"", "lint:fix": "standard \"**/*.{js,vue}\" --fix", "start": "npm run dev", - "combo": "node ./build/combo.js" + "combo": "node ./build/combo.js", + "build:combined": "npm run clean && cross-env NODE_ENV=production PUBLIC_PATH=/escheduler/ui webpack --config ./build/webpack.config.combined.js" }, "dependencies": { "autoprefixer": "^9.1.0", diff --git a/escheduler-ui/src/js/conf/home/store/user/actions.js b/escheduler-ui/src/js/conf/home/store/user/actions.js index 0bc12c33cd0d189a3dac5f293bf9f3cce94fb998..951d9a0814b402b724ab724bd22d37e0290ecce0 100644 --- a/escheduler-ui/src/js/conf/home/store/user/actions.js +++ b/escheduler-ui/src/js/conf/home/store/user/actions.js @@ -37,7 +37,7 @@ export default { signOut () { io.post(`signOut`, res => { setTimeout(() => { - window.location.href = '/view/login/index.html' + window.location.href = `${PUBLIC_PATH}/view/login/index.html` }, 100) }).catch(e => { console.log(e) diff --git a/escheduler-ui/src/js/conf/login/App.vue b/escheduler-ui/src/js/conf/login/App.vue index 66ba574eb53ebae56ecd5b190d76ebe66cfcdddd..bac32e404dd8c51e536ec6ae2368661e4532a271 100644 --- a/escheduler-ui/src/js/conf/login/App.vue +++ b/escheduler-ui/src/js/conf/login/App.vue @@ -69,9 +69,9 @@ setTimeout(() => { this.spinnerLoading = false if (this.userName === 'admin') { - window.location.href = '/#/security/tenant' + window.location.href = `${PUBLIC_PATH}/#/security/tenant` } else { - window.location.href = '/#/home' + window.location.href = `${PUBLIC_PATH}/#/home` } }, 1000) }).catch(e => { diff --git a/escheduler-ui/src/js/module/io/index.js b/escheduler-ui/src/js/module/io/index.js index 5e8a3b18eca64c1cf8b751982a346bd1b2402f06..f9d56f145861dc0a889dbcbd7d78a8222e2ed8e4 100644 --- a/escheduler-ui/src/js/module/io/index.js +++ b/escheduler-ui/src/js/module/io/index.js @@ -44,7 +44,7 @@ io.config.timeout = 0 io.config.maxContentLength = 200000 io.config.validateStatus = function (status) { if (status === 401 || status === 504) { - window.location.href = '/view/login/index.html' + window.location.href = `${PUBLIC_PATH}/view/login/index.html` return } return status diff --git a/escheduler-ui/src/view/common/meta.inc b/escheduler-ui/src/view/common/meta.inc index 62cdea7f8bacb298d52f1cfa72ab0f3e2a235308..1f0f0afd633da216af91b84d309a7570a9814732 100644 --- a/escheduler-ui/src/view/common/meta.inc +++ b/escheduler-ui/src/view/common/meta.inc @@ -11,14 +11,14 @@ - - - + + + \ No newline at end of file + diff --git a/escheduler-ui/src/view/common/outro.inc b/escheduler-ui/src/view/common/outro.inc index 8965047d1cf29aacf08abc60a5a20682bffdd869..b3b1380d6497a506f6810410b7d7820853e70758 100644 --- a/escheduler-ui/src/view/common/outro.inc +++ b/escheduler-ui/src/view/common/outro.inc @@ -2,7 +2,7 @@ - + diff --git a/package.xml b/package.xml index 4976f061fd978fa789ef97c495b1f6212af7488a..619dfb07cf52195a0708e7acd8c0cfdaf3ee5749 100644 --- a/package.xml +++ b/package.xml @@ -34,6 +34,14 @@ . + + escheduler-ui/dist + + **/*.* + + ./ui + + sql