├── .gitattributes ├── .github └── workflows │ └── codeql-analysis.yml ├── .gitignore ├── .travis.yml ├── .vscode └── settings.json ├── CHANGELOG.adoc ├── CNAME ├── CONTRIBUTING.adoc ├── COPYRIGHT ├── LICENSE ├── README.adoc ├── deploy.sh ├── devops ├── cicd │ ├── gitlabci │ │ ├── .gitlab-ci-template.yml │ │ └── readme.adoc │ └── jenkins │ │ ├── doc │ │ └── manual │ │ │ └── jenkins-user-manual.adoc │ │ ├── readme.adoc │ │ └── scripts │ │ ├── dew-devops.groovy │ │ ├── dew-maven-agent-update.groovy │ │ └── pipeline-scripts.adoc ├── devops-test-example.properties ├── devops-test.properties ├── docker │ └── dew-devops │ │ ├── Dockerfile │ │ └── readme.adoc ├── it │ ├── pom.xml │ ├── readme.adoc │ └── src │ │ ├── it │ │ ├── helloworld-backend │ │ │ ├── .dew │ │ │ ├── .gitignore │ │ │ ├── .gitlab-ci.yml │ │ │ ├── LICENSE │ │ │ ├── expected │ │ │ │ ├── Deployment.yaml │ │ │ │ └── Service.yaml │ │ │ ├── invoker.properties │ │ │ ├── pom.xml │ │ │ ├── readme.adoc │ │ │ ├── src │ │ │ │ └── main │ │ │ │ │ ├── java │ │ │ │ │ └── group │ │ │ │ │ │ └── idealworld │ │ │ │ │ │ └── dew │ │ │ │ │ │ └── devops │ │ │ │ │ │ └── it │ │ │ │ │ │ ├── Application.java │ │ │ │ │ │ └── Controller.java │ │ │ │ │ └── resources │ │ │ │ │ └── bootstrap.yml │ │ │ └── verify.groovy │ │ ├── helloworld-frontend │ │ │ ├── .dew │ │ │ ├── .env.test │ │ │ ├── .gitignore │ │ │ ├── .gitlab-ci.yml │ │ │ ├── LICENSE │ │ │ ├── babel.config.js │ │ │ ├── expected │ │ │ │ ├── Deployment.yaml │ │ │ │ └── Service.yaml │ │ │ ├── invoker.properties │ │ │ ├── package.json │ │ │ ├── pom.xml │ │ │ ├── public │ │ │ │ ├── favicon.ico │ │ │ │ └── index.html │ │ │ ├── readme.adoc │ │ │ ├── src │ │ │ │ ├── App.vue │ │ │ │ ├── assets │ │ │ │ │ └── logo.png │ │ │ │ ├── components │ │ │ │ │ └── HelloWorld.vue │ │ │ │ └── main.js │ │ │ └── verify.groovy │ │ ├── helloworld-library │ │ │ ├── .dew │ │ │ ├── .gitignore │ │ │ ├── .gitlab-ci.yml │ │ │ ├── LICENSE │ │ │ ├── invoker.properties │ │ │ ├── pom.xml │ │ │ ├── readme.adoc │ │ │ ├── src │ │ │ │ └── main │ │ │ │ │ └── java │ │ │ │ │ └── group │ │ │ │ │ └── idealworld │ │ │ │ │ └── dew │ │ │ │ │ └── devops │ │ │ │ │ └── it │ │ │ │ │ └── SomeHelper.java │ │ │ └── verify.groovy │ │ └── todo │ │ │ ├── .dew │ │ │ ├── .gitignore │ │ │ ├── .gitlab-ci.yml │ │ │ ├── LICENSE │ │ │ ├── backend │ │ │ ├── libraries │ │ │ │ └── common │ │ │ │ │ ├── pom.xml │ │ │ │ │ └── src │ │ │ │ │ ├── main │ │ │ │ │ └── java │ │ │ │ │ │ └── group │ │ │ │ │ │ └── idealworld │ │ │ │ │ │ └── dew │ │ │ │ │ │ └── devops │ │ │ │ │ │ └── it │ │ │ │ │ │ └── todo │ │ │ │ │ │ └── common │ │ │ │ │ │ ├── Constants.java │ │ │ │ │ │ ├── TodoParentApplication.java │ │ │ │ │ │ └── domain │ │ │ │ │ │ └── IdEntity.java │ │ │ │ │ └── test │ │ │ │ │ └── java │ │ │ │ │ └── group │ │ │ │ │ └── idealworld │ │ │ │ │ └── dew │ │ │ │ │ └── devops │ │ │ │ │ └── it │ │ │ │ │ └── todo │ │ │ │ │ └── common │ │ │ │ │ └── SomeTest.java │ │ │ └── services │ │ │ │ ├── compute │ │ │ │ ├── expected │ │ │ │ │ ├── Deployment.yaml │ │ │ │ │ └── Service.yaml │ │ │ │ ├── pom.xml │ │ │ │ └── src │ │ │ │ │ └── main │ │ │ │ │ ├── java │ │ │ │ │ └── group │ │ │ │ │ │ └── idealworld │ │ │ │ │ │ └── dew │ │ │ │ │ │ └── devops │ │ │ │ │ │ └── it │ │ │ │ │ │ └── todo │ │ │ │ │ │ └── compute │ │ │ │ │ │ ├── TodoComputeApplication.java │ │ │ │ │ │ ├── controller │ │ │ │ │ │ └── ComputeController.java │ │ │ │ │ │ └── service │ │ │ │ │ │ └── ComputeService.java │ │ │ │ │ └── resources │ │ │ │ │ ├── application-default.yml │ │ │ │ │ └── bootstrap.yml │ │ │ │ ├── kernel │ │ │ │ ├── .dew │ │ │ │ ├── expected │ │ │ │ │ ├── Deployment.yaml │ │ │ │ │ └── Service.yaml │ │ │ │ ├── pom.xml │ │ │ │ └── src │ │ │ │ │ ├── main │ │ │ │ │ ├── java │ │ │ │ │ │ └── group │ │ │ │ │ │ │ └── idealworld │ │ │ │ │ │ │ └── dew │ │ │ │ │ │ │ └── devops │ │ │ │ │ │ │ └── it │ │ │ │ │ │ │ └── todo │ │ │ │ │ │ │ └── kernel │ │ │ │ │ │ │ ├── TodoKernelApplication.java │ │ │ │ │ │ │ ├── controller │ │ │ │ │ │ │ └── TodoController.java │ │ │ │ │ │ │ ├── domain │ │ │ │ │ │ │ └── Todo.java │ │ │ │ │ │ │ ├── repository │ │ │ │ │ │ │ └── TodoRepository.java │ │ │ │ │ │ │ └── service │ │ │ │ │ │ │ └── TodoService.java │ │ │ │ │ └── resources │ │ │ │ │ │ ├── application-default.yml │ │ │ │ │ │ ├── application-prod.yml │ │ │ │ │ │ ├── application-uat.yml │ │ │ │ │ │ ├── application.yml │ │ │ │ │ │ └── bootstrap.yml │ │ │ │ │ └── test │ │ │ │ │ └── java │ │ │ │ │ └── group │ │ │ │ │ └── idealworld │ │ │ │ │ └── dew │ │ │ │ │ └── devops │ │ │ │ │ └── it │ │ │ │ │ └── todo │ │ │ │ │ └── kernel │ │ │ │ │ └── KernelTest.java │ │ │ │ └── notifier │ │ │ │ ├── .dew │ │ │ │ ├── pom.xml │ │ │ │ └── src │ │ │ │ └── main │ │ │ │ ├── java │ │ │ │ └── group │ │ │ │ │ └── idealworld │ │ │ │ │ └── dew │ │ │ │ │ └── devops │ │ │ │ │ └── it │ │ │ │ │ └── todo │ │ │ │ │ └── notifier │ │ │ │ │ ├── TodoNotifierApplication.java │ │ │ │ │ └── controller │ │ │ │ │ └── NotifierController.java │ │ │ │ └── resources │ │ │ │ ├── application-default.yml │ │ │ │ ├── application.yml │ │ │ │ └── bootstrap.yml │ │ │ ├── frontend │ │ │ ├── .dew │ │ │ ├── .editorconfig │ │ │ ├── .eslintrc │ │ │ ├── .gitignore │ │ │ ├── config │ │ │ │ ├── dev.js │ │ │ │ ├── index.js │ │ │ │ ├── prod.js │ │ │ │ └── uat.js │ │ │ ├── expected │ │ │ │ ├── Deployment.yaml │ │ │ │ └── Service.yaml │ │ │ ├── global.d.ts │ │ │ ├── package.json │ │ │ ├── pom.xml │ │ │ ├── project.config.json │ │ │ ├── src │ │ │ │ ├── app.scss │ │ │ │ ├── app.tsx │ │ │ │ ├── components │ │ │ │ │ └── dew-header │ │ │ │ │ │ ├── dew-header.scss │ │ │ │ │ │ └── dew-header.tsx │ │ │ │ ├── index.html │ │ │ │ ├── pages │ │ │ │ │ └── todo │ │ │ │ │ │ ├── todo.scss │ │ │ │ │ │ └── todo.tsx │ │ │ │ └── services │ │ │ │ │ └── api.ts │ │ │ └── tsconfig.json │ │ │ ├── invoker.properties │ │ │ ├── pom.xml │ │ │ ├── readme.adoc │ │ │ └── verify.groovy │ │ └── test │ │ └── java │ │ └── group │ │ └── idealworld │ │ └── dew │ │ └── devops │ │ └── it │ │ ├── BasicProcessor.java │ │ ├── InitAndCleanIT.java │ │ └── verify │ │ ├── HelloWorldBackendVerify.java │ │ ├── HelloWorldFrontendVerify.java │ │ ├── HelloWorldLibraryVerify.java │ │ ├── TodoVerify.java │ │ └── Verify.java ├── maven │ ├── dew-maven-agent │ │ ├── pom.xml │ │ ├── readme.adoc │ │ └── src │ │ │ ├── main │ │ │ ├── java │ │ │ │ └── group │ │ │ │ │ └── idealworld │ │ │ │ │ └── dew │ │ │ │ │ └── devops │ │ │ │ │ └── agent │ │ │ │ │ ├── MavenAgent.java │ │ │ │ │ ├── SkipCheck.java │ │ │ │ │ └── Transformer.java │ │ │ └── resources │ │ │ │ ├── 3.0.5 │ │ │ │ └── org │ │ │ │ │ └── apache │ │ │ │ │ └── maven │ │ │ │ │ └── lifecycle │ │ │ │ │ └── internal │ │ │ │ │ ├── LifecycleStarter.class │ │ │ │ │ └── MojoExecutor.class │ │ │ │ ├── 3.2.5 │ │ │ │ └── org │ │ │ │ │ └── apache │ │ │ │ │ └── maven │ │ │ │ │ └── lifecycle │ │ │ │ │ └── internal │ │ │ │ │ ├── MojoExecutor.class │ │ │ │ │ └── builder │ │ │ │ │ └── singlethreaded │ │ │ │ │ └── SingleThreadedBuilder.class │ │ │ │ ├── 3.3.3 │ │ │ │ └── org │ │ │ │ │ └── apache │ │ │ │ │ └── maven │ │ │ │ │ └── lifecycle │ │ │ │ │ └── internal │ │ │ │ │ ├── MojoExecutor.class │ │ │ │ │ └── builder │ │ │ │ │ └── singlethreaded │ │ │ │ │ └── SingleThreadedBuilder.class │ │ │ │ ├── 3.3.9 │ │ │ │ └── org │ │ │ │ │ └── apache │ │ │ │ │ └── maven │ │ │ │ │ └── lifecycle │ │ │ │ │ └── internal │ │ │ │ │ ├── MojoExecutor.class │ │ │ │ │ └── builder │ │ │ │ │ └── singlethreaded │ │ │ │ │ └── SingleThreadedBuilder.class │ │ │ │ ├── 3.5.2 │ │ │ │ └── org │ │ │ │ │ └── apache │ │ │ │ │ └── maven │ │ │ │ │ └── lifecycle │ │ │ │ │ └── internal │ │ │ │ │ ├── MojoExecutor.class │ │ │ │ │ └── builder │ │ │ │ │ └── singlethreaded │ │ │ │ │ └── SingleThreadedBuilder.class │ │ │ │ ├── 3.6.0 │ │ │ │ └── org │ │ │ │ │ └── apache │ │ │ │ │ └── maven │ │ │ │ │ └── lifecycle │ │ │ │ │ └── internal │ │ │ │ │ ├── MojoExecutor.class │ │ │ │ │ └── builder │ │ │ │ │ └── singlethreaded │ │ │ │ │ └── SingleThreadedBuilder.class │ │ │ │ └── 3.6.1 │ │ │ │ └── org │ │ │ │ └── apache │ │ │ │ └── maven │ │ │ │ └── lifecycle │ │ │ │ └── internal │ │ │ │ ├── MojoExecutor.class │ │ │ │ └── builder │ │ │ │ └── singlethreaded │ │ │ │ └── SingleThreadedBuilder.class │ │ │ └── test │ │ │ ├── 3.0.5 │ │ │ └── java │ │ │ │ ├── group │ │ │ │ └── idealworld │ │ │ │ │ └── dew │ │ │ │ │ └── devops │ │ │ │ │ └── agent │ │ │ │ │ └── BuildTest.java │ │ │ │ └── org │ │ │ │ └── apache │ │ │ │ └── maven │ │ │ │ └── lifecycle │ │ │ │ └── internal │ │ │ │ ├── LifecycleStarter.java │ │ │ │ └── MojoExecutor.java │ │ │ ├── 3.2.5 │ │ │ └── java │ │ │ │ ├── group │ │ │ │ └── idealworld │ │ │ │ │ └── dew │ │ │ │ │ └── devops │ │ │ │ │ └── agent │ │ │ │ │ └── BuildTest.java │ │ │ │ └── org │ │ │ │ └── apache │ │ │ │ └── maven │ │ │ │ └── lifecycle │ │ │ │ └── internal │ │ │ │ ├── MojoExecutor.java │ │ │ │ └── builder │ │ │ │ └── singlethreaded │ │ │ │ └── SingleThreadedBuilder.java │ │ │ ├── 3.3.3 │ │ │ └── java │ │ │ │ ├── group │ │ │ │ └── idealworld │ │ │ │ │ └── dew │ │ │ │ │ └── devops │ │ │ │ │ └── agent │ │ │ │ │ └── BuildTest.java │ │ │ │ └── org │ │ │ │ └── apache │ │ │ │ └── maven │ │ │ │ └── lifecycle │ │ │ │ └── internal │ │ │ │ ├── MojoExecutor.java │ │ │ │ └── builder │ │ │ │ └── singlethreaded │ │ │ │ └── SingleThreadedBuilder.java │ │ │ ├── 3.3.9 │ │ │ └── java │ │ │ │ ├── group │ │ │ │ └── idealworld │ │ │ │ │ └── dew │ │ │ │ │ └── devops │ │ │ │ │ └── agent │ │ │ │ │ └── BuildTest.java │ │ │ │ └── org │ │ │ │ └── apache │ │ │ │ └── maven │ │ │ │ └── lifecycle │ │ │ │ └── internal │ │ │ │ ├── MojoExecutor.java │ │ │ │ └── builder │ │ │ │ └── singlethreaded │ │ │ │ └── SingleThreadedBuilder.java │ │ │ ├── 3.5.2 │ │ │ └── java │ │ │ │ ├── group │ │ │ │ └── idealworld │ │ │ │ │ └── dew │ │ │ │ │ └── devops │ │ │ │ │ └── agent │ │ │ │ │ └── BuildTest.java │ │ │ │ └── org │ │ │ │ └── apache │ │ │ │ └── maven │ │ │ │ └── lifecycle │ │ │ │ └── internal │ │ │ │ ├── MojoExecutor.java │ │ │ │ └── builder │ │ │ │ └── singlethreaded │ │ │ │ └── SingleThreadedBuilder.java │ │ │ ├── 3.6.0 │ │ │ └── java │ │ │ │ ├── group │ │ │ │ └── idealworld │ │ │ │ │ └── dew │ │ │ │ │ └── devops │ │ │ │ │ └── agent │ │ │ │ │ └── BuildTest.java │ │ │ │ └── org │ │ │ │ └── apache │ │ │ │ └── maven │ │ │ │ └── lifecycle │ │ │ │ └── internal │ │ │ │ ├── MojoExecutor.java │ │ │ │ └── builder │ │ │ │ └── singlethreaded │ │ │ │ └── SingleThreadedBuilder.java │ │ │ └── 3.6.1 │ │ │ └── java │ │ │ ├── group │ │ │ └── idealworld │ │ │ │ └── dew │ │ │ │ └── devops │ │ │ │ └── agent │ │ │ │ └── BuildTest.java │ │ │ └── org │ │ │ └── apache │ │ │ └── maven │ │ │ └── lifecycle │ │ │ └── internal │ │ │ ├── MojoExecutor.java │ │ │ └── builder │ │ │ └── singlethreaded │ │ │ └── SingleThreadedBuilder.java │ └── dew-maven-plugin │ │ ├── pom.xml │ │ ├── readme.adoc │ │ └── src │ │ ├── main │ │ ├── java │ │ │ └── group │ │ │ │ └── idealworld │ │ │ │ └── dew │ │ │ │ └── devops │ │ │ │ ├── kernel │ │ │ │ ├── DevOps.java │ │ │ │ ├── config │ │ │ │ │ ├── ConfigBuilder.java │ │ │ │ │ ├── DewApp.java │ │ │ │ │ ├── DewConfig.java │ │ │ │ │ ├── DewDocker.java │ │ │ │ │ ├── DewKube.java │ │ │ │ │ ├── DewProfile.java │ │ │ │ │ ├── FinalConfig.java │ │ │ │ │ └── FinalProjectConfig.java │ │ │ │ ├── exception │ │ │ │ │ ├── ConfigException.java │ │ │ │ │ ├── GitDiffException.java │ │ │ │ │ ├── GlobalProcessException.java │ │ │ │ │ └── ProjectProcessException.java │ │ │ │ ├── flow │ │ │ │ │ ├── BasicFlow.java │ │ │ │ │ ├── NoNeedProcessFLow.java │ │ │ │ │ ├── debug │ │ │ │ │ │ └── DefaultDebugFlow.java │ │ │ │ │ ├── log │ │ │ │ │ │ └── DefaultLogFlow.java │ │ │ │ │ ├── refresh │ │ │ │ │ │ └── DefaultRefreshFlow.java │ │ │ │ │ ├── release │ │ │ │ │ │ ├── BasicPrepareFlow.java │ │ │ │ │ │ ├── DockerBuildFlow.java │ │ │ │ │ │ ├── KubeReleaseFlow.java │ │ │ │ │ │ └── MavenReleaseFlow.java │ │ │ │ │ ├── rollback │ │ │ │ │ │ └── DefaultRollbackFlow.java │ │ │ │ │ ├── scale │ │ │ │ │ │ └── DefaultScaleFlow.java │ │ │ │ │ └── unrelease │ │ │ │ │ │ └── DefaultUnReleaseFlow.java │ │ │ │ ├── function │ │ │ │ │ ├── ExecuteEventProcessor.java │ │ │ │ │ ├── NeedProcessChecker.java │ │ │ │ │ ├── PodSelector.java │ │ │ │ │ ├── StatusReporter.java │ │ │ │ │ └── VersionController.java │ │ │ │ ├── helper │ │ │ │ │ ├── DockerHelper.java │ │ │ │ │ ├── DockerOpt.java │ │ │ │ │ ├── GitHelper.java │ │ │ │ │ ├── GitOpt.java │ │ │ │ │ ├── KubeBasicMetadataMeta.java │ │ │ │ │ ├── KubeBasicRes.java │ │ │ │ │ ├── KubeHelper.java │ │ │ │ │ ├── KubeOpt.java │ │ │ │ │ ├── KubeRES.java │ │ │ │ │ ├── KubeWatchCall.java │ │ │ │ │ ├── MultiInstProcessor.java │ │ │ │ │ └── YamlHelper.java │ │ │ │ ├── plugin │ │ │ │ │ ├── appkind │ │ │ │ │ │ ├── AppKindPlugin.java │ │ │ │ │ │ ├── frontend │ │ │ │ │ │ │ ├── node_native │ │ │ │ │ │ │ │ ├── FrontendNativeNodeAppKindPlugin.java │ │ │ │ │ │ │ │ ├── FrontendNativeNodeBuildFlow.java │ │ │ │ │ │ │ │ └── FrontendNativeNodePrepareFlow.java │ │ │ │ │ │ │ └── node_non_natvie │ │ │ │ │ │ │ │ ├── FrontendNonNativeNodeAppKindPlugin.java │ │ │ │ │ │ │ │ ├── FrontendNonNativeNodeBuildFlow.java │ │ │ │ │ │ │ │ └── FrontendNonNativeNodePrepareFlow.java │ │ │ │ │ │ ├── jvmlib │ │ │ │ │ │ │ └── JvmLibAppKindPlugin.java │ │ │ │ │ │ ├── jvmservice_springboot │ │ │ │ │ │ │ ├── JvmServiceSpringBootAppKindPlugin.java │ │ │ │ │ │ │ ├── JvmServiceSpringBootBuildFlow.java │ │ │ │ │ │ │ └── JvmServiceSpringBootPrepareFlow.java │ │ │ │ │ │ └── pom │ │ │ │ │ │ │ └── PomAppKindPlugin.java │ │ │ │ │ └── deploy │ │ │ │ │ │ ├── DeployPlugin.java │ │ │ │ │ │ ├── kubernetes │ │ │ │ │ │ └── KubernetesDeployPlugin.java │ │ │ │ │ │ └── maven │ │ │ │ │ │ └── MavenDeployPlugin.java │ │ │ │ ├── resource │ │ │ │ │ ├── KubeConfigMapBuilder.java │ │ │ │ │ ├── KubeDeploymentBuilder.java │ │ │ │ │ ├── KubeHorizontalPodAutoscalerBuilder.java │ │ │ │ │ ├── KubeResourceBuilder.java │ │ │ │ │ └── KubeServiceBuilder.java │ │ │ │ └── util │ │ │ │ │ ├── DewLog.java │ │ │ │ │ ├── ExecuteOnceProcessor.java │ │ │ │ │ ├── ExitMonitorProcessor.java │ │ │ │ │ └── ShellHelper.java │ │ │ │ └── maven │ │ │ │ ├── MavenDevOps.java │ │ │ │ ├── function │ │ │ │ ├── AppKindPluginSelector.java │ │ │ │ ├── DependenciesResolver.java │ │ │ │ ├── DeployPluginSelector.java │ │ │ │ └── MavenSkipProcessor.java │ │ │ │ └── mojo │ │ │ │ ├── BasicMojo.java │ │ │ │ ├── DebugMojo.java │ │ │ │ ├── InitMojo.java │ │ │ │ ├── LogMojo.java │ │ │ │ ├── RefreshMojo.java │ │ │ │ ├── ReleaseMojo.java │ │ │ │ ├── RollbackMojo.java │ │ │ │ ├── ScaleMojo.java │ │ │ │ └── UnReleaseMojo.java │ │ └── resources │ │ │ └── dockerfile │ │ │ ├── frontend │ │ │ ├── node_native │ │ │ │ └── Dockerfile │ │ │ └── node_non_native │ │ │ │ └── Dockerfile │ │ │ └── jvmservice_springboot │ │ │ ├── Dockerfile │ │ │ ├── debug-clear.sh │ │ │ ├── debug-java.sh │ │ │ └── run-java.sh │ │ └── test │ │ ├── java │ │ ├── group │ │ │ └── idealworld │ │ │ │ └── dew │ │ │ │ └── devops │ │ │ │ ├── BasicTest.java │ │ │ │ ├── kernel │ │ │ │ ├── config │ │ │ │ │ └── TestConfigBuilder.java │ │ │ │ └── helper │ │ │ │ │ ├── DockerHelperTest.java │ │ │ │ │ ├── KubeHelperTest.java │ │ │ │ │ ├── TestYaml.java │ │ │ │ │ ├── TestYamlSub.java │ │ │ │ │ └── YamlHelperTest.java │ │ │ │ └── misc │ │ │ │ └── MockTest.java │ │ └── mock │ │ │ ├── Mock.java │ │ │ └── MockGitOpt.java │ │ └── resources │ │ ├── Dockerfile │ │ └── ns-test.yaml ├── monitor │ └── grafana_spring_boot.json ├── pom.xml └── sh │ ├── dew-devops.sh │ └── readme.adoc ├── docs ├── CNAME ├── images │ ├── devops-jenkins │ │ ├── extend-choice-parameter.jpg │ │ ├── git_branch.jpg │ │ ├── git_repo.jpg │ │ ├── manual │ │ │ ├── parameter-assign-service-view.jpg │ │ │ ├── parameter-assign-service.jpg │ │ │ ├── parameter-branch-1.jpg │ │ │ ├── parameter-branch-2.jpg │ │ │ ├── parameter-devops_phase.jpg │ │ │ ├── parameter-git_repo.jpg │ │ │ ├── parameter-types.jpg │ │ │ ├── parameter.jpg │ │ │ ├── pipeline-build.jpg │ │ │ ├── pipeline-create.jpg │ │ │ ├── pipeline-devops-phase-view.jpg │ │ │ ├── pipeline-dew.jpg │ │ │ ├── pipeline-scm.jpg │ │ │ ├── ts-git.jpg │ │ │ └── ts-stage-skip.jpg │ │ ├── parameter.jpg │ │ └── pipeline-scm.jpg │ ├── devops-notify │ │ ├── failure-split.png │ │ ├── failure.png │ │ ├── ignore-split.png │ │ ├── non-split.png │ │ ├── report.png │ │ ├── successful-split.png │ │ └── successful.png │ ├── gitlab-ci-rollback.png │ └── todo-demo.gif ├── index.html ├── pom.xml └── src │ └── main │ └── asciidoc │ ├── _chapter │ ├── appendix │ │ ├── 2.x-migration-guide.adoc │ │ ├── 3.x-migration-guide.adoc │ │ └── middleware.adoc │ ├── devops │ │ ├── best-practices.adoc │ │ ├── configuration.adoc │ │ ├── install.adoc │ │ ├── q&a.adoc │ │ ├── quick-start.adoc │ │ └── user-manual.adoc │ └── framework │ │ ├── best-practices.adoc │ │ ├── configuration.adoc │ │ ├── quick-start.adoc │ │ └── user-manual.adoc │ └── book.adoc ├── examples ├── auth-example │ ├── pom.xml │ └── src │ │ ├── main │ │ ├── java │ │ │ └── group │ │ │ │ └── idealworld │ │ │ │ └── dew │ │ │ │ └── example │ │ │ │ └── auth │ │ │ │ ├── AuthExampleApplication.java │ │ │ │ ├── AuthExampleController.java │ │ │ │ └── dto │ │ │ │ └── OptInfoExt.java │ │ └── resources │ │ │ └── application.yml │ │ └── test │ │ └── java │ │ └── group │ │ └── idealworld │ │ └── dew │ │ └── example │ │ └── AuthTest.java ├── bone-example │ ├── pom.xml │ └── src │ │ ├── main │ │ ├── java │ │ │ └── group │ │ │ │ └── idealworld │ │ │ │ └── dew │ │ │ │ └── example │ │ │ │ └── bone │ │ │ │ ├── BoneExampleApplication.java │ │ │ │ ├── BoneExampleConfig.java │ │ │ │ └── BoneExampleInitiator.java │ │ └── resources │ │ │ ├── META-INF │ │ │ └── native-image │ │ │ │ └── group.idealworld.dew │ │ │ │ └── bone-example │ │ │ │ ├── agent-access-filter.json │ │ │ │ ├── jni-config.json │ │ │ │ ├── native-image.properties │ │ │ │ ├── proxy-config.json │ │ │ │ ├── reflect-config.json │ │ │ │ └── resource-config.json │ │ │ └── application.yml │ │ └── test │ │ └── java │ │ └── group │ │ └── idealworld │ │ └── dew │ │ └── example │ │ └── bone │ │ └── BoneExampleApplicationTest.java ├── cluster-example │ ├── pom.xml │ └── src │ │ └── main │ │ ├── java │ │ └── group │ │ │ └── idealworld │ │ │ └── dew │ │ │ └── example │ │ │ └── cluster │ │ │ ├── ClusterExampleApplication.java │ │ │ └── ClusterExampleInitiator.java │ │ └── resources │ │ └── application.yml ├── hbase-example │ ├── pom.xml │ └── src │ │ └── main │ │ ├── java │ │ └── group │ │ │ └── idealworld │ │ │ └── dew │ │ │ └── example │ │ │ └── hbase │ │ │ ├── HBaseExampleApplication.java │ │ │ └── HBaseExampleInitiator.java │ │ └── resources │ │ └── application.yml ├── idempotent-example │ ├── pom.xml │ └── src │ │ └── main │ │ ├── java │ │ └── group │ │ │ └── idealworld │ │ │ └── dew │ │ │ └── example │ │ │ └── idempotent │ │ │ ├── IdempotentController.java │ │ │ ├── IdempotentExampleApplication.java │ │ │ └── IdempotentService.java │ │ └── resources │ │ └── application.yml ├── pom.xml ├── skywalking-example │ ├── pom.xml │ └── src │ │ └── main │ │ ├── java │ │ └── group │ │ │ └── idealworld │ │ │ └── dew │ │ │ └── example │ │ │ └── skywalking │ │ │ ├── SkyWalkingExampleApplication.java │ │ │ └── SkyWalkingExampleController.java │ │ └── resources │ │ └── application.yml └── web-example │ ├── pom.xml │ └── src │ ├── main │ ├── java │ │ └── group │ │ │ └── idealworld │ │ │ └── dew │ │ │ └── example │ │ │ └── web │ │ │ ├── RbumCertDto.java │ │ │ ├── WebExample2Controller.java │ │ │ ├── WebExampleApplication.java │ │ │ └── WebExampleController.java │ └── resources │ │ └── application.yml │ └── test │ └── java │ └── group │ └── idealworld │ └── dew │ └── example │ └── web │ └── DewSDKGenTest.java ├── framework ├── assists │ └── sdkgen-maven-plugin │ │ ├── pom.xml │ │ ├── readme.adoc │ │ └── src │ │ ├── main │ │ ├── java │ │ │ └── group │ │ │ │ └── idealworld │ │ │ │ └── dew │ │ │ │ └── sdkgen │ │ │ │ ├── Constants.java │ │ │ │ ├── helper │ │ │ │ ├── HandlebarsHelper.java │ │ │ │ ├── MavenHelper.java │ │ │ │ └── NameHelper.java │ │ │ │ ├── lang │ │ │ │ └── java │ │ │ │ │ └── DewJavaClientCodegen.java │ │ │ │ ├── maven │ │ │ │ ├── SDKGenerateMojo.java │ │ │ │ └── TestGenerateMojo.java │ │ │ │ └── process │ │ │ │ ├── SDKGenerateProcess.java │ │ │ │ ├── SDKReleaseProcess.java │ │ │ │ └── TestGenerateProcess.java │ │ └── resources │ │ │ ├── handlebars │ │ │ └── Java │ │ │ │ ├── libraries │ │ │ │ └── okhttp-gson │ │ │ │ │ └── pom.mustache │ │ │ │ └── sdk.mustache │ │ │ └── testfile │ │ │ └── testFile.mustache │ │ └── test │ │ └── java │ │ └── group │ │ └── idealworld │ │ └── dew │ │ └── devops │ │ └── BasicTest.java ├── checkstyle │ └── checkstyle.xml ├── modules │ ├── boot-starter │ │ ├── pom.xml │ │ └── src │ │ │ ├── main │ │ │ ├── java │ │ │ │ └── group │ │ │ │ │ └── idealworld │ │ │ │ │ └── dew │ │ │ │ │ ├── Dew.java │ │ │ │ │ ├── DewStartup.java │ │ │ │ │ └── core │ │ │ │ │ ├── DewConfig.java │ │ │ │ │ ├── DewContext.java │ │ │ │ │ ├── auth │ │ │ │ │ ├── AuthAdapter.java │ │ │ │ │ ├── AuthAutoConfiguration.java │ │ │ │ │ ├── BasicAuthAdapter.java │ │ │ │ │ └── dto │ │ │ │ │ │ ├── BasicOptInfo.java │ │ │ │ │ │ └── OptInfo.java │ │ │ │ │ ├── basic │ │ │ │ │ ├── fun │ │ │ │ │ │ ├── VoidExecutor.java │ │ │ │ │ │ └── VoidPredicate.java │ │ │ │ │ ├── loading │ │ │ │ │ │ └── DewLoadImmediately.java │ │ │ │ │ ├── resp │ │ │ │ │ │ └── StandardResp.java │ │ │ │ │ └── utils │ │ │ │ │ │ ├── NetUtils.java │ │ │ │ │ │ ├── TraceIdUtil.java │ │ │ │ │ │ └── convert │ │ │ │ │ │ ├── ConvertAutoConfiguration.java │ │ │ │ │ │ ├── InstantConvert.java │ │ │ │ │ │ ├── LocalDateConverter.java │ │ │ │ │ │ ├── LocalDateTimeConverter.java │ │ │ │ │ │ └── LocalTimeConverter.java │ │ │ │ │ ├── doc │ │ │ │ │ └── DocAutoConfiguration.java │ │ │ │ │ ├── notification │ │ │ │ │ ├── AbsChannel.java │ │ │ │ │ ├── Channel.java │ │ │ │ │ ├── DDChannel.java │ │ │ │ │ ├── HTTPChannel.java │ │ │ │ │ ├── MAILChannel.java │ │ │ │ │ ├── Notify.java │ │ │ │ │ └── NotifyConfig.java │ │ │ │ │ ├── util │ │ │ │ │ └── ThreadLocalUtil.java │ │ │ │ │ └── web │ │ │ │ │ ├── error │ │ │ │ │ ├── ErrorAutoConfiguration.java │ │ │ │ │ └── ErrorController.java │ │ │ │ │ ├── interceptor │ │ │ │ │ ├── AutoTrimConfiguration.java │ │ │ │ │ ├── BasicHandlerInterceptor.java │ │ │ │ │ ├── IdentInfoHandlerInterceptor.java │ │ │ │ │ ├── InterceptorWebAutoConfiguration.java │ │ │ │ │ ├── RouterHandlerInterceptor.java │ │ │ │ │ └── TokenHandlerInterceptor.java │ │ │ │ │ └── validation │ │ │ │ │ ├── CreateGroup.java │ │ │ │ │ ├── IdNumber.java │ │ │ │ │ ├── IdNumberValidator.java │ │ │ │ │ ├── Phone.java │ │ │ │ │ ├── PhoneValidator.java │ │ │ │ │ ├── RemoveGroup.java │ │ │ │ │ └── UpdateGroup.java │ │ │ └── resources │ │ │ │ └── META-INF │ │ │ │ └── spring │ │ │ │ └── org.springframework.boot.autoconfigure.AutoConfiguration.imports │ │ │ └── test │ │ │ ├── java │ │ │ └── com │ │ │ │ └── trc │ │ │ │ └── test │ │ │ │ ├── BootTestApplication.java │ │ │ │ ├── GeneralTest.java │ │ │ │ ├── IdentInfoTest.java │ │ │ │ ├── auth │ │ │ │ ├── AuthController.java │ │ │ │ ├── AuthTest.java │ │ │ │ └── OptInfoExt.java │ │ │ │ ├── cluster │ │ │ │ └── ClusterTest.java │ │ │ │ ├── notification │ │ │ │ ├── NotifyIntegrationTest.java │ │ │ │ └── NotifyTest.java │ │ │ │ ├── web │ │ │ │ ├── AuthException.java │ │ │ │ ├── WebController.java │ │ │ │ └── WebTest.java │ │ │ │ └── web2 │ │ │ │ └── Web2Controller.java │ │ │ └── resources │ │ │ ├── application-ident.yml │ │ │ └── application.yml │ ├── cluster-common-test │ │ ├── pom.xml │ │ └── src │ │ │ └── main │ │ │ └── java │ │ │ └── group │ │ │ └── idealworld │ │ │ └── dew │ │ │ └── core │ │ │ └── cluster │ │ │ └── test │ │ │ ├── ClusterCacheTest.java │ │ │ ├── ClusterElectionTest.java │ │ │ ├── ClusterLockTest.java │ │ │ ├── ClusterMQTest.java │ │ │ └── ClusterMapTest.java │ ├── cluster-common │ │ ├── pom.xml │ │ └── src │ │ │ └── main │ │ │ └── java │ │ │ └── group │ │ │ └── idealworld │ │ │ └── dew │ │ │ └── core │ │ │ └── cluster │ │ │ ├── AbsClusterElection.java │ │ │ ├── AbsClusterMQ.java │ │ │ ├── Cluster.java │ │ │ ├── ClusterCache.java │ │ │ ├── ClusterCacheWrap.java │ │ │ ├── ClusterElection.java │ │ │ ├── ClusterElectionWrap.java │ │ │ ├── ClusterLock.java │ │ │ ├── ClusterLockWrap.java │ │ │ ├── ClusterMQ.java │ │ │ ├── ClusterMap.java │ │ │ ├── ClusterMapWrap.java │ │ │ ├── ClusterTrace.java │ │ │ ├── VoidProcessFun.java │ │ │ ├── dto │ │ │ ├── MessageHeader.java │ │ │ └── MessageWrap.java │ │ │ ├── exception │ │ │ └── NotImplementedException.java │ │ │ └── ha │ │ │ ├── ClusterHA.java │ │ │ ├── SqliteClusterHA.java │ │ │ ├── dto │ │ │ └── HAConfig.java │ │ │ └── entity │ │ │ └── PrepareCommitMsg.java │ ├── cluster-hazelcast │ │ ├── pom.xml │ │ └── src │ │ │ ├── main │ │ │ ├── java │ │ │ │ └── group │ │ │ │ │ └── idealworld │ │ │ │ │ └── dew │ │ │ │ │ └── core │ │ │ │ │ └── cluster │ │ │ │ │ └── spi │ │ │ │ │ └── hazelcast │ │ │ │ │ ├── HazelcastAdapter.java │ │ │ │ │ ├── HazelcastAutoConfiguration.java │ │ │ │ │ ├── HazelcastClusterLock.java │ │ │ │ │ ├── HazelcastClusterLockWrap.java │ │ │ │ │ ├── HazelcastClusterMQ.java │ │ │ │ │ ├── HazelcastClusterMap.java │ │ │ │ │ ├── HazelcastClusterMapWrap.java │ │ │ │ │ └── HazelcastConfig.java │ │ │ └── resources │ │ │ │ └── META-INF │ │ │ │ └── spring │ │ │ │ └── org.springframework.boot.autoconfigure.AutoConfiguration.imports │ │ │ └── test │ │ │ ├── java │ │ │ └── group │ │ │ │ └── idealworld │ │ │ │ └── dew │ │ │ │ └── core │ │ │ │ └── cluster │ │ │ │ └── ClusterTest.java │ │ │ └── resources │ │ │ └── application.yml │ ├── cluster-mqtt │ │ ├── pom.xml │ │ └── src │ │ │ ├── main │ │ │ ├── java │ │ │ │ └── group │ │ │ │ │ └── idealworld │ │ │ │ │ └── dew │ │ │ │ │ └── core │ │ │ │ │ └── cluster │ │ │ │ │ └── spi │ │ │ │ │ └── mqtt │ │ │ │ │ ├── MqttAdapter.java │ │ │ │ │ ├── MqttAutoConfiguration.java │ │ │ │ │ ├── MqttClusterMQ.java │ │ │ │ │ └── MqttConfig.java │ │ │ └── resources │ │ │ │ └── META-INF │ │ │ │ └── spring │ │ │ │ └── org.springframework.boot.autoconfigure.AutoConfiguration.imports │ │ │ └── test │ │ │ ├── java │ │ │ └── group │ │ │ │ └── idealworld │ │ │ │ └── dew │ │ │ │ └── core │ │ │ │ └── cluster │ │ │ │ └── ClusterTest.java │ │ │ └── resources │ │ │ └── application.yml │ ├── cluster-rabbit │ │ ├── pom.xml │ │ └── src │ │ │ ├── main │ │ │ ├── java │ │ │ │ └── group │ │ │ │ │ └── idealworld │ │ │ │ │ └── dew │ │ │ │ │ └── core │ │ │ │ │ └── cluster │ │ │ │ │ └── spi │ │ │ │ │ └── rabbit │ │ │ │ │ ├── RabbitAdapter.java │ │ │ │ │ ├── RabbitAutoConfiguration.java │ │ │ │ │ ├── RabbitClusterMQ.java │ │ │ │ │ ├── ReceiveBeforeFun.java │ │ │ │ │ ├── ReceiveErrorFun.java │ │ │ │ │ ├── ReceiveFinishFun.java │ │ │ │ │ ├── SendBeforeFun.java │ │ │ │ │ ├── SendErrorFun.java │ │ │ │ │ └── SendFinishFun.java │ │ │ └── resources │ │ │ │ └── META-INF │ │ │ │ └── spring │ │ │ │ └── org.springframework.boot.autoconfigure.AutoConfiguration.imports │ │ │ └── test │ │ │ ├── java │ │ │ └── group │ │ │ │ └── idealworld │ │ │ │ └── dew │ │ │ │ └── core │ │ │ │ └── cluster │ │ │ │ └── ClusterTest.java │ │ │ └── resources │ │ │ └── application.yml │ ├── cluster-redis │ │ ├── pom.xml │ │ └── src │ │ │ ├── main │ │ │ ├── java │ │ │ │ ├── group │ │ │ │ │ └── idealworld │ │ │ │ │ │ └── dew │ │ │ │ │ │ └── core │ │ │ │ │ │ └── cluster │ │ │ │ │ │ └── spi │ │ │ │ │ │ └── redis │ │ │ │ │ │ ├── MultiRedisConfig.java │ │ │ │ │ │ ├── RedisAutoConfiguration.java │ │ │ │ │ │ ├── RedisClusterCache.java │ │ │ │ │ │ ├── RedisClusterCacheWrap.java │ │ │ │ │ │ ├── RedisClusterElection.java │ │ │ │ │ │ ├── RedisClusterElectionWrap.java │ │ │ │ │ │ ├── RedisClusterLock.java │ │ │ │ │ │ ├── RedisClusterLockWrap.java │ │ │ │ │ │ ├── RedisClusterMQ.java │ │ │ │ │ │ ├── RedisClusterMap.java │ │ │ │ │ │ └── RedisClusterMapWrap.java │ │ │ │ └── org │ │ │ │ │ └── springframework │ │ │ │ │ └── boot │ │ │ │ │ └── autoconfigure │ │ │ │ │ └── data │ │ │ │ │ └── redis │ │ │ │ │ └── MultiConnectionConfiguration.java │ │ │ └── resources │ │ │ │ └── META-INF │ │ │ │ └── spring │ │ │ │ └── org.springframework.boot.autoconfigure.AutoConfiguration.imports │ │ │ └── test │ │ │ ├── java │ │ │ └── group │ │ │ │ └── idealworld │ │ │ │ └── dew │ │ │ │ └── core │ │ │ │ └── cluster │ │ │ │ └── ClusterTest.java │ │ │ └── resources │ │ │ └── application.yml │ ├── cluster-rocket │ │ ├── pom.xml │ │ └── src │ │ │ ├── main │ │ │ ├── java │ │ │ │ └── group │ │ │ │ │ └── idealworld │ │ │ │ │ └── dew │ │ │ │ │ └── core │ │ │ │ │ └── cluster │ │ │ │ │ └── spi │ │ │ │ │ └── rocket │ │ │ │ │ ├── ReceiveBeforeFun.java │ │ │ │ │ ├── ReceiveErrorFun.java │ │ │ │ │ ├── ReceiveFinishFun.java │ │ │ │ │ ├── RocketAdapter.java │ │ │ │ │ ├── RocketAutoConfiguration.java │ │ │ │ │ ├── RocketClusterMQ.java │ │ │ │ │ ├── SendBeforeFun.java │ │ │ │ │ ├── SendErrorFun.java │ │ │ │ │ └── SendFinishFun.java │ │ │ └── resources │ │ │ │ └── META-INF │ │ │ │ └── spring │ │ │ │ └── org.springframework.boot.autoconfigure.AutoConfiguration.imports │ │ │ └── test │ │ │ ├── java │ │ │ └── group │ │ │ │ └── idealworld │ │ │ │ └── dew │ │ │ │ └── core │ │ │ │ └── cluster │ │ │ │ └── ClusterTest.java │ │ │ └── resources │ │ │ └── application.yml │ ├── cluster-skywalking │ │ ├── pom.xml │ │ └── src │ │ │ └── main │ │ │ ├── java │ │ │ └── group │ │ │ │ └── idealworld │ │ │ │ └── dew │ │ │ │ └── core │ │ │ │ └── cluster │ │ │ │ └── spi │ │ │ │ └── skywalking │ │ │ │ ├── SkyWalkingClusterTrace.java │ │ │ │ ├── SkyWalkingTracingAutoConfiguration.java │ │ │ │ ├── config │ │ │ │ └── TraceInterceptorConfigurer.java │ │ │ │ └── interceptor │ │ │ │ └── TraceInterceptor.java │ │ │ └── resources │ │ │ └── META-INF │ │ │ └── spring │ │ │ └── org.springframework.boot.autoconfigure.AutoConfiguration.imports │ ├── dbutils-starter │ │ ├── pom.xml │ │ └── src │ │ │ ├── main │ │ │ ├── java │ │ │ │ └── group │ │ │ │ │ └── idealworld │ │ │ │ │ └── dew │ │ │ │ │ └── core │ │ │ │ │ └── dbutils │ │ │ │ │ ├── DewDB.java │ │ │ │ │ ├── DewDBUtils.java │ │ │ │ │ ├── dialect │ │ │ │ │ ├── Dialect.java │ │ │ │ │ ├── DialectFactory.java │ │ │ │ │ ├── DialectType.java │ │ │ │ │ ├── HiveDialect.java │ │ │ │ │ ├── MySQLDialect.java │ │ │ │ │ └── PostgresDialect.java │ │ │ │ │ ├── dto │ │ │ │ │ ├── DBUtilsConfig.java │ │ │ │ │ ├── DSConfig.java │ │ │ │ │ ├── Meta.java │ │ │ │ │ └── Page.java │ │ │ │ │ ├── process │ │ │ │ │ ├── DBExecutor.java │ │ │ │ │ └── DSLoader.java │ │ │ │ │ └── utils │ │ │ │ │ └── YamlHelper.java │ │ │ └── resources │ │ │ │ ├── META-INF │ │ │ │ └── spring │ │ │ │ │ └── org.springframework.boot.autoconfigure.AutoConfiguration.imports │ │ │ │ └── application.yml │ │ │ └── test │ │ │ ├── java │ │ │ └── group │ │ │ │ └── idealworld │ │ │ │ └── dew │ │ │ │ └── core │ │ │ │ └── dbutils │ │ │ │ ├── DBTest.java │ │ │ │ ├── DBUtilsApplication.java │ │ │ │ └── User.java │ │ │ └── resources │ │ │ └── application.yml │ ├── hbase-starter │ │ ├── pom.xml │ │ └── src │ │ │ ├── main │ │ │ ├── java │ │ │ │ └── group │ │ │ │ │ └── idealworld │ │ │ │ │ └── dew │ │ │ │ │ └── core │ │ │ │ │ └── hbase │ │ │ │ │ ├── HBaseAutoConfiguration.java │ │ │ │ │ ├── HBaseOperation.java │ │ │ │ │ ├── HBaseProperties.java │ │ │ │ │ ├── HBaseRunTimeException.java │ │ │ │ │ ├── HBaseTemplate.java │ │ │ │ │ ├── MutatorCallback.java │ │ │ │ │ ├── RowMapper.java │ │ │ │ │ └── TableCallback.java │ │ │ └── resources │ │ │ │ └── META-INF │ │ │ │ └── spring │ │ │ │ └── org.springframework.boot.autoconfigure.AutoConfiguration.imports │ │ │ └── test │ │ │ ├── java │ │ │ └── group │ │ │ │ └── idealworld │ │ │ │ └── dew │ │ │ │ └── core │ │ │ │ └── hbase │ │ │ │ └── HBaseTest.java │ │ │ └── resources │ │ │ └── application.yml │ ├── idempotent-starter │ │ ├── pom.xml │ │ └── src │ │ │ ├── main │ │ │ ├── java │ │ │ │ └── group │ │ │ │ │ └── idealworld │ │ │ │ │ └── dew │ │ │ │ │ └── idempotent │ │ │ │ │ ├── DewIdempotent.java │ │ │ │ │ ├── DewIdempotentConfig.java │ │ │ │ │ ├── annotations │ │ │ │ │ └── Idempotent.java │ │ │ │ │ ├── interceptor │ │ │ │ │ ├── IdempotentException.java │ │ │ │ │ ├── IdempotentHandlerInterceptor.java │ │ │ │ │ └── IdempotentWebAutoConfiguration.java │ │ │ │ │ └── strategy │ │ │ │ │ ├── BloomFilterProcessor.java │ │ │ │ │ ├── IdempotentProcessor.java │ │ │ │ │ ├── ItemProcessor.java │ │ │ │ │ ├── StatusEnum.java │ │ │ │ │ └── StrategyEnum.java │ │ │ └── resources │ │ │ │ └── META-INF │ │ │ │ └── spring │ │ │ │ └── org.springframework.boot.autoconfigure.AutoConfiguration.imports │ │ │ └── test │ │ │ ├── java │ │ │ └── group │ │ │ │ └── idealworld │ │ │ │ └── dew │ │ │ │ └── idempotent │ │ │ │ ├── IdempotentApplication.java │ │ │ │ ├── IdempotentController.java │ │ │ │ └── IdempotentTest.java │ │ │ └── resources │ │ │ └── application.yml │ ├── ossutils-starter │ │ ├── pom.xml │ │ └── src │ │ │ └── main │ │ │ ├── java │ │ │ └── group │ │ │ │ └── idealworld │ │ │ │ └── dew │ │ │ │ └── ossutils │ │ │ │ ├── bean │ │ │ │ ├── ImageProcessParam.java │ │ │ │ └── OssCommonParam.java │ │ │ │ ├── config │ │ │ │ ├── OssConfigProperties.java │ │ │ │ └── OssUtilsAutoConfiguration.java │ │ │ │ ├── constants │ │ │ │ └── OssTypeEnum.java │ │ │ │ ├── general │ │ │ │ ├── DewOssClient.java │ │ │ │ ├── OssClientInitProcess.java │ │ │ │ ├── OssClientOptProcess.java │ │ │ │ └── impl │ │ │ │ │ ├── MinioService.java │ │ │ │ │ ├── ObsService.java │ │ │ │ │ └── OssService.java │ │ │ │ ├── handle │ │ │ │ └── DewOssHandleClient.java │ │ │ │ └── utils │ │ │ │ ├── OssClientUtil.java │ │ │ │ ├── OssHandleException.java │ │ │ │ └── OssHandleTool.java │ │ │ └── resources │ │ │ └── META-INF │ │ │ └── spring │ │ │ └── org.springframework.boot.autoconfigure.AutoConfiguration.imports │ ├── parent-starter │ │ └── pom.xml │ └── test-starter │ │ ├── pom.xml │ │ └── src │ │ └── main │ │ ├── java │ │ └── group │ │ │ └── idealworld │ │ │ └── dew │ │ │ └── test │ │ │ ├── MqttExtension.java │ │ │ ├── MySqlExtension.java │ │ │ ├── PostgreSqlExtension.java │ │ │ ├── RabbitMQExtension.java │ │ │ ├── RedisExtension.java │ │ │ └── RocketMQExtension.java │ │ └── resources │ │ └── mosquitto.conf └── pom.xml └── pom.xml /.gitattributes: -------------------------------------------------------------------------------- 1 | *.sh eol=lf 2 | Dockerfile eol=lf 3 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | log/ 2 | logs/ 3 | tmp/ 4 | *.tmp 5 | *.bak 6 | 7 | target/ 8 | 9 | .cluster/ 10 | 11 | **.db 12 | 13 | .mvn/ 14 | mvnw 15 | mvnw.cmd 16 | 17 | .idea/ 18 | out/ 19 | *.iws 20 | *.iml 21 | *.ipr 22 | 23 | .settings/ 24 | .classpath 25 | .project 26 | .apt_generated 27 | .factorypath 28 | .springBeans 29 | 30 | node_modules/ 31 | 32 | !/devops/maven/dew-maven-plugin/src/main/java/group/idealworld/dew/devops/kernel/flow/log/ 33 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: java 2 | 3 | install: mvn install -DskipTests=true -Ddew.it.skip=true -Dmaven.javadoc.skip=true -B -V 4 | script: mvn compile -DskipTests=true -Ddew.it.skip=true -Dmaven.javadoc.skip=true -B -V -P qa 5 | 6 | jdk: 7 | - openjdk11 8 | 9 | notifications: 10 | email: 11 | - i@sunisle.org 12 | -------------------------------------------------------------------------------- /.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "java.compile.nullAnalysis.mode": "automatic", 3 | "java.configuration.updateBuildConfiguration": "interactive" 4 | } -------------------------------------------------------------------------------- /CNAME: -------------------------------------------------------------------------------- 1 | doc.idealworld.group 2 | -------------------------------------------------------------------------------- /COPYRIGHT: -------------------------------------------------------------------------------- 1 | Copyright 2022. the original author or authors 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. -------------------------------------------------------------------------------- /deploy.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | 4 | mvn -Ddew.it.skip=true clean deploy -P release 5 | -------------------------------------------------------------------------------- /devops/cicd/gitlabci/readme.adoc: -------------------------------------------------------------------------------- 1 | [[dew-gitlab-ci]] 2 | ==== Dew CI/CD : Gitlab CI 实现 3 | 4 | 此为Gitlab CI上的 CI/CD 处理,集成说明参见: <> 5 | 6 | .前置准备 7 | 8 | . 创建Gitlab项目 9 | . 执行 ``dew-devops.sh`` 初始化项目对应的各个环境(详见 <>) 10 | . 在项目代码中添加并配置 ``.dew`` 文件(详见 <>) 11 | 12 | .核心流程 13 | 14 | . 配置 ``.gitlab-ci.yml``,配置参见 link:https://github.com/gudaoxuri/dew/blob/master/devops/cicd/gitlabci/.gitlab-ci-template.yml[gitlab-ci-template.yml] 15 | . 添加 ``.gitlab-ci.yml`` 到项目代码根目录 16 | 17 | [[devops-cicd-gitlab-template]] 18 | [source,yml] 19 | .gitlab-ci-template.yml 20 | ---- 21 | include::.gitlab-ci-template.yml[] 22 | ---- 23 | -------------------------------------------------------------------------------- /devops/cicd/jenkins/scripts/dew-maven-agent-update.groovy: -------------------------------------------------------------------------------- 1 | /* 2 | * 需要以下参数化构建参数 3 | * jenkins_agents 需要更新的Jenkins节点,多个以,逗号分隔,如不填写,默认为master 4 | * MAVEN_AGENT_URL 最新的 dew-maven-agent jar 包的地址;仓库路径:https://oss.sonatype.org/content/repositories/public/group/idealworld/dew/dew-maven-agent 5 | */ 6 | pipeline { 7 | agent any 8 | stages { 9 | stage('Dew maven agent update') { 10 | steps { 11 | script { 12 | if (!env.jenkins_agents) { 13 | jenkins_agents = "master" 14 | } 15 | for (jenkins_agent in jenkins_agents.tokenize(',')) { 16 | stage("${jenkins_agent}") { 17 | node("${jenkins_agent}") { 18 | // MAVEN_AGENT_URL参数值在Jenkins的job的配置中修改 19 | sh " mkdir -p /opt/maven/ && mkdir -p /opt/jar/ && curl -o /opt/jar/dew-maven-agent.jar ${MAVEN_AGENT_URL}" 20 | sh "cd /opt/jar/ && ls -a " 21 | } 22 | } 23 | } 24 | } 25 | } 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /devops/docker/dew-devops/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM maven:3.6.3-jdk-11 2 | 3 | # ----------------- Add git client 4 | 5 | RUN apt-get install git 6 | 7 | # ----------------- Add node 8 | RUN curl -sL https://deb.nodesource.com/setup_12.x | bash - \ 9 | && apt-get install -y nodejs 10 | 11 | # ----------------- Add maven agent 12 | ARG MAVEN_AGENT_URL=https://oss.sonatype.org/content/repositories/public/group/idealworld/dew/dew-maven-agent/3.0.0-rc.7/dew-maven-agent-3.0.0-rc.7.jar 13 | 14 | RUN mkdir -p /opt/maven/ \ 15 | && mkdir -p /opt/jar/ \ 16 | && curl -o /opt/jar/dew-maven-agent.jar $MAVEN_AGENT_URL 17 | 18 | # Use a custom settings.xml file 19 | # "/opt/maven/settings.xml" will be mounted by kubernetes ConfigMap in the CI/CD process 20 | RUN echo '\n\n' > /opt/maven/settings.xml \ 21 | && sed -i 's/\${CLASSWORLDS_LAUNCHER} "$@"/\${CLASSWORLDS_LAUNCHER} -s \/opt\/maven\/settings.xml "$@"/g' /usr/share/maven/bin/mvn 22 | 23 | ENV MAVEN_OPTS="-javaagent:/opt/jar/dew-maven-agent.jar -Dmaven.repo.local=.m2 -Dorg.apache.maven.user-settings=/opt/maven/settings.xml" 24 | 25 | CMD ["sh"] 26 | -------------------------------------------------------------------------------- /devops/docker/dew-devops/readme.adoc: -------------------------------------------------------------------------------- 1 | ==== Dew Docker Image : 集成CI/CD能力 2 | 3 | 本镜像为Dew微服务体系的组成部分,集成说明参见: <> 4 | 5 | ---- 6 | # 直接使用docker hub镜像或手工打包: 7 | docker build -t dewms/devops . 8 | 或 9 | docker build -t dewms/devops --build-arg MAVEN_AGENT_URL=<> . 10 | 11 | 12 | # 测试 13 | docker run -it dewms/devops 14 | - 15 | # 正确显示Java版本 16 | java -version 17 | # 正确显示Maven版本 18 | mvn -version 19 | # 正确显示Node版本 20 | node -v 21 | # 正确显示NPM版本 22 | npm version 23 | - 24 | ---- 25 | -------------------------------------------------------------------------------- /devops/it/src/it/helloworld-backend/.dew: -------------------------------------------------------------------------------- 1 | # 默认通知配置,详见 Dew的通知处理模块 2 | notifies: 3 | - type: DD 4 | args: 5 | # 通知的URL,可自行修改,详见 https://open-doc.dingtalk.com/microapp/serverapi2/qf2nxq 6 | url: https://oapi.dingtalk.com/robot/send?access_token=8ff65c48001c1981df7d326b5cac497e5ca27190d5e7ab7fe9168ad69b103455 7 | profiles: 8 | # 添加测试环境 9 | test: 10 | # 指定测试环境的namespace,此namespace需要在Kubernetes及harbor中已存在 11 | namespace: dew-test 12 | uat: 13 | # 指定测试环境的namespace,此namespace需要在Kubernetes及harbor中已存在 14 | namespace: dew-uat -------------------------------------------------------------------------------- /devops/it/src/it/helloworld-backend/.gitignore: -------------------------------------------------------------------------------- 1 | log/ 2 | logs/ 3 | tmp/ 4 | *.tmp 5 | *.bak 6 | 7 | target/ 8 | 9 | .cluster/ 10 | 11 | **.db 12 | 13 | .mvn/ 14 | mvnw 15 | mvnw.cmd 16 | 17 | .idea/ 18 | out/ 19 | *.iws 20 | *.iml 21 | *.ipr 22 | 23 | .settings/ 24 | .classpath 25 | .project 26 | .apt_generated 27 | .factorypath 28 | .springBeans 29 | 30 | node_modules/ 31 | -------------------------------------------------------------------------------- /devops/it/src/it/helloworld-backend/.gitlab-ci.yml: -------------------------------------------------------------------------------- 1 | stages: 2 | - deploy 3 | 4 | cache: 5 | paths: 6 | - .m2/ 7 | 8 | test deploy: 9 | stage: deploy 10 | only: 11 | - test 12 | tags: 13 | - test 14 | script: 15 | - mvn -P devops deploy 16 | -------------------------------------------------------------------------------- /devops/it/src/it/helloworld-backend/expected/Service.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: Service 3 | metadata: 4 | annotations: 5 | dew.idealworld.group/git-commit: "@ignore@" 6 | dew.idealworld.group/scm-url: "@ignore@" 7 | sidecar.jaegertracing.io/inject: 'true' 8 | labels: 9 | app: helloworld-backend 10 | provider: dew 11 | version: "@ignore@" 12 | expose: 'true' 13 | group: group.idealworld.dew.devops.it 14 | name: helloworld-backend 15 | namespace: dew-test 16 | spec: 17 | ports: 18 | - name: http 19 | port: 8080 20 | protocol: TCP 21 | targetPort: 8080 22 | selector: 23 | app: helloworld-backend 24 | group: group.idealworld.dew.devops.it 25 | -------------------------------------------------------------------------------- /devops/it/src/it/helloworld-backend/invoker.properties: -------------------------------------------------------------------------------- 1 | invoker.goals.1=-P devops deploy -Ddew_devops_profile=test 2 | invoker.mavenOpts=-Djdk.tls.client.protocols=TLSv1.2 -Dmaven.wagon.http.ssl.insecure=true -Dmaven.wagon.http.ssl.allowall=true -Dmaven.wagon.http.ssl.ignore.validity.dates=true 3 | invoker.debug=false 4 | -------------------------------------------------------------------------------- /devops/it/src/it/helloworld-backend/readme.adoc: -------------------------------------------------------------------------------- 1 | ==== DevOps示例 : Helloworld后端服务 2 | 3 | 本示例为Dew微服务体系的组成部分,使用说明参见:http://doc.dew.idealworld.group 4 | 5 | .说明 6 | 此示例用于演示后端服务的自动化部署到Kubernetes,完成后推送钉钉通知。 7 | 8 | [source,yml] 9 | ./.dew配置说明 10 | ---- 11 | include::.dew[] 12 | ---- 13 | 14 | .前置准备 15 | 16 | . 执行 ``dew-devops.sh`` 初始化项目对应的test环境( 详见 http://doc.dew.idealworld.group/#devops-user-manual ) 17 | 18 | .手工执行 19 | ---- 20 | # 参数设置 (win/unix) 21 | SET/export dew_devops_kube_config=... 22 | SET/export dew_devops_docker_host=... 23 | SET/export dew_devops_docker_registry_url=... 24 | SET/export dew_devops_docker_registry_username=... 25 | SET/export dew_devops_docker_registry_password=... 26 | 27 | # 执行如下maven命令(发布到test环境) 28 | mvn -P devops deploy -Ddew_devops_profile=test 29 | ---- 30 | 31 | .Gitlab CI执行 32 | ---- 33 | # Merge或Push代码到test分支 34 | ---- 35 | 36 | -------------------------------------------------------------------------------- /devops/it/src/it/helloworld-backend/src/main/java/group/idealworld/dew/devops/it/Application.java: -------------------------------------------------------------------------------- 1 | package group.idealworld.dew.devops.it; 2 | 3 | import org.springframework.boot.autoconfigure.SpringBootApplication; 4 | import org.springframework.boot.builder.SpringApplicationBuilder; 5 | 6 | /** 7 | * Application. 8 | * 9 | * @author gudaoxuri 10 | */ 11 | @SpringBootApplication 12 | public class Application { 13 | 14 | /** 15 | * The entry point of application. 16 | * 17 | * @param args the input arguments 18 | */ 19 | public static void main(String[] args) { 20 | new SpringApplicationBuilder(Application.class).run(args); 21 | } 22 | 23 | } 24 | -------------------------------------------------------------------------------- /devops/it/src/it/helloworld-backend/src/main/java/group/idealworld/dew/devops/it/Controller.java: -------------------------------------------------------------------------------- 1 | package group.idealworld.dew.devops.it; 2 | 3 | import org.springframework.web.bind.annotation.GetMapping; 4 | import org.springframework.web.bind.annotation.RestController; 5 | 6 | /** 7 | * Controller. 8 | * 9 | * @author gudaoxuri 10 | */ 11 | @RestController 12 | public class Controller { 13 | 14 | /** 15 | * Hi. 16 | * 17 | * @return the message 18 | */ 19 | @GetMapping("/") 20 | public String hi() { 21 | return "hello world"; 22 | } 23 | 24 | } 25 | -------------------------------------------------------------------------------- /devops/it/src/it/helloworld-backend/src/main/resources/bootstrap.yml: -------------------------------------------------------------------------------- 1 | spring: 2 | application: 3 | name: helloworld-backend 4 | -------------------------------------------------------------------------------- /devops/it/src/it/helloworld-backend/verify.groovy: -------------------------------------------------------------------------------- 1 | import group.idealworld.dew.devops.it.verify.HelloWorldBackendVerify 2 | 3 | new HelloWorldBackendVerify().verify(basedir) 4 | -------------------------------------------------------------------------------- /devops/it/src/it/helloworld-frontend/.dew: -------------------------------------------------------------------------------- 1 | profiles: 2 | # 添加测试环境 3 | test: 4 | # 指定测试环境的namespace 5 | namespace: dew-test 6 | -------------------------------------------------------------------------------- /devops/it/src/it/helloworld-frontend/.env.test: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gudaoxuri/dew/23be7cb9e3a7b70124152a1e63219f67e5a9b48c/devops/it/src/it/helloworld-frontend/.env.test -------------------------------------------------------------------------------- /devops/it/src/it/helloworld-frontend/.gitignore: -------------------------------------------------------------------------------- 1 | log/ 2 | logs/ 3 | tmp/ 4 | *.tmp 5 | *.bak 6 | 7 | target/ 8 | 9 | .cluster/ 10 | 11 | **.db 12 | 13 | .mvn/ 14 | mvnw 15 | mvnw.cmd 16 | 17 | .idea/ 18 | out/ 19 | *.iws 20 | *.iml 21 | *.ipr 22 | 23 | .settings/ 24 | .classpath 25 | .project 26 | .apt_generated 27 | .factorypath 28 | .springBeans 29 | 30 | node_modules/ 31 | -------------------------------------------------------------------------------- /devops/it/src/it/helloworld-frontend/.gitlab-ci.yml: -------------------------------------------------------------------------------- 1 | stages: 2 | - deploy 3 | 4 | cache: 5 | paths: 6 | - node_modules/ 7 | 8 | test deploy: 9 | stage: deploy 10 | only: 11 | - test 12 | tags: 13 | - test 14 | script: 15 | - mvn -P devops deploy 16 | -------------------------------------------------------------------------------- /devops/it/src/it/helloworld-frontend/babel.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | presets: [ 3 | '@vue/app' 4 | ] 5 | } 6 | -------------------------------------------------------------------------------- /devops/it/src/it/helloworld-frontend/expected/Deployment.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: apps/v1 2 | kind: Deployment 3 | metadata: 4 | annotations: 5 | dew.idealworld.group/git-commit: "@ignore@" 6 | dew.idealworld.group/scm-url: "@ignore@" 7 | labels: 8 | app: helloworld-frontend 9 | provider: dew 10 | version: "@ignore@" 11 | group: group.idealworld.dew.devops.it 12 | name: helloworld-frontend 13 | namespace: dew-test 14 | spec: 15 | replicas: 1 16 | revisionHistoryLimit: 3 17 | selector: 18 | matchLabels: 19 | app: helloworld-frontend 20 | group: group.idealworld.dew.devops.it 21 | template: 22 | metadata: 23 | annotations: 24 | dew.idealworld.group/git-commit: "@ignore@" 25 | dew.idealworld.group/scm-url: "@ignore@" 26 | labels: 27 | app: helloworld-frontend 28 | provider: dew 29 | version: "@ignore@" 30 | group: group.idealworld.dew.devops.it 31 | spec: 32 | containers: 33 | - image: "@ignore@" 34 | imagePullPolicy: IfNotPresent 35 | name: dew-app 36 | ports: 37 | - containerPort: 80 38 | name: http 39 | protocol: TCP 40 | resources: 41 | limits: {} 42 | requests: {} 43 | nodeSelector: 44 | group: app 45 | -------------------------------------------------------------------------------- /devops/it/src/it/helloworld-frontend/expected/Service.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: Service 3 | metadata: 4 | annotations: 5 | dew.idealworld.group/git-commit: "@ignore@" 6 | dew.idealworld.group/scm-url: "@ignore@" 7 | labels: 8 | app: helloworld-frontend 9 | provider: dew 10 | version: "@ignore@" 11 | expose: 'true' 12 | group: group.idealworld.dew.devops.it 13 | name: helloworld-frontend 14 | namespace: dew-test 15 | spec: 16 | ports: 17 | - name: http 18 | port: 80 19 | protocol: TCP 20 | targetPort: 80 21 | selector: 22 | app: helloworld-frontend 23 | group: group.idealworld.dew.devops.it 24 | -------------------------------------------------------------------------------- /devops/it/src/it/helloworld-frontend/invoker.properties: -------------------------------------------------------------------------------- 1 | invoker.goals.1=-P devops deploy -Ddew_devops_profile=test 2 | invoker.mavenOpts=-Djdk.tls.client.protocols=TLSv1.2 -Dmaven.wagon.http.ssl.insecure=true -Dmaven.wagon.http.ssl.allowall=true -Dmaven.wagon.http.ssl.ignore.validity.dates=true 3 | invoker.debug=false 4 | -------------------------------------------------------------------------------- /devops/it/src/it/helloworld-frontend/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "hello-world", 3 | "version": "0.1.0", 4 | "private": true, 5 | "scripts": { 6 | "serve": "vue-cli-service serve", 7 | "build:default": "vue-cli-service build", 8 | "build:test": "vue-cli-service build --mode test", 9 | "lint": "vue-cli-service lint" 10 | }, 11 | "dependencies": { 12 | "vue": "^2.6.6" 13 | }, 14 | "devDependencies": { 15 | "@vue/cli-plugin-babel": "^3.5.0", 16 | "@vue/cli-plugin-eslint": "^3.5.0", 17 | "@vue/cli-service": "^3.5.0", 18 | "babel-eslint": "^10.0.1", 19 | "eslint": "^5.8.0", 20 | "eslint-plugin-vue": "^5.0.0", 21 | "vue-template-compiler": "^2.5.21" 22 | }, 23 | "eslintConfig": { 24 | "root": true, 25 | "env": { 26 | "node": true 27 | }, 28 | "extends": [ 29 | "plugin:vue/essential", 30 | "eslint:recommended" 31 | ], 32 | "rules": {}, 33 | "parserOptions": { 34 | "parser": "babel-eslint" 35 | } 36 | }, 37 | "postcss": { 38 | "plugins": { 39 | "autoprefixer": {} 40 | } 41 | }, 42 | "browserslist": [ 43 | "> 1%", 44 | "last 2 versions", 45 | "not ie <= 8" 46 | ] 47 | } 48 | -------------------------------------------------------------------------------- /devops/it/src/it/helloworld-frontend/public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gudaoxuri/dew/23be7cb9e3a7b70124152a1e63219f67e5a9b48c/devops/it/src/it/helloworld-frontend/public/favicon.ico -------------------------------------------------------------------------------- /devops/it/src/it/helloworld-frontend/public/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | hello-world 10 | 11 | 12 | 13 | 17 |
18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /devops/it/src/it/helloworld-frontend/readme.adoc: -------------------------------------------------------------------------------- 1 | ==== DevOps示例 : Helloworld前端 2 | 3 | 本示例为Dew微服务体系的组成部分,使用说明参见:http://doc.dew.idealworld.group 4 | 5 | .说明 6 | 此示例用于演示前端服务的自动化部署到Kubernetes。 7 | 8 | [NOTE] 9 | ==== 10 | 前端需要添加一个pom.xml,指定为pom类型 ``pom`` 即可。 11 | ==== 12 | 13 | [source,yml] 14 | ./.dew配置说明 15 | ---- 16 | include::.dew[] 17 | ---- 18 | 19 | .前置准备 20 | 21 | . 执行 ``dew-devops.sh`` 初始化项目对应的test环境(详见 http://doc.dew.idealworld.group/#devops-user-manual ) 22 | 23 | .手工执行 24 | ---- 25 | # 参数设置 (win/unix) 26 | SET/export dew_devops_kube_config=... 27 | SET/export dew_devops_docker_host=... 28 | SET/export dew_devops_docker_registry_url=... 29 | SET/export dew_devops_docker_registry_username=... 30 | SET/export dew_devops_docker_registry_password=... 31 | 32 | # 执行如下maven命令(发布到test环境) 33 | mvn -P devops deploy -Ddew_devops_profile=test 34 | ---- 35 | 36 | .Gitlab CI执行 37 | ---- 38 | # Merge或Push代码到test分支 39 | ---- 40 | 41 | -------------------------------------------------------------------------------- /devops/it/src/it/helloworld-frontend/src/App.vue: -------------------------------------------------------------------------------- 1 | 7 | 8 | 18 | 19 | 29 | -------------------------------------------------------------------------------- /devops/it/src/it/helloworld-frontend/src/assets/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gudaoxuri/dew/23be7cb9e3a7b70124152a1e63219f67e5a9b48c/devops/it/src/it/helloworld-frontend/src/assets/logo.png -------------------------------------------------------------------------------- /devops/it/src/it/helloworld-frontend/src/main.js: -------------------------------------------------------------------------------- 1 | import Vue from 'vue' 2 | import App from './App.vue' 3 | 4 | Vue.config.productionTip = false 5 | 6 | new Vue({ 7 | render: h => h(App), 8 | }).$mount('#app') 9 | -------------------------------------------------------------------------------- /devops/it/src/it/helloworld-frontend/verify.groovy: -------------------------------------------------------------------------------- 1 | import group.idealworld.dew.devops.it.verify.HelloWorldFrontendVerify 2 | 3 | new HelloWorldFrontendVerify().verify(basedir) 4 | -------------------------------------------------------------------------------- /devops/it/src/it/helloworld-library/.dew: -------------------------------------------------------------------------------- 1 | profiles: 2 | # 添加测试环境 3 | test: 4 | # 指定测试环境的namespace 5 | namespace: dew-test 6 | -------------------------------------------------------------------------------- /devops/it/src/it/helloworld-library/.gitignore: -------------------------------------------------------------------------------- 1 | log/ 2 | logs/ 3 | tmp/ 4 | *.tmp 5 | *.bak 6 | 7 | target/ 8 | 9 | .cluster/ 10 | 11 | **.db 12 | 13 | .mvn/ 14 | mvnw 15 | mvnw.cmd 16 | 17 | .idea/ 18 | out/ 19 | *.iws 20 | *.iml 21 | *.ipr 22 | 23 | .settings/ 24 | .classpath 25 | .project 26 | .apt_generated 27 | .factorypath 28 | .springBeans 29 | 30 | node_modules/ 31 | -------------------------------------------------------------------------------- /devops/it/src/it/helloworld-library/.gitlab-ci.yml: -------------------------------------------------------------------------------- 1 | stages: 2 | - deploy 3 | 4 | cache: 5 | paths: 6 | - .m2/ 7 | 8 | test deploy: 9 | stage: deploy 10 | only: 11 | - test 12 | tags: 13 | - test 14 | script: 15 | - mvn -P devops deploy 16 | -------------------------------------------------------------------------------- /devops/it/src/it/helloworld-library/invoker.properties: -------------------------------------------------------------------------------- 1 | invoker.goals.1=-P devops deploy -Ddew_devops_profile=test 2 | invoker.mavenOpts=-Djdk.tls.client.protocols=TLSv1.2 -Dmaven.wagon.http.ssl.insecure=true -Dmaven.wagon.http.ssl.allowall=true -Dmaven.wagon.http.ssl.ignore.validity.dates=true 3 | invoker.debug=false 4 | -------------------------------------------------------------------------------- /devops/it/src/it/helloworld-library/readme.adoc: -------------------------------------------------------------------------------- 1 | ==== DevOps示例 : Helloworld类库 2 | 3 | 本示例为Dew微服务体系的组成部分,使用说明参见:http://doc.dew.idealworld.group 4 | 5 | .说明 6 | 此示例用于演示类库的自动化部署到Maven。 7 | 8 | [source,yml] 9 | ./.dew配置说明 10 | ---- 11 | include::.dew[] 12 | ---- 13 | 14 | .手工执行 15 | ---- 16 | # 参数设置 (win/unix) 17 | SET/export dew_devops_kube_config=... 18 | SET/export dew_devops_it_snapshotRepository_id=<私库Id,如私库需要认证则此Id对应的认证信息要添加到 settings.xml中> 19 | SET/export dew_devops_it_snapshotRepository_url=<私库Url> 20 | 21 | # 执行如下maven命令(发布到test环境) 22 | mvn -P devops deploy -Ddew_devops_profile=test 23 | ---- 24 | 25 | .Gitlab CI执行 26 | ---- 27 | # Merge或Push代码到test分支 28 | ---- 29 | 30 | -------------------------------------------------------------------------------- /devops/it/src/it/helloworld-library/src/main/java/group/idealworld/dew/devops/it/SomeHelper.java: -------------------------------------------------------------------------------- 1 | package group.idealworld.dew.devops.it; 2 | 3 | /** 4 | * Some helper. 5 | * 6 | * @author gudaoxuri 7 | */ 8 | public class SomeHelper { 9 | 10 | /** 11 | * Echo. 12 | * 13 | * @param req the request 14 | * @return the response 15 | */ 16 | public static String echo(String req) { 17 | return "resp:" + req; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /devops/it/src/it/helloworld-library/verify.groovy: -------------------------------------------------------------------------------- 1 | import group.idealworld.dew.devops.it.verify.HelloWorldLibraryVerify 2 | 3 | new HelloWorldLibraryVerify().verify(basedir) 4 | -------------------------------------------------------------------------------- /devops/it/src/it/todo/.dew: -------------------------------------------------------------------------------- 1 | # 默认通知配置,详见 Dew的通知处理模块 2 | notifies: 3 | - type: DD 4 | args: 5 | # 通知的URL,可自行修改,详见 https://open-doc.dingtalk.com/microapp/serverapi2/qf2nxq 6 | url: https://oapi.dingtalk.com/robot/send?access_token=8ff65c48001c1981df7d326b5cac497e5ca27190d5e7ab7fe9168ad69b103455 7 | profiles: 8 | # 添加uat环境 9 | uat: 10 | # 指定仿真环境的namespace 11 | namespace: dew-uat 12 | # 添加prod环境 13 | prod: 14 | # 指定生产环境的namespace 15 | namespace: dew-prod 16 | -------------------------------------------------------------------------------- /devops/it/src/it/todo/.gitignore: -------------------------------------------------------------------------------- 1 | log/ 2 | logs/ 3 | tmp/ 4 | *.tmp 5 | *.bak 6 | 7 | target/ 8 | 9 | .cluster/ 10 | 11 | **.db 12 | 13 | .mvn/ 14 | mvnw 15 | mvnw.cmd 16 | 17 | .idea/ 18 | out/ 19 | *.iws 20 | *.iml 21 | *.ipr 22 | 23 | .settings/ 24 | .classpath 25 | .project 26 | .apt_generated 27 | .factorypath 28 | .springBeans 29 | 30 | node_modules/ 31 | -------------------------------------------------------------------------------- /devops/it/src/it/todo/.gitlab-ci.yml: -------------------------------------------------------------------------------- 1 | stages: 2 | - deploy 3 | 4 | cache: 5 | paths: 6 | - frontend/node_modules/ 7 | - .m2/ 8 | 9 | uat deploy: 10 | stage: deploy 11 | only: 12 | - uat 13 | tags: 14 | - uat 15 | script: 16 | - mvn -P devops deploy 17 | 18 | prod deploy: 19 | stage: deploy 20 | only: 21 | - prod 22 | tags: 23 | - prod 24 | script: 25 | - mvn -P devops deploy 26 | -------------------------------------------------------------------------------- /devops/it/src/it/todo/backend/libraries/common/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 4.0.0 6 | 7 | 8 | group.idealworld.dew.devops.it 9 | todo-parent 10 | 3.0.0-rc.8 11 | ../../.. 12 | 13 | 14 | todo-common 15 | jar 16 | 17 | 18 | true 19 | 20 | 21 | 22 | 23 | group.idealworld.dew 24 | boot-starter 25 | 26 | 27 | 28 | org.springframework.boot 29 | spring-boot-starter-data-jpa 30 | 31 | 32 | junit 33 | junit 34 | test 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /devops/it/src/it/todo/backend/libraries/common/src/main/java/group/idealworld/dew/devops/it/todo/common/Constants.java: -------------------------------------------------------------------------------- 1 | package group.idealworld.dew.devops.it.todo.common; 2 | 3 | /** 4 | * Constants. 5 | * 6 | * @author gudaoxuri 7 | */ 8 | public class Constants { 9 | 10 | 11 | /** 12 | * The constant MQ_NOTIFY_TODO_ADD. 13 | */ 14 | public static final String MQ_NOTIFY_TODO_ADD = "todo:notify:todo:add"; 15 | 16 | /** 17 | * The constant MQ_NOTIFY_TODO_DEL. 18 | */ 19 | public static final String MQ_NOTIFY_TODO_DEL = "todo:notify:todo:del"; 20 | 21 | } 22 | -------------------------------------------------------------------------------- /devops/it/src/it/todo/backend/libraries/common/src/main/java/group/idealworld/dew/devops/it/todo/common/TodoParentApplication.java: -------------------------------------------------------------------------------- 1 | package group.idealworld.dew.devops.it.todo.common; 2 | 3 | import org.springframework.boot.autoconfigure.SpringBootApplication; 4 | 5 | /** 6 | * To-do parent application. 7 | *

8 | * 空实现,做为所有组件启动类的父类 9 | * 10 | * @author gudaoxuri 11 | */ 12 | // 启用 Spring Boot 能力 13 | @SpringBootApplication 14 | public class TodoParentApplication { 15 | 16 | } 17 | -------------------------------------------------------------------------------- /devops/it/src/it/todo/backend/libraries/common/src/main/java/group/idealworld/dew/devops/it/todo/common/domain/IdEntity.java: -------------------------------------------------------------------------------- 1 | package group.idealworld.dew.devops.it.todo.common.domain; 2 | 3 | import jakarta.persistence.GeneratedValue; 4 | import jakarta.persistence.GenerationType; 5 | import jakarta.persistence.Id; 6 | import jakarta.persistence.MappedSuperclass; 7 | 8 | /** 9 | * Id entity. 10 | * 11 | * @author gudaoxuri 12 | */ 13 | @MappedSuperclass 14 | public class IdEntity { 15 | 16 | @Id 17 | @GeneratedValue(strategy = GenerationType.AUTO) 18 | protected int id; 19 | 20 | /** 21 | * Gets id. 22 | * 23 | * @return the id 24 | */ 25 | public int getId() { 26 | return id; 27 | } 28 | 29 | /** 30 | * Sets id. 31 | * 32 | * @param id the id 33 | */ 34 | public void setId(int id) { 35 | this.id = id; 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /devops/it/src/it/todo/backend/libraries/common/src/test/java/group/idealworld/dew/devops/it/todo/common/SomeTest.java: -------------------------------------------------------------------------------- 1 | package group.idealworld.dew.devops.it.todo.common; 2 | 3 | import org.junit.Test; 4 | 5 | /** 6 | * Some test. 7 | * 8 | * @author gudaoxuri 9 | */ 10 | public class SomeTest { 11 | 12 | /*@Test 13 | public void testAll() throws Exception { 14 | throw new Exception("Has error."); 15 | }*/ 16 | } 17 | -------------------------------------------------------------------------------- /devops/it/src/it/todo/backend/services/compute/expected/Service.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: Service 3 | metadata: 4 | annotations: 5 | dew.idealworld.group/git-commit: "@ignore@" 6 | dew.idealworld.group/scm-url: "@ignore@" 7 | sidecar.jaegertracing.io/inject: 'true' 8 | labels: 9 | app: compute 10 | provider: dew 11 | version: "@ignore@" 12 | expose: 'true' 13 | group: group.idealworld.dew.devops.it 14 | name: compute 15 | namespace: dew-prod 16 | spec: 17 | ports: 18 | - name: http 19 | port: 8080 20 | protocol: TCP 21 | targetPort: 8080 22 | selector: 23 | app: compute 24 | group: group.idealworld.dew.devops.it 25 | -------------------------------------------------------------------------------- /devops/it/src/it/todo/backend/services/compute/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 4.0.0 6 | 7 | 8 | group.idealworld.dew.devops.it 9 | todo-parent 10 | 3.0.0-rc.8 11 | ../../.. 12 | 13 | 14 | todo-compute 15 | jar 16 | 17 | 18 | true 19 | 20 | 21 | 22 | 23 | group.idealworld.dew.devops.it 24 | todo-common 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /devops/it/src/it/todo/backend/services/compute/src/main/java/group/idealworld/dew/devops/it/todo/compute/TodoComputeApplication.java: -------------------------------------------------------------------------------- 1 | package group.idealworld.dew.devops.it.todo.compute; 2 | 3 | import group.idealworld.dew.devops.it.todo.common.TodoParentApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | import org.springframework.boot.builder.SpringApplicationBuilder; 6 | 7 | /** 8 | * To-do compute application. 9 | * 10 | * @author gudaoxuri 11 | */ 12 | @SpringBootApplication 13 | public class TodoComputeApplication extends TodoParentApplication { 14 | 15 | /** 16 | * The entry point of application. 17 | * 18 | * @param args the input arguments 19 | */ 20 | public static void main(String[] args) { 21 | new SpringApplicationBuilder(TodoComputeApplication.class).run(args); 22 | } 23 | 24 | } 25 | -------------------------------------------------------------------------------- /devops/it/src/it/todo/backend/services/compute/src/main/java/group/idealworld/dew/devops/it/todo/compute/service/ComputeService.java: -------------------------------------------------------------------------------- 1 | package group.idealworld.dew.devops.it.todo.compute.service; 2 | 3 | import com.ecfront.dew.common.$; 4 | import com.ecfront.dew.common.ScriptHelper; 5 | import org.slf4j.Logger; 6 | import org.slf4j.LoggerFactory; 7 | import org.springframework.stereotype.Service; 8 | 9 | /** 10 | * Compute service. 11 | * 12 | * @author gudaoxuri 13 | */ 14 | @Service 15 | public class ComputeService { 16 | 17 | private static final Logger LOGGER = LoggerFactory.getLogger(ComputeService.class); 18 | 19 | /** 20 | * Compute. 21 | * 22 | * @param jsCode the js code 23 | * @return result 24 | */ 25 | public String compute(String jsCode) { 26 | LOGGER.info("Compute : " + jsCode); 27 | return $.eval(ScriptHelper.ScriptKind.JS, Integer.class, jsCode).toString(); 28 | } 29 | 30 | } 31 | -------------------------------------------------------------------------------- /devops/it/src/it/todo/backend/services/compute/src/main/resources/application-default.yml: -------------------------------------------------------------------------------- 1 | server: 2 | port: 8082 3 | -------------------------------------------------------------------------------- /devops/it/src/it/todo/backend/services/compute/src/main/resources/bootstrap.yml: -------------------------------------------------------------------------------- 1 | spring: 2 | application: 3 | name: compute 4 | 5 | -------------------------------------------------------------------------------- /devops/it/src/it/todo/backend/services/kernel/.dew: -------------------------------------------------------------------------------- 1 | docker: 2 | # 使用自定义的Image 3 | image: openjdk:11 4 | app: 5 | # 资源上限设定 6 | containerResourcesLimits: 7 | memory: "1024Mi" 8 | cpu: "800m" 9 | -------------------------------------------------------------------------------- /devops/it/src/it/todo/backend/services/kernel/expected/Service.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: Service 3 | metadata: 4 | annotations: 5 | dew.idealworld.group/git-commit: "@ignore@" 6 | dew.idealworld.group/scm-url: "@ignore@" 7 | sidecar.jaegertracing.io/inject: 'true' 8 | labels: 9 | app: kernel 10 | provider: dew 11 | version: "@ignore@" 12 | expose: 'true' 13 | group: group.idealworld.dew.devops.it 14 | name: kernel 15 | namespace: dew-prod 16 | spec: 17 | ports: 18 | - name: http 19 | port: 8080 20 | protocol: TCP 21 | targetPort: 8080 22 | selector: 23 | app: kernel 24 | group: group.idealworld.dew.devops.it 25 | -------------------------------------------------------------------------------- /devops/it/src/it/todo/backend/services/kernel/src/main/java/group/idealworld/dew/devops/it/todo/kernel/TodoKernelApplication.java: -------------------------------------------------------------------------------- 1 | package group.idealworld.dew.devops.it.todo.kernel; 2 | 3 | import group.idealworld.dew.devops.it.todo.common.TodoParentApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | import org.springframework.boot.builder.SpringApplicationBuilder; 6 | 7 | /** 8 | * To-do kernel application. 9 | * 10 | * @author gudaoxuri 11 | */ 12 | @SpringBootApplication 13 | public class TodoKernelApplication extends TodoParentApplication { 14 | 15 | /** 16 | * The entry point of application. 17 | * 18 | * @param args the input arguments 19 | */ 20 | public static void main(String[] args) { 21 | new SpringApplicationBuilder(TodoKernelApplication.class).run(args); 22 | } 23 | 24 | } 25 | -------------------------------------------------------------------------------- /devops/it/src/it/todo/backend/services/kernel/src/main/java/group/idealworld/dew/devops/it/todo/kernel/repository/TodoRepository.java: -------------------------------------------------------------------------------- 1 | package group.idealworld.dew.devops.it.todo.kernel.repository; 2 | 3 | import group.idealworld.dew.devops.it.todo.kernel.domain.Todo; 4 | import org.springframework.data.jpa.repository.JpaRepository; 5 | 6 | import jakarta.annotation.Resource; 7 | 8 | /** 9 | * The interface To-do repository. 10 | * 11 | * @author gudaoxuri 12 | */ 13 | @Resource 14 | public interface TodoRepository extends JpaRepository { 15 | 16 | } 17 | -------------------------------------------------------------------------------- /devops/it/src/it/todo/backend/services/kernel/src/main/resources/application-default.yml: -------------------------------------------------------------------------------- 1 | spring: 2 | datasource: 3 | redis: # Redis配置 4 | host: localhost 5 | port: 6378 6 | database: 0 7 | password: 123456 8 | 9 | todo: 10 | service: 11 | compute: http://127.0.0.1:8082 12 | 13 | server: 14 | port: 8080 15 | -------------------------------------------------------------------------------- /devops/it/src/it/todo/backend/services/kernel/src/main/resources/application-prod.yml: -------------------------------------------------------------------------------- 1 | spring: 2 | datasource: 3 | redis: # Redis配置 4 | host: 172.25.208.23 5 | port: 6378 6 | database: 0 7 | password: 123456 8 | 9 | todo: 10 | service: 11 | compute: http://compute:8080 12 | -------------------------------------------------------------------------------- /devops/it/src/it/todo/backend/services/kernel/src/main/resources/application-uat.yml: -------------------------------------------------------------------------------- 1 | spring: 2 | datasource: 3 | redis: # Redis配置 4 | host: 172.25.208.23 5 | port: 6378 6 | database: 0 7 | password: 123456 8 | 9 | todo: 10 | service: 11 | compute: http://compute:8080 12 | -------------------------------------------------------------------------------- /devops/it/src/it/todo/backend/services/kernel/src/main/resources/application.yml: -------------------------------------------------------------------------------- 1 | spring: 2 | datasource: # DB配置 3 | url: jdbc:sqlite:sample.db 4 | 5 | dew: 6 | cluster: 7 | mq: redis # 使用Redis做为Dew集群的MQ实现 8 | -------------------------------------------------------------------------------- /devops/it/src/it/todo/backend/services/kernel/src/main/resources/bootstrap.yml: -------------------------------------------------------------------------------- 1 | spring: 2 | application: 3 | name: kernel 4 | 5 | management: 6 | endpoint: 7 | health: 8 | show-details: always 9 | -------------------------------------------------------------------------------- /devops/it/src/it/todo/backend/services/notifier/.dew: -------------------------------------------------------------------------------- 1 | skip: true 2 | docker: 3 | # 使用自定义的Image 4 | image: openjdk:11 5 | -------------------------------------------------------------------------------- /devops/it/src/it/todo/backend/services/notifier/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 4.0.0 6 | 7 | 8 | group.idealworld.dew.devops.it 9 | todo-parent 10 | 3.0.0-rc.8 11 | ../../.. 12 | 13 | 14 | todo-notifier 15 | jar 16 | 17 | 18 | true 19 | 20 | 21 | 22 | 23 | group.idealworld.dew.devops.it 24 | todo-common 25 | 26 | 27 | group.idealworld.dew 28 | cluster-spi-redis 29 | 30 | 31 | group.idealworld.dew 32 | test-starter 33 | 34 | compile 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /devops/it/src/it/todo/backend/services/notifier/src/main/java/group/idealworld/dew/devops/it/todo/notifier/TodoNotifierApplication.java: -------------------------------------------------------------------------------- 1 | package group.idealworld.dew.devops.it.todo.notifier; 2 | 3 | import group.idealworld.dew.devops.it.todo.common.TodoParentApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | import org.springframework.boot.builder.SpringApplicationBuilder; 6 | 7 | /** 8 | * To-do notifier application. 9 | * 10 | * @author gudaoxuri 11 | */ 12 | @SpringBootApplication 13 | public class TodoNotifierApplication extends TodoParentApplication { 14 | 15 | /** 16 | * The entry point of application. 17 | * 18 | * @param args the input arguments 19 | */ 20 | public static void main(String[] args) { 21 | new SpringApplicationBuilder(TodoNotifierApplication.class).run(args); 22 | } 23 | 24 | } 25 | -------------------------------------------------------------------------------- /devops/it/src/it/todo/backend/services/notifier/src/main/java/group/idealworld/dew/devops/it/todo/notifier/controller/NotifierController.java: -------------------------------------------------------------------------------- 1 | package group.idealworld.dew.devops.it.todo.notifier.controller; 2 | 3 | import group.idealworld.dew.Dew; 4 | import group.idealworld.dew.devops.it.todo.common.Constants; 5 | import org.slf4j.Logger; 6 | import org.slf4j.LoggerFactory; 7 | import org.springframework.web.bind.annotation.RestController; 8 | 9 | import jakarta.annotation.PostConstruct; 10 | 11 | /** 12 | * Notifier controller. 13 | * 14 | * @author gudaoxuri 15 | */ 16 | @RestController 17 | public class NotifierController { 18 | 19 | private static final Logger LOGGER = LoggerFactory.getLogger(NotifierController.class); 20 | 21 | /** 22 | * Process to-do add event. 23 | */ 24 | @PostConstruct 25 | public void processTodoAddEvent() { 26 | // 使用Dew的集群MQ功能实现消息点对点接收 27 | Dew.cluster.mq.response(Constants.MQ_NOTIFY_TODO_ADD, todo -> LOGGER.info("Received add todo event :" + todo)); 28 | } 29 | 30 | /** 31 | * Process to-do del event. 32 | */ 33 | @PostConstruct 34 | public void processTodoDelEvent() { 35 | Dew.cluster.mq.response(Constants.MQ_NOTIFY_TODO_DEL, 36 | todoId -> LOGGER.info("Received delete todo event :" + todoId)); 37 | } 38 | 39 | } 40 | -------------------------------------------------------------------------------- /devops/it/src/it/todo/backend/services/notifier/src/main/resources/application-default.yml: -------------------------------------------------------------------------------- 1 | spring: 2 | redis: 3 | host: localhost 4 | port: 6378 5 | database: 0 6 | password: 123456 7 | 8 | server: 9 | port: 8081 10 | -------------------------------------------------------------------------------- /devops/it/src/it/todo/backend/services/notifier/src/main/resources/application.yml: -------------------------------------------------------------------------------- 1 | dew: 2 | cluster: 3 | mq: redis 4 | 5 | -------------------------------------------------------------------------------- /devops/it/src/it/todo/backend/services/notifier/src/main/resources/bootstrap.yml: -------------------------------------------------------------------------------- 1 | spring: 2 | application: 3 | name: notifier 4 | 5 | -------------------------------------------------------------------------------- /devops/it/src/it/todo/frontend/.dew: -------------------------------------------------------------------------------- 1 | app: 2 | # tarojs cli 没有添加到依赖 @see https://github.com/NervJS/taro/pull/2226 3 | preparePackageCmd: "npm install && npm install -g @tarojs/cli" 4 | packageCmd: "npm run build:h5" 5 | -------------------------------------------------------------------------------- /devops/it/src/it/todo/frontend/.editorconfig: -------------------------------------------------------------------------------- 1 | # http://editorconfig.org 2 | root = true 3 | 4 | [*] 5 | indent_style = space 6 | indent_size = 2 7 | charset = utf-8 8 | trim_trailing_whitespace = true 9 | insert_final_newline = true 10 | 11 | [*.md] 12 | trim_trailing_whitespace = false 13 | -------------------------------------------------------------------------------- /devops/it/src/it/todo/frontend/.eslintrc: -------------------------------------------------------------------------------- 1 | { 2 | "extends": ["taro"], 3 | "rules": { 4 | "no-unused-vars": ["error", { "varsIgnorePattern": "Taro" }], 5 | "react/jsx-filename-extension": [1, { "extensions": [".js", ".jsx", ".tsx"] }] 6 | }, 7 | "parser": "babel-eslint", 8 | "plugins": ["typescript"] 9 | } 10 | -------------------------------------------------------------------------------- /devops/it/src/it/todo/frontend/.gitignore: -------------------------------------------------------------------------------- 1 | dist/ 2 | .temp/ 3 | .rn_temp/ 4 | node_modules/ 5 | .DS_Storepackage-lock.json 6 | -------------------------------------------------------------------------------- /devops/it/src/it/todo/frontend/config/dev.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | env: { 3 | NODE_ENV: '"development"' 4 | }, 5 | defineConstants: { 6 | }, 7 | h5: {} 8 | } 9 | -------------------------------------------------------------------------------- /devops/it/src/it/todo/frontend/config/prod.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | env: { 3 | NODE_ENV: '"prod"' 4 | }, 5 | defineConstants: { 6 | }, 7 | h5: { 8 | /** 9 | * 如果h5端编译后体积过大,可以使用webpack-bundle-analyzer插件对打包体积进行分析。 10 | * 参考代码如下: 11 | * webpackChain (chain) { 12 | * chain.plugin('analyzer') 13 | * .use(require('webpack-bundle-analyzer').BundleAnalyzerPlugin, []) 14 | * } 15 | */ 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /devops/it/src/it/todo/frontend/config/uat.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | env: { 3 | NODE_ENV: '"uat"' 4 | }, 5 | defineConstants: { 6 | }, 7 | h5: { 8 | /** 9 | * 如果h5端编译后体积过大,可以使用webpack-bundle-analyzer插件对打包体积进行分析。 10 | * 参考代码如下: 11 | * webpackChain (chain) { 12 | * chain.plugin('analyzer') 13 | * .use(require('webpack-bundle-analyzer').BundleAnalyzerPlugin, []) 14 | * } 15 | */ 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /devops/it/src/it/todo/frontend/expected/Deployment.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: apps/v1 2 | kind: Deployment 3 | metadata: 4 | annotations: 5 | dew.idealworld.group/git-commit: "@ignore@" 6 | dew.idealworld.group/scm-url: "@ignore@" 7 | labels: 8 | app: todo-frontend 9 | provider: dew 10 | version: "@ignore@" 11 | group: group.idealworld.dew.devops.it 12 | name: todo-frontend 13 | namespace: dew-prod 14 | spec: 15 | replicas: 1 16 | revisionHistoryLimit: 3 17 | selector: 18 | matchLabels: 19 | app: todo-frontend 20 | group: group.idealworld.dew.devops.it 21 | template: 22 | metadata: 23 | annotations: 24 | dew.idealworld.group/git-commit: "@ignore@" 25 | dew.idealworld.group/scm-url: "@ignore@" 26 | labels: 27 | app: todo-frontend 28 | provider: dew 29 | version: "@ignore@" 30 | group: group.idealworld.dew.devops.it 31 | spec: 32 | containers: 33 | - image: "@ignore@" 34 | imagePullPolicy: IfNotPresent 35 | name: dew-app 36 | ports: 37 | - containerPort: 80 38 | name: http 39 | protocol: TCP 40 | resources: 41 | limits: {} 42 | requests: {} 43 | nodeSelector: 44 | group: app 45 | -------------------------------------------------------------------------------- /devops/it/src/it/todo/frontend/expected/Service.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: Service 3 | metadata: 4 | annotations: 5 | dew.idealworld.group/git-commit: "@ignore@" 6 | dew.idealworld.group/scm-url: "@ignore@" 7 | labels: 8 | app: todo-frontend 9 | provider: dew 10 | version: "@ignore@" 11 | expose: 'true' 12 | group: group.idealworld.dew.devops.it 13 | name: todo-frontend 14 | namespace: dew-prod 15 | spec: 16 | ports: 17 | - name: http 18 | port: 80 19 | protocol: TCP 20 | targetPort: 80 21 | selector: 22 | app: todo-frontend 23 | group: group.idealworld.dew.devops.it 24 | -------------------------------------------------------------------------------- /devops/it/src/it/todo/frontend/global.d.ts: -------------------------------------------------------------------------------- 1 | declare module "*.png"; 2 | declare module "*.gif"; 3 | declare module "*.jpg"; 4 | declare module "*.jpeg"; 5 | declare module "*.svg"; 6 | declare module "*.css"; 7 | declare module "*.less"; 8 | declare module "*.scss"; 9 | declare module "*.sass"; 10 | declare module "*.styl"; 11 | 12 | // @ts-ignore 13 | declare const process: { 14 | env: { 15 | TARO_ENV: 'weapp' | 'swan' | 'alipay' | 'h5' | 'rn' | 'tt' | 'quickapp' | 'qq'; 16 | [key: string]: any; 17 | } 18 | } 19 | 20 | -------------------------------------------------------------------------------- /devops/it/src/it/todo/frontend/project.config.json: -------------------------------------------------------------------------------- 1 | { 2 | "miniprogramRoot": "./dist", 3 | "projectname": "todo", 4 | "description": "todo", 5 | "appid": "touristappid", 6 | "setting": { 7 | "urlCheck": true, 8 | "es6": false, 9 | "postcss": false, 10 | "minified": false 11 | }, 12 | "compileType": "miniprogram" 13 | } 14 | -------------------------------------------------------------------------------- /devops/it/src/it/todo/frontend/src/app.scss: -------------------------------------------------------------------------------- 1 | @import "~taro-ui/dist/style/index.scss"; 2 | 3 | .page { 4 | display: flex; 5 | flex-direction: column; 6 | box-sizing: border-box; 7 | min-height: 100vh; 8 | } 9 | 10 | view { 11 | box-sizing: border-box; 12 | } 13 | 14 | .dew-body { 15 | padding-bottom: 60px; 16 | 17 | .panel { 18 | margin: 80px 0 56px; 19 | 20 | &:first-child { 21 | margin-top: 40px; 22 | } 23 | 24 | &__title { 25 | position: relative; 26 | margin-bottom: 40px; 27 | padding-left: 60px; 28 | color: #7F7F7F; 29 | font-size: 32px; 30 | font-weight: bold; 31 | line-height: 1.5; 32 | } 33 | 34 | &__content { 35 | padding: 0 60px; 36 | 37 | &.no-padding { 38 | padding: 0; 39 | 40 | .example-item__desc { 41 | padding: 0 60px; 42 | } 43 | } 44 | } 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /devops/it/src/it/todo/frontend/src/app.tsx: -------------------------------------------------------------------------------- 1 | import Taro, { Component, Config } from '@tarojs/taro' 2 | import '@tarojs/async-await' 3 | import './app.scss' 4 | 5 | // 如果需要在 h5 环境中开启 React Devtools 6 | // 取消以下注释: 7 | // if (process.env.NODE_ENV !== 'production' && process.env.TARO_ENV === 'h5') { 8 | // require('nerv-devtools') 9 | // } 10 | 11 | class App extends Component { 12 | 13 | componentDidMount () {} 14 | 15 | componentDidShow () {} 16 | 17 | componentDidHide () {} 18 | 19 | componentDidCatchError () {} 20 | 21 | /** 22 | * 指定config的类型声明为: Taro.Config 23 | * 24 | * 由于 typescript 对于 object 类型推导只能推出 Key 的基本类型 25 | * 对于像 navigationBarTextStyle: 'black' 这样的推导出的类型是 string 26 | * 提示和声明 navigationBarTextStyle: 'black' | 'white' 类型冲突, 需要显示声明类型 27 | */ 28 | config: Config = { 29 | pages: [ 30 | 'pages/todo/todo' 31 | ], 32 | window: { 33 | backgroundTextStyle: 'light', 34 | navigationBarBackgroundColor: '#fff', 35 | navigationBarTitleText: 'WeChat', 36 | navigationBarTextStyle: 'black' 37 | } 38 | } 39 | 40 | // 在 App 类中的 render() 函数没有实际作用 41 | // 请勿修改此函数 42 | render () { 43 | return ( 44 | 45 | ) 46 | } 47 | } 48 | 49 | Taro.render(, document.getElementById('app')) 50 | -------------------------------------------------------------------------------- /devops/it/src/it/todo/frontend/src/components/dew-header/dew-header.scss: -------------------------------------------------------------------------------- 1 | .dew-header { 2 | position: relative; 3 | padding: 100px 60px 30px; 4 | 5 | &::after { 6 | content: ''; 7 | display: block; 8 | position: absolute; 9 | top: 60px; 10 | right: 60px; 11 | width: 60px; 12 | height: 10px; 13 | border-radius: 5px; 14 | background: #5454ea; 15 | box-shadow: 2px 2px 4px 0 rgba($color: #5454ea, $alpha: 0.5); 16 | } 17 | 18 | &__title { 19 | color: #040404; 20 | font-size: 42px; 21 | font-weight: bold; 22 | line-height: 1.5; 23 | } 24 | 25 | &__desc { 26 | margin-top: 12px; 27 | color: #A09EAE; 28 | font-size: 30px; 29 | line-height: 1.5; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /devops/it/src/it/todo/frontend/src/components/dew-header/dew-header.tsx: -------------------------------------------------------------------------------- 1 | import Taro, {Component} from '@tarojs/taro' 2 | import {View} from '@tarojs/components' 3 | import './dew-header.scss' 4 | 5 | export class DewHeader extends Component { 6 | 7 | render() { 8 | return ( 9 | 10 | {this.props.title} 11 | {this.props.desc} 12 | 13 | ) 14 | } 15 | } 16 | 17 | -------------------------------------------------------------------------------- /devops/it/src/it/todo/frontend/src/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 16 | 17 | 18 | 19 |

20 | 21 | 22 | -------------------------------------------------------------------------------- /devops/it/src/it/todo/frontend/src/pages/todo/todo.scss: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /devops/it/src/it/todo/frontend/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "es2017", 4 | "module": "commonjs", 5 | "removeComments": false, 6 | "preserveConstEnums": true, 7 | "moduleResolution": "node", 8 | "experimentalDecorators": true, 9 | "noImplicitAny": false, 10 | "allowSyntheticDefaultImports": true, 11 | "outDir": "lib", 12 | "noUnusedLocals": true, 13 | "noUnusedParameters": true, 14 | "strictNullChecks": true, 15 | "sourceMap": true, 16 | "baseUrl": ".", 17 | "rootDir": ".", 18 | "jsx": "preserve", 19 | "jsxFactory": "Taro.createElement", 20 | "allowJs": true, 21 | "resolveJsonModule": true, 22 | "typeRoots": [ 23 | "node_modules/@types", 24 | "global.d.ts" 25 | ] 26 | }, 27 | "exclude": [ 28 | "node_modules", 29 | "dist" 30 | ], 31 | "compileOnSave": false 32 | } 33 | -------------------------------------------------------------------------------- /devops/it/src/it/todo/invoker.properties: -------------------------------------------------------------------------------- 1 | invoker.goals.1=-P devops deploy -Ddew_devops_profile=uat 2 | invoker.goals.2=-P devops deploy -Ddew_devops_profile=prod 3 | invoker.mavenOpts=-Djdk.tls.client.protocols=TLSv1.2 -Dmaven.wagon.http.ssl.insecure=true -Dmaven.wagon.http.ssl.allowall=true -Dmaven.wagon.http.ssl.ignore.validity.dates=true 4 | invoker.debug=false 5 | -------------------------------------------------------------------------------- /devops/it/src/it/todo/verify.groovy: -------------------------------------------------------------------------------- 1 | import group.idealworld.dew.devops.it.verify.TodoVerify 2 | 3 | new TodoVerify().verify(basedir) 4 | -------------------------------------------------------------------------------- /devops/maven/dew-maven-agent/readme.adoc: -------------------------------------------------------------------------------- 1 | [[dew-devops-maven-agent]] 2 | ==== Dew DevOps Maven Agent 3 | 4 | 本插件为Dew微服务体系的组成部分,集成说明参见: <> 5 | 6 | Dew会动态判定应用(子模块)是否需要部署,但Maven无法在启动后动态处理应用是否跳过, 7 | Dew的maven插件为此做了一定要处理,但这一做法只是跳过了执行插件,并没有彻底跳过应用,详见 <> 。 8 | 9 | 本插件使用 ``javaagent`` 可实现彻底的跳过不需要部署的应用。 10 | 11 | [source,text] 12 | .使用 13 | ---- 14 | SET MAVEN_OPTS=-javaagent:<本插件的jar> 15 | mvn -P devops deploy <其它命令> 16 | ---- 17 | -------------------------------------------------------------------------------- /devops/maven/dew-maven-agent/src/main/java/group/idealworld/dew/devops/agent/SkipCheck.java: -------------------------------------------------------------------------------- 1 | package group.idealworld.dew.devops.agent; 2 | 3 | import java.io.File; 4 | 5 | /** 6 | * Skip check. 7 | * 8 | * @author gudaoxuri 9 | */ 10 | public class SkipCheck { 11 | 12 | /** 13 | * Check skip. 14 | * 15 | * @param basedDir the based dir 16 | * @return the result 17 | */ 18 | public static boolean skip(File basedDir) { 19 | return new File(basedDir.getPath() + File.separator + "target" + File.separator + ".dew_skip_flag").exists(); 20 | } 21 | 22 | } 23 | -------------------------------------------------------------------------------- /devops/maven/dew-maven-agent/src/main/resources/3.0.5/org/apache/maven/lifecycle/internal/LifecycleStarter.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gudaoxuri/dew/23be7cb9e3a7b70124152a1e63219f67e5a9b48c/devops/maven/dew-maven-agent/src/main/resources/3.0.5/org/apache/maven/lifecycle/internal/LifecycleStarter.class -------------------------------------------------------------------------------- /devops/maven/dew-maven-agent/src/main/resources/3.0.5/org/apache/maven/lifecycle/internal/MojoExecutor.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gudaoxuri/dew/23be7cb9e3a7b70124152a1e63219f67e5a9b48c/devops/maven/dew-maven-agent/src/main/resources/3.0.5/org/apache/maven/lifecycle/internal/MojoExecutor.class -------------------------------------------------------------------------------- /devops/maven/dew-maven-agent/src/main/resources/3.2.5/org/apache/maven/lifecycle/internal/MojoExecutor.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gudaoxuri/dew/23be7cb9e3a7b70124152a1e63219f67e5a9b48c/devops/maven/dew-maven-agent/src/main/resources/3.2.5/org/apache/maven/lifecycle/internal/MojoExecutor.class -------------------------------------------------------------------------------- /devops/maven/dew-maven-agent/src/main/resources/3.2.5/org/apache/maven/lifecycle/internal/builder/singlethreaded/SingleThreadedBuilder.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gudaoxuri/dew/23be7cb9e3a7b70124152a1e63219f67e5a9b48c/devops/maven/dew-maven-agent/src/main/resources/3.2.5/org/apache/maven/lifecycle/internal/builder/singlethreaded/SingleThreadedBuilder.class -------------------------------------------------------------------------------- /devops/maven/dew-maven-agent/src/main/resources/3.3.3/org/apache/maven/lifecycle/internal/MojoExecutor.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gudaoxuri/dew/23be7cb9e3a7b70124152a1e63219f67e5a9b48c/devops/maven/dew-maven-agent/src/main/resources/3.3.3/org/apache/maven/lifecycle/internal/MojoExecutor.class -------------------------------------------------------------------------------- /devops/maven/dew-maven-agent/src/main/resources/3.3.3/org/apache/maven/lifecycle/internal/builder/singlethreaded/SingleThreadedBuilder.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gudaoxuri/dew/23be7cb9e3a7b70124152a1e63219f67e5a9b48c/devops/maven/dew-maven-agent/src/main/resources/3.3.3/org/apache/maven/lifecycle/internal/builder/singlethreaded/SingleThreadedBuilder.class -------------------------------------------------------------------------------- /devops/maven/dew-maven-agent/src/main/resources/3.3.9/org/apache/maven/lifecycle/internal/MojoExecutor.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gudaoxuri/dew/23be7cb9e3a7b70124152a1e63219f67e5a9b48c/devops/maven/dew-maven-agent/src/main/resources/3.3.9/org/apache/maven/lifecycle/internal/MojoExecutor.class -------------------------------------------------------------------------------- /devops/maven/dew-maven-agent/src/main/resources/3.3.9/org/apache/maven/lifecycle/internal/builder/singlethreaded/SingleThreadedBuilder.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gudaoxuri/dew/23be7cb9e3a7b70124152a1e63219f67e5a9b48c/devops/maven/dew-maven-agent/src/main/resources/3.3.9/org/apache/maven/lifecycle/internal/builder/singlethreaded/SingleThreadedBuilder.class -------------------------------------------------------------------------------- /devops/maven/dew-maven-agent/src/main/resources/3.5.2/org/apache/maven/lifecycle/internal/MojoExecutor.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gudaoxuri/dew/23be7cb9e3a7b70124152a1e63219f67e5a9b48c/devops/maven/dew-maven-agent/src/main/resources/3.5.2/org/apache/maven/lifecycle/internal/MojoExecutor.class -------------------------------------------------------------------------------- /devops/maven/dew-maven-agent/src/main/resources/3.5.2/org/apache/maven/lifecycle/internal/builder/singlethreaded/SingleThreadedBuilder.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gudaoxuri/dew/23be7cb9e3a7b70124152a1e63219f67e5a9b48c/devops/maven/dew-maven-agent/src/main/resources/3.5.2/org/apache/maven/lifecycle/internal/builder/singlethreaded/SingleThreadedBuilder.class -------------------------------------------------------------------------------- /devops/maven/dew-maven-agent/src/main/resources/3.6.0/org/apache/maven/lifecycle/internal/MojoExecutor.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gudaoxuri/dew/23be7cb9e3a7b70124152a1e63219f67e5a9b48c/devops/maven/dew-maven-agent/src/main/resources/3.6.0/org/apache/maven/lifecycle/internal/MojoExecutor.class -------------------------------------------------------------------------------- /devops/maven/dew-maven-agent/src/main/resources/3.6.0/org/apache/maven/lifecycle/internal/builder/singlethreaded/SingleThreadedBuilder.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gudaoxuri/dew/23be7cb9e3a7b70124152a1e63219f67e5a9b48c/devops/maven/dew-maven-agent/src/main/resources/3.6.0/org/apache/maven/lifecycle/internal/builder/singlethreaded/SingleThreadedBuilder.class -------------------------------------------------------------------------------- /devops/maven/dew-maven-agent/src/main/resources/3.6.1/org/apache/maven/lifecycle/internal/MojoExecutor.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gudaoxuri/dew/23be7cb9e3a7b70124152a1e63219f67e5a9b48c/devops/maven/dew-maven-agent/src/main/resources/3.6.1/org/apache/maven/lifecycle/internal/MojoExecutor.class -------------------------------------------------------------------------------- /devops/maven/dew-maven-agent/src/main/resources/3.6.1/org/apache/maven/lifecycle/internal/builder/singlethreaded/SingleThreadedBuilder.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gudaoxuri/dew/23be7cb9e3a7b70124152a1e63219f67e5a9b48c/devops/maven/dew-maven-agent/src/main/resources/3.6.1/org/apache/maven/lifecycle/internal/builder/singlethreaded/SingleThreadedBuilder.class -------------------------------------------------------------------------------- /devops/maven/dew-maven-agent/src/test/3.0.5/java/group/idealworld/dew/devops/agent/BuildTest.java: -------------------------------------------------------------------------------- 1 | package group.idealworld.dew.devops.agent; 2 | 3 | import org.junit.Test; 4 | 5 | /** 6 | * The type Build test. 7 | * 8 | * @author gudaoxuri 9 | */ 10 | public class BuildTest { 11 | 12 | /** 13 | * Test. 14 | */ 15 | @Test 16 | public void test() { 17 | 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /devops/maven/dew-maven-agent/src/test/3.2.5/java/group/idealworld/dew/devops/agent/BuildTest.java: -------------------------------------------------------------------------------- 1 | package group.idealworld.dew.devops.agent; 2 | 3 | import org.junit.Test; 4 | 5 | /** 6 | * The type Build test. 7 | * 8 | * @author gudaoxuri 9 | */ 10 | public class BuildTest { 11 | 12 | /** 13 | * Test. 14 | */ 15 | @Test 16 | public void test() { 17 | 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /devops/maven/dew-maven-agent/src/test/3.3.3/java/group/idealworld/dew/devops/agent/BuildTest.java: -------------------------------------------------------------------------------- 1 | package group.idealworld.dew.devops.agent; 2 | 3 | import org.junit.Test; 4 | 5 | /** 6 | * The type Build test. 7 | * 8 | * @author gudaoxuri 9 | */ 10 | public class BuildTest { 11 | 12 | /** 13 | * Test. 14 | */ 15 | @Test 16 | public void test() { 17 | 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /devops/maven/dew-maven-agent/src/test/3.3.9/java/group/idealworld/dew/devops/agent/BuildTest.java: -------------------------------------------------------------------------------- 1 | package group.idealworld.dew.devops.agent; 2 | 3 | import org.junit.Test; 4 | 5 | /** 6 | * The type Build test. 7 | * 8 | * @author gudaoxuri 9 | */ 10 | public class BuildTest { 11 | 12 | /** 13 | * Test. 14 | */ 15 | @Test 16 | public void test() { 17 | 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /devops/maven/dew-maven-agent/src/test/3.5.2/java/group/idealworld/dew/devops/agent/BuildTest.java: -------------------------------------------------------------------------------- 1 | package group.idealworld.dew.devops.agent; 2 | 3 | import org.junit.Test; 4 | 5 | /** 6 | * The type Build test. 7 | * 8 | * @author gudaoxuri 9 | */ 10 | public class BuildTest { 11 | 12 | /** 13 | * Test. 14 | */ 15 | @Test 16 | public void test() { 17 | 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /devops/maven/dew-maven-agent/src/test/3.6.0/java/group/idealworld/dew/devops/agent/BuildTest.java: -------------------------------------------------------------------------------- 1 | package group.idealworld.dew.devops.agent; 2 | 3 | import org.junit.Test; 4 | 5 | /** 6 | * The type Build test. 7 | * 8 | * @author gudaoxuri 9 | */ 10 | public class BuildTest { 11 | 12 | /** 13 | * Test. 14 | */ 15 | @Test 16 | public void test() { 17 | 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /devops/maven/dew-maven-agent/src/test/3.6.1/java/group/idealworld/dew/devops/agent/BuildTest.java: -------------------------------------------------------------------------------- 1 | package group.idealworld.dew.devops.agent; 2 | 3 | import org.junit.Test; 4 | 5 | /** 6 | * The type Build test. 7 | * 8 | * @author gudaoxuri 9 | */ 10 | public class BuildTest { 11 | 12 | /** 13 | * Test. 14 | */ 15 | @Test 16 | public void test() { 17 | 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /devops/maven/dew-maven-plugin/readme.adoc: -------------------------------------------------------------------------------- 1 | ==== Dew DevOps Maven Plugin 2 | 3 | 本插件为Dew微服务体系的组成部分,集成说明参见: <> 4 | 5 | [NOTE] 6 | .环境要求 7 | ==== 8 | . 需要准备好可用的Docker和Kubernetes(1.16.x 及以上版本)环境 9 | . 如果Docker不在本地则需要启用 ``Docker Host``,详见 https://docs.docker.com/install/linux/linux-postinstall/#configure-where-the-docker-daemon-listens-for-connections 10 | . 如果Kubernetes不在本地则需要获取到Base64编码后的配置信息, e.g. ``KUBE_CONFIG=`echo $(cat ~/.kube/config | base64) | tr -d " "``` 11 | ==== 12 | 13 | [source,bash] 14 | .使用 15 | ---- 16 | ---- 17 | -------------------------------------------------------------------------------- /devops/maven/dew-maven-plugin/src/main/java/group/idealworld/dew/devops/kernel/config/DewConfig.java: -------------------------------------------------------------------------------- 1 | package group.idealworld.dew.devops.kernel.config; 2 | 3 | import java.util.HashMap; 4 | import java.util.Map; 5 | 6 | /** 7 | * Dew config. 8 | *

9 | * Dew的配置,对应于 .dew 文件 10 | * 11 | * @author gudaoxuri 12 | */ 13 | public class DewConfig extends DewProfile { 14 | 15 | private Map profiles = new HashMap<>(); 16 | 17 | /** 18 | * Gets profiles. 19 | * 20 | * @return the profiles 21 | */ 22 | public Map getProfiles() { 23 | return profiles; 24 | } 25 | 26 | /** 27 | * Sets profiles. 28 | * 29 | * @param profiles the profiles 30 | */ 31 | public void setProfiles(Map profiles) { 32 | this.profiles = profiles; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /devops/maven/dew-maven-plugin/src/main/java/group/idealworld/dew/devops/kernel/config/DewKube.java: -------------------------------------------------------------------------------- 1 | package group.idealworld.dew.devops.kernel.config; 2 | 3 | /** 4 | * Dew kubernetes. 5 | * 6 | * @author gudaoxuri 7 | */ 8 | public class DewKube { 9 | 10 | // Kubernetes Base64 后的配置,使用 ``echo $(cat ~/.kube/config | base64) | tr -d " "`` 11 | // 获取 12 | private String base64Config = ""; 13 | 14 | /** 15 | * Gets base 64 config. 16 | * 17 | * @return the base 64 config 18 | */ 19 | public String getBase64Config() { 20 | return base64Config; 21 | } 22 | 23 | /** 24 | * Sets base 64 config. 25 | * 26 | * @param base64Config the base 64 config 27 | */ 28 | public void setBase64Config(String base64Config) { 29 | this.base64Config = base64Config; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /devops/maven/dew-maven-plugin/src/main/java/group/idealworld/dew/devops/kernel/config/FinalConfig.java: -------------------------------------------------------------------------------- 1 | package group.idealworld.dew.devops.kernel.config; 2 | 3 | import java.util.LinkedHashMap; 4 | import java.util.Map; 5 | 6 | /** 7 | * Final config. 8 | *

9 | * 最终生成的配置 10 | * 11 | * @author gudaoxuri 12 | */ 13 | public class FinalConfig { 14 | 15 | private Map projects = new LinkedHashMap<>(); 16 | 17 | /** 18 | * Gets projects. 19 | * 20 | * @return the projects 21 | */ 22 | public Map getProjects() { 23 | return projects; 24 | } 25 | 26 | } 27 | -------------------------------------------------------------------------------- /devops/maven/dew-maven-plugin/src/main/java/group/idealworld/dew/devops/kernel/exception/ConfigException.java: -------------------------------------------------------------------------------- 1 | package group.idealworld.dew.devops.kernel.exception; 2 | 3 | /** 4 | * Config exception. 5 | * 6 | * @author gudaoxuri 7 | */ 8 | public class ConfigException extends RuntimeException { 9 | 10 | /** 11 | * Instantiates a new Config exception. 12 | * 13 | * @param message the message 14 | */ 15 | public ConfigException(String message) { 16 | super(message); 17 | } 18 | 19 | /** 20 | * Instantiates a new Config exception. 21 | * 22 | * @param message the message 23 | * @param cause the cause 24 | */ 25 | public ConfigException(String message, Throwable cause) { 26 | super(message, cause); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /devops/maven/dew-maven-plugin/src/main/java/group/idealworld/dew/devops/kernel/exception/GitDiffException.java: -------------------------------------------------------------------------------- 1 | package group.idealworld.dew.devops.kernel.exception; 2 | 3 | /** 4 | * Git diff exception. 5 | * 6 | * @author gudaoxuri 7 | */ 8 | public class GitDiffException extends RuntimeException { 9 | 10 | /** 11 | * Instantiates a new git diff exception. 12 | * 13 | * @param message the message 14 | */ 15 | public GitDiffException(String message) { 16 | super(message); 17 | } 18 | 19 | /** 20 | * Instantiates a new git diff exception. 21 | * 22 | * @param message the message 23 | * @param cause the cause 24 | */ 25 | public GitDiffException(String message, Throwable cause) { 26 | super(message, cause); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /devops/maven/dew-maven-plugin/src/main/java/group/idealworld/dew/devops/kernel/exception/GlobalProcessException.java: -------------------------------------------------------------------------------- 1 | package group.idealworld.dew.devops.kernel.exception; 2 | 3 | /** 4 | * Global process exception. 5 | * 6 | * @author gudaoxuri 7 | */ 8 | public class GlobalProcessException extends RuntimeException { 9 | 10 | /** 11 | * Instantiates a new Process exception. 12 | * 13 | * @param message the message 14 | */ 15 | public GlobalProcessException(String message) { 16 | super(message); 17 | } 18 | 19 | /** 20 | * Instantiates a new Process exception. 21 | * 22 | * @param message the message 23 | * @param cause the cause 24 | */ 25 | public GlobalProcessException(String message, Throwable cause) { 26 | super(message, cause); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /devops/maven/dew-maven-plugin/src/main/java/group/idealworld/dew/devops/kernel/exception/ProjectProcessException.java: -------------------------------------------------------------------------------- 1 | package group.idealworld.dew.devops.kernel.exception; 2 | 3 | /** 4 | * Project process exception. 5 | * 6 | * @author gudaoxuri 7 | */ 8 | public class ProjectProcessException extends RuntimeException { 9 | 10 | /** 11 | * Instantiates a new Process exception. 12 | * 13 | * @param message the message 14 | */ 15 | public ProjectProcessException(String message) { 16 | super(message); 17 | } 18 | 19 | /** 20 | * Instantiates a new Process exception. 21 | * 22 | * @param message the message 23 | * @param cause the cause 24 | */ 25 | public ProjectProcessException(String message, Throwable cause) { 26 | super(message, cause); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /devops/maven/dew-maven-plugin/src/main/java/group/idealworld/dew/devops/kernel/flow/NoNeedProcessFLow.java: -------------------------------------------------------------------------------- 1 | package group.idealworld.dew.devops.kernel.flow; 2 | 3 | import group.idealworld.dew.devops.kernel.config.FinalProjectConfig; 4 | import io.kubernetes.client.openapi.ApiException; 5 | 6 | import java.io.IOException; 7 | 8 | /** 9 | * 不需要执行的缺省流程定义. 10 | * 11 | * @author gudaoxuri 12 | */ 13 | public class NoNeedProcessFLow extends BasicFlow { 14 | @Override 15 | protected void process(FinalProjectConfig config, String flowBasePath) throws ApiException, IOException { 16 | 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /devops/maven/dew-maven-plugin/src/main/java/group/idealworld/dew/devops/kernel/flow/unrelease/DefaultUnReleaseFlow.java: -------------------------------------------------------------------------------- 1 | package group.idealworld.dew.devops.kernel.flow.unrelease; 2 | 3 | import group.idealworld.dew.devops.kernel.config.FinalProjectConfig; 4 | import group.idealworld.dew.devops.kernel.flow.BasicFlow; 5 | import group.idealworld.dew.devops.kernel.helper.KubeHelper; 6 | import group.idealworld.dew.devops.kernel.helper.KubeRES; 7 | import io.kubernetes.client.openapi.ApiException; 8 | 9 | import java.io.IOException; 10 | 11 | /** 12 | * Default un-release flow. 13 | * 14 | * @author gudaoxuri 15 | */ 16 | public class DefaultUnReleaseFlow extends BasicFlow { 17 | 18 | protected void process(FinalProjectConfig config, String flowBasePath) throws ApiException, IOException { 19 | // 删除 service 20 | KubeHelper.inst(config.getId()).delete(config.getAppName(), config.getNamespace(), KubeRES.SERVICE); 21 | // 删除 Deployment,ReplicaSet,Pod 22 | KubeHelper.inst(config.getId()).delete(config.getAppName(), config.getNamespace(), KubeRES.DEPLOYMENT); 23 | } 24 | 25 | } 26 | -------------------------------------------------------------------------------- /devops/maven/dew-maven-plugin/src/main/java/group/idealworld/dew/devops/kernel/helper/GitHelper.java: -------------------------------------------------------------------------------- 1 | package group.idealworld.dew.devops.kernel.helper; 2 | 3 | import org.slf4j.Logger; 4 | 5 | /** 6 | * Git辅助类. 7 | *

8 | * 使用多实例支持是为方便替换GitOpt为Mock对象以进行集成测试,详见测试实现 9 | * 10 | * @author gudaoxuri 11 | */ 12 | public class GitHelper extends MultiInstProcessor { 13 | 14 | /** 15 | * Init. 16 | * 17 | * @param log the log 18 | */ 19 | public static void init(Logger log) { 20 | multiInit("GIT", "", 21 | () -> new GitOpt(log), ""); 22 | } 23 | 24 | /** 25 | * Fetch GitOpt instance. 26 | * 27 | * @return GitOpt instance 28 | */ 29 | public static GitOpt inst() { 30 | return multiInst("GIT", ""); 31 | } 32 | 33 | } 34 | -------------------------------------------------------------------------------- /devops/maven/dew-maven-plugin/src/main/java/group/idealworld/dew/devops/kernel/helper/KubeBasicMetadataMeta.java: -------------------------------------------------------------------------------- 1 | package group.idealworld.dew.devops.kernel.helper; 2 | 3 | /** 4 | * Kubernetes basic metadata meta. 5 | *

6 | * 用于提取各资源公共字段 7 | * 8 | * @author gudaoxuri 9 | */ 10 | public class KubeBasicMetadataMeta { 11 | private String name = null; 12 | private String namespace = null; 13 | 14 | /** 15 | * Gets name. 16 | * 17 | * @return the name 18 | */ 19 | public String getName() { 20 | return name; 21 | } 22 | 23 | /** 24 | * Sets name. 25 | * 26 | * @param name the name 27 | */ 28 | public void setName(String name) { 29 | this.name = name; 30 | } 31 | 32 | /** 33 | * Gets namespace. 34 | * 35 | * @return the namespace 36 | */ 37 | public String getNamespace() { 38 | return namespace; 39 | } 40 | 41 | /** 42 | * Sets namespace. 43 | * 44 | * @param namespace the namespace 45 | */ 46 | public void setNamespace(String namespace) { 47 | this.namespace = namespace; 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /devops/maven/dew-maven-plugin/src/main/java/group/idealworld/dew/devops/kernel/helper/KubeHelper.java: -------------------------------------------------------------------------------- 1 | package group.idealworld.dew.devops.kernel.helper; 2 | 3 | import org.slf4j.Logger; 4 | 5 | /** 6 | * Kubernetes操作函数类. 7 | * 8 | * @author gudaoxuri 9 | * @see Kubernetes 10 | * Client 11 | */ 12 | public class KubeHelper extends MultiInstProcessor { 13 | 14 | /** 15 | * Init. 16 | * 17 | * @param instanceId the instance id 18 | * @param log the log 19 | * @param base64KubeConfig the base 64 kube config 20 | */ 21 | public static void init(String instanceId, Logger log, String base64KubeConfig) { 22 | multiInit("KUBE", instanceId, 23 | () -> new KubeOpt(log, base64KubeConfig), base64KubeConfig); 24 | } 25 | 26 | /** 27 | * Fetch KubeOpt instance. 28 | * 29 | * @param instanceId the instance id 30 | * @return KubeOpt instance 31 | */ 32 | public static KubeOpt inst(String instanceId) { 33 | return multiInst("KUBE", instanceId); 34 | } 35 | 36 | } 37 | -------------------------------------------------------------------------------- /devops/maven/dew-maven-plugin/src/main/java/group/idealworld/dew/devops/kernel/helper/KubeWatchCall.java: -------------------------------------------------------------------------------- 1 | package group.idealworld.dew.devops.kernel.helper; 2 | 3 | import io.kubernetes.client.openapi.ApiException; 4 | import io.kubernetes.client.openapi.apis.*; 5 | import okhttp3.Call; 6 | 7 | /** 8 | * Kubernetes watch 回调. 9 | * 10 | * @author gudaoxuri 11 | */ 12 | @FunctionalInterface 13 | public interface KubeWatchCall { 14 | 15 | /** 16 | * Call. 17 | * 18 | * @param coreApi the core api 19 | * @param appsApi the apps api 20 | * @param networkingV1Api the networking api 21 | * @param rbacAuthorizationApi the rbac authorization api 22 | * @param autoscalingApi the autoscaling api 23 | * @return the call 24 | * @throws ApiException the api exception 25 | */ 26 | Call call(CoreV1Api coreApi, AppsV1Api appsApi, NetworkingV1Api networkingV1Api, 27 | RbacAuthorizationV1Api rbacAuthorizationApi, AutoscalingV2beta2Api autoscalingApi) throws ApiException; 28 | 29 | } 30 | -------------------------------------------------------------------------------- /devops/maven/dew-maven-plugin/src/main/java/group/idealworld/dew/devops/kernel/resource/KubeResourceBuilder.java: -------------------------------------------------------------------------------- 1 | package group.idealworld.dew.devops.kernel.resource; 2 | 3 | import group.idealworld.dew.devops.kernel.config.FinalProjectConfig; 4 | 5 | /** 6 | * The interface Kubernetes resource builder. 7 | * 8 | * @param the type parameter 9 | * @author gudaoxuri 10 | */ 11 | public interface KubeResourceBuilder { 12 | 13 | /** 14 | * Build. 15 | * 16 | * @param config the project config 17 | * @return the result 18 | */ 19 | T build(FinalProjectConfig config); 20 | 21 | } 22 | -------------------------------------------------------------------------------- /devops/maven/dew-maven-plugin/src/main/java/group/idealworld/dew/devops/kernel/util/ExecuteOnceProcessor.java: -------------------------------------------------------------------------------- 1 | package group.idealworld.dew.devops.kernel.util; 2 | 3 | import java.util.Map; 4 | import java.util.concurrent.ConcurrentHashMap; 5 | import java.util.concurrent.atomic.AtomicBoolean; 6 | 7 | /** 8 | * 只执行一次的处理器. 9 | * 10 | * @author gudaoxuri 11 | */ 12 | public class ExecuteOnceProcessor { 13 | 14 | private static final Map initialized = new ConcurrentHashMap<>(); 15 | 16 | public static synchronized boolean executedCheck(Class clazz) { 17 | initialized.putIfAbsent(clazz.getName(), new AtomicBoolean()); 18 | return initialized.get(clazz.getName()).getAndSet(true); 19 | } 20 | 21 | } 22 | -------------------------------------------------------------------------------- /devops/maven/dew-maven-plugin/src/main/java/group/idealworld/dew/devops/kernel/util/ExitMonitorProcessor.java: -------------------------------------------------------------------------------- 1 | package group.idealworld.dew.devops.kernel.util; 2 | 3 | import java.security.Permission; 4 | import java.util.function.Consumer; 5 | 6 | /** 7 | * The type Exit monitor processor. 8 | * 9 | * @author gudaoxuri 10 | */ 11 | public class ExitMonitorProcessor { 12 | 13 | private static Integer EXIT_STATUS = 0; 14 | 15 | /** 16 | * Hook. 17 | * 18 | * @param procFun the proc fun 19 | */ 20 | public static void hook(Consumer procFun) { 21 | System.setSecurityManager(new ExitMonitorSecurityManager()); 22 | Runtime.getRuntime().addShutdownHook(new Thread(() -> { 23 | procFun.accept(EXIT_STATUS); 24 | })); 25 | } 26 | 27 | private static class ExitMonitorSecurityManager extends SecurityManager { 28 | 29 | @Override 30 | public void checkPermission(Permission perm) { 31 | } 32 | 33 | @Override 34 | public void checkPermission(Permission perm, Object context) { 35 | } 36 | 37 | @Override 38 | public void checkExit(int status) { 39 | EXIT_STATUS = status; 40 | super.checkExit(status); 41 | } 42 | 43 | } 44 | 45 | } 46 | -------------------------------------------------------------------------------- /devops/maven/dew-maven-plugin/src/main/java/group/idealworld/dew/devops/maven/mojo/DebugMojo.java: -------------------------------------------------------------------------------- 1 | package group.idealworld.dew.devops.maven.mojo; 2 | 3 | import group.idealworld.dew.devops.kernel.DevOps; 4 | import io.kubernetes.client.openapi.ApiException; 5 | import org.apache.maven.plugins.annotations.Mojo; 6 | 7 | import java.io.IOException; 8 | 9 | /** 10 | * Debug mojo. 11 | * 12 | * @author gudaoxuri 13 | */ 14 | @Mojo(name = "debug") 15 | public class DebugMojo extends BasicMojo { 16 | 17 | @Override 18 | protected boolean executeInternal() throws IOException, ApiException { 19 | return DevOps.Config.getProjectConfig(mavenProject.getId()).getAppKindPlugin() 20 | .debugFlow(podName, forwardPort).exec(mavenProject.getId(), getMojoName()); 21 | } 22 | 23 | } 24 | -------------------------------------------------------------------------------- /devops/maven/dew-maven-plugin/src/main/java/group/idealworld/dew/devops/maven/mojo/InitMojo.java: -------------------------------------------------------------------------------- 1 | package group.idealworld.dew.devops.maven.mojo; 2 | 3 | import org.apache.maven.plugins.annotations.Mojo; 4 | import org.apache.maven.plugins.annotations.ResolutionScope; 5 | 6 | import static org.apache.maven.plugins.annotations.LifecyclePhase.VALIDATE; 7 | 8 | /** 9 | * Init mojo. 10 | *

11 | * NOTE: 此mojo不能单独调用,仅与 release 配合使用 12 | *

13 | * 默认绑定到 validate phase, 14 | * 是为抢先初始化配置及执行 skip 操作(避免不必要的compile/jar/install/deploy等) 15 | * 16 | * @author gudaoxuri 17 | */ 18 | @Mojo(name = "init", defaultPhase = VALIDATE, requiresDependencyResolution = ResolutionScope.COMPILE) 19 | public class InitMojo extends BasicMojo { 20 | 21 | @Override 22 | protected boolean executeInternal() { 23 | return true; 24 | } 25 | 26 | } 27 | -------------------------------------------------------------------------------- /devops/maven/dew-maven-plugin/src/main/java/group/idealworld/dew/devops/maven/mojo/LogMojo.java: -------------------------------------------------------------------------------- 1 | package group.idealworld.dew.devops.maven.mojo; 2 | 3 | import group.idealworld.dew.devops.kernel.DevOps; 4 | import io.kubernetes.client.openapi.ApiException; 5 | import org.apache.maven.plugins.annotations.Mojo; 6 | 7 | import java.io.IOException; 8 | 9 | /** 10 | * Log view mojo. 11 | * 12 | * @author gudaoxuri 13 | */ 14 | @Mojo(name = "log") 15 | public class LogMojo extends BasicMojo { 16 | 17 | @Override 18 | protected boolean executeInternal() throws IOException, ApiException { 19 | return DevOps.Config.getProjectConfig(mavenProject.getId()).getAppKindPlugin() 20 | .logFlow(podName, follow).exec(mavenProject.getId(), getMojoName()); 21 | } 22 | 23 | } 24 | -------------------------------------------------------------------------------- /devops/maven/dew-maven-plugin/src/main/java/group/idealworld/dew/devops/maven/mojo/RefreshMojo.java: -------------------------------------------------------------------------------- 1 | package group.idealworld.dew.devops.maven.mojo; 2 | 3 | import group.idealworld.dew.devops.kernel.DevOps; 4 | import io.kubernetes.client.openapi.ApiException; 5 | import org.apache.maven.plugins.annotations.Mojo; 6 | 7 | import java.io.IOException; 8 | 9 | /** 10 | * Default refresh flow. 11 | * 12 | * @author Sun 13 | */ 14 | @Mojo(name = "refresh") 15 | public class RefreshMojo extends BasicMojo { 16 | @Override 17 | protected boolean executeInternal() throws IOException, ApiException { 18 | return DevOps.Config.getProjectConfig(mavenProject.getId()).getAppKindPlugin() 19 | .refreshFlow().exec(mavenProject.getId(), getMojoName()); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /devops/maven/dew-maven-plugin/src/main/java/group/idealworld/dew/devops/maven/mojo/RollbackMojo.java: -------------------------------------------------------------------------------- 1 | package group.idealworld.dew.devops.maven.mojo; 2 | 3 | import group.idealworld.dew.devops.kernel.DevOps; 4 | import io.kubernetes.client.openapi.ApiException; 5 | import org.apache.maven.plugins.annotations.Mojo; 6 | 7 | import java.io.IOException; 8 | 9 | /** 10 | * Rollback mojo. 11 | * 12 | * @author gudaoxuri 13 | */ 14 | @Mojo(name = "rollback") 15 | public class RollbackMojo extends BasicMojo { 16 | 17 | @Override 18 | protected boolean executeInternal() throws IOException, ApiException { 19 | return DevOps.Config.getProjectConfig(mavenProject.getId()).getAppKindPlugin() 20 | .rollbackFlow(history, rollbackVersion).exec(mavenProject.getId(), getMojoName()); 21 | } 22 | 23 | } 24 | -------------------------------------------------------------------------------- /devops/maven/dew-maven-plugin/src/main/java/group/idealworld/dew/devops/maven/mojo/ScaleMojo.java: -------------------------------------------------------------------------------- 1 | package group.idealworld.dew.devops.maven.mojo; 2 | 3 | import group.idealworld.dew.devops.kernel.DevOps; 4 | import io.kubernetes.client.openapi.ApiException; 5 | import org.apache.maven.plugins.annotations.Mojo; 6 | 7 | import java.io.IOException; 8 | 9 | /** 10 | * Scale mojo. 11 | * 12 | * @author gudaoxuri 13 | */ 14 | @Mojo(name = "scale") 15 | public class ScaleMojo extends BasicMojo { 16 | 17 | @Override 18 | protected boolean executeInternal() throws IOException, ApiException { 19 | if (!autoScale && replicas == 0) { 20 | logger.error("Parameter error, When autoScale disabled, dew_devops_scale_replicas can't be 0"); 21 | return false; 22 | } 23 | if (autoScale && (minReplicas == 0 || maxReplicas == 0 || minReplicas >= maxReplicas || cpuAvg == 0)) { 24 | logger.error("Parameter error, Current mode is autoScale model"); 25 | return false; 26 | } 27 | return DevOps.Config.getProjectConfig(mavenProject.getId()).getAppKindPlugin() 28 | .scaleFlow(replicas, autoScale, minReplicas, maxReplicas, cpuAvg) 29 | .exec(mavenProject.getId(), getMojoName()); 30 | } 31 | 32 | } 33 | -------------------------------------------------------------------------------- /devops/maven/dew-maven-plugin/src/main/java/group/idealworld/dew/devops/maven/mojo/UnReleaseMojo.java: -------------------------------------------------------------------------------- 1 | package group.idealworld.dew.devops.maven.mojo; 2 | 3 | import group.idealworld.dew.devops.kernel.DevOps; 4 | import io.kubernetes.client.openapi.ApiException; 5 | import org.apache.maven.plugins.annotations.Mojo; 6 | 7 | import java.io.IOException; 8 | 9 | /** 10 | * Un-release mojo. 11 | * 12 | * @author gudaoxuri 13 | */ 14 | @Mojo(name = "unrelease") 15 | public class UnReleaseMojo extends BasicMojo { 16 | 17 | @Override 18 | protected boolean executeInternal() throws IOException, ApiException { 19 | return DevOps.Config.getProjectConfig(mavenProject.getId()).getAppKindPlugin() 20 | .unReleaseFlow().exec(mavenProject.getId(), getMojoName()); 21 | } 22 | 23 | } 24 | -------------------------------------------------------------------------------- /devops/maven/dew-maven-plugin/src/main/resources/dockerfile/frontend/node_native/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM pangm/nginx-node:8.5 2 | 3 | RUN mkdir /dist 4 | 5 | COPY ./dist /dist 6 | COPY ./custom.conf /etc/nginx/conf.d/custom.conf 7 | 8 | RUN echo 'Asia/Shanghai' >/etc/timezone 9 | 10 | RUN yum install git -y 11 | 12 | ARG PORT=80 13 | 14 | EXPOSE $PORT 15 | 16 | ARG startCmd 17 | 18 | ENV startCmd=${startCmd} 19 | 20 | CMD ["sh","-c","cd /dist && rm -rf node_modules/ && npm install && ${startCmd}"] 21 | -------------------------------------------------------------------------------- /devops/maven/dew-maven-plugin/src/main/resources/dockerfile/frontend/node_non_native/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM nginx:alpine 2 | 3 | COPY ./dist /usr/share/nginx/html 4 | COPY ./custom.conf /etc/nginx/conf.d/custom.conf 5 | 6 | RUN echo 'Asia/Shanghai' >/etc/timezone 7 | 8 | ARG PORT=80 9 | 10 | EXPOSE $PORT 11 | -------------------------------------------------------------------------------- /devops/maven/dew-maven-plugin/src/main/resources/dockerfile/jvmservice_springboot/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM openjdk:11-jre-slim as builder 2 | WORKDIR application 3 | COPY ./serv.jar ./ 4 | RUN java -Djarmode=layertools -jar serv.jar extract 5 | 6 | FROM openjdk:11-jre-slim 7 | MAINTAINER dewms 8 | 9 | WORKDIR application 10 | 11 | COPY ./run-java.sh ./ 12 | COPY ./debug-java.sh ./ 13 | COPY ./debug-clear.sh ./ 14 | RUN chmod 777 ./run-java.sh 15 | RUN chmod 777 ./debug-java.sh 16 | RUN chmod 777 ./debug-clear.sh 17 | RUN echo 'Asia/Shanghai' >/etc/timezone 18 | ARG PORT=8080 19 | EXPOSE $PORT 20 | 21 | COPY --from=builder application/dependencies/ ./ 22 | COPY --from=builder application/spring-boot-loader/ ./ 23 | COPY --from=builder application/snapshot-dependencies/ ./ 24 | COPY --from=builder application/application/ ./ 25 | 26 | CMD [ "./run-java.sh" ] 27 | -------------------------------------------------------------------------------- /devops/maven/dew-maven-plugin/src/main/resources/dockerfile/jvmservice_springboot/debug-clear.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | pidof java | awk '{print $1}' | xargs kill 4 | -------------------------------------------------------------------------------- /devops/maven/dew-maven-plugin/src/main/resources/dockerfile/jvmservice_springboot/debug-java.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | export JAVA_ENABLE_DEBUG=true 4 | export JAVA_OPTIONS="${JAVA_DEBUG_OPTIONS}" 5 | 6 | pidof java | awk '{print $1}' | xargs kill 7 | 8 | ./run-java.sh 9 | -------------------------------------------------------------------------------- /devops/maven/dew-maven-plugin/src/test/java/group/idealworld/dew/devops/kernel/helper/TestYamlSub.java: -------------------------------------------------------------------------------- 1 | package group.idealworld.dew.devops.kernel.helper; 2 | 3 | /** 4 | * Test yaml sub. 5 | * 6 | * @author gudaoxuri 7 | */ 8 | public class TestYamlSub { 9 | private String c1; 10 | private String c2; 11 | 12 | /** 13 | * Gets c 1. 14 | * 15 | * @return the c 1 16 | */ 17 | public String getC1() { 18 | return c1; 19 | } 20 | 21 | /** 22 | * Sets c 1. 23 | * 24 | * @param c1 the c 1 25 | */ 26 | public void setC1(String c1) { 27 | this.c1 = c1; 28 | } 29 | 30 | /** 31 | * Gets c 2. 32 | * 33 | * @return the c 2 34 | */ 35 | public String getC2() { 36 | return c2; 37 | } 38 | 39 | /** 40 | * Sets c 2. 41 | * 42 | * @param c2 the c 2 43 | */ 44 | public void setC2(String c2) { 45 | this.c2 = c2; 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /devops/maven/dew-maven-plugin/src/test/java/mock/Mock.java: -------------------------------------------------------------------------------- 1 | package mock; 2 | 3 | import group.idealworld.dew.devops.kernel.helper.GitHelper; 4 | import group.idealworld.dew.devops.kernel.util.DewLog; 5 | 6 | /** 7 | * Mock. 8 | * 9 | * @author gudaoxuri 10 | */ 11 | public class Mock { 12 | 13 | public Mock() { 14 | GitHelper.forceInit("GIT", "", new MockGitOpt(DewLog.build(this.getClass()))); 15 | } 16 | 17 | } 18 | -------------------------------------------------------------------------------- /devops/maven/dew-maven-plugin/src/test/java/mock/MockGitOpt.java: -------------------------------------------------------------------------------- 1 | package mock; 2 | 3 | import group.idealworld.dew.devops.kernel.helper.GitOpt; 4 | import org.slf4j.Logger; 5 | 6 | import java.util.ArrayList; 7 | import java.util.List; 8 | 9 | /** 10 | * Mock Git Opt. 11 | * 12 | * @author gudaoxuri 13 | */ 14 | public class MockGitOpt extends GitOpt { 15 | 16 | protected MockGitOpt(Logger log) { 17 | super(log); 18 | } 19 | 20 | @Override 21 | public List diff(String startCommitHash, String endCommitHash) { 22 | log.warn("Mock diff"); 23 | return new ArrayList<>() { 24 | { 25 | // 有一个文件变更 26 | add("pom.xml"); 27 | } 28 | }; 29 | } 30 | 31 | @Override 32 | public String getCurrentBranch() { 33 | log.warn("Mock getCurrentBranch"); 34 | return "mock"; 35 | } 36 | 37 | @Override 38 | public String getCurrentCommit() { 39 | log.warn("Mock getCurrentCommit"); 40 | return "00000000000000000000000000"; 41 | } 42 | 43 | @Override 44 | public String getScmUrl() { 45 | log.warn("Mock getScmUrl"); 46 | return "https://github.com/gudaoxuri/dew.git"; 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /devops/maven/dew-maven-plugin/src/test/resources/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM alpine:3.6 2 | 3 | CMD ["sh"] 4 | -------------------------------------------------------------------------------- /devops/maven/dew-maven-plugin/src/test/resources/ns-test.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: Namespace 3 | metadata: 4 | name: ns-test -------------------------------------------------------------------------------- /devops/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 4.0.0 6 | 7 | group.idealworld.dew 8 | build-devops 9 | 2 Dew Devops Build 10 | pom 11 | 3.0.0-rc.8 12 | 13 | 14 | true 15 | true 16 | true 17 | 18 | 19 | 20 | maven/dew-maven-plugin 21 | maven/dew-maven-agent 22 | it 23 | 24 | 25 | -------------------------------------------------------------------------------- /docs/CNAME: -------------------------------------------------------------------------------- 1 | doc.dew.idealworld.group 2 | -------------------------------------------------------------------------------- /docs/images/devops-jenkins/extend-choice-parameter.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gudaoxuri/dew/23be7cb9e3a7b70124152a1e63219f67e5a9b48c/docs/images/devops-jenkins/extend-choice-parameter.jpg -------------------------------------------------------------------------------- /docs/images/devops-jenkins/git_branch.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gudaoxuri/dew/23be7cb9e3a7b70124152a1e63219f67e5a9b48c/docs/images/devops-jenkins/git_branch.jpg -------------------------------------------------------------------------------- /docs/images/devops-jenkins/git_repo.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gudaoxuri/dew/23be7cb9e3a7b70124152a1e63219f67e5a9b48c/docs/images/devops-jenkins/git_repo.jpg -------------------------------------------------------------------------------- /docs/images/devops-jenkins/manual/parameter-assign-service-view.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gudaoxuri/dew/23be7cb9e3a7b70124152a1e63219f67e5a9b48c/docs/images/devops-jenkins/manual/parameter-assign-service-view.jpg -------------------------------------------------------------------------------- /docs/images/devops-jenkins/manual/parameter-assign-service.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gudaoxuri/dew/23be7cb9e3a7b70124152a1e63219f67e5a9b48c/docs/images/devops-jenkins/manual/parameter-assign-service.jpg -------------------------------------------------------------------------------- /docs/images/devops-jenkins/manual/parameter-branch-1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gudaoxuri/dew/23be7cb9e3a7b70124152a1e63219f67e5a9b48c/docs/images/devops-jenkins/manual/parameter-branch-1.jpg -------------------------------------------------------------------------------- /docs/images/devops-jenkins/manual/parameter-branch-2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gudaoxuri/dew/23be7cb9e3a7b70124152a1e63219f67e5a9b48c/docs/images/devops-jenkins/manual/parameter-branch-2.jpg -------------------------------------------------------------------------------- /docs/images/devops-jenkins/manual/parameter-devops_phase.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gudaoxuri/dew/23be7cb9e3a7b70124152a1e63219f67e5a9b48c/docs/images/devops-jenkins/manual/parameter-devops_phase.jpg -------------------------------------------------------------------------------- /docs/images/devops-jenkins/manual/parameter-git_repo.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gudaoxuri/dew/23be7cb9e3a7b70124152a1e63219f67e5a9b48c/docs/images/devops-jenkins/manual/parameter-git_repo.jpg -------------------------------------------------------------------------------- /docs/images/devops-jenkins/manual/parameter-types.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gudaoxuri/dew/23be7cb9e3a7b70124152a1e63219f67e5a9b48c/docs/images/devops-jenkins/manual/parameter-types.jpg -------------------------------------------------------------------------------- /docs/images/devops-jenkins/manual/parameter.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gudaoxuri/dew/23be7cb9e3a7b70124152a1e63219f67e5a9b48c/docs/images/devops-jenkins/manual/parameter.jpg -------------------------------------------------------------------------------- /docs/images/devops-jenkins/manual/pipeline-build.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gudaoxuri/dew/23be7cb9e3a7b70124152a1e63219f67e5a9b48c/docs/images/devops-jenkins/manual/pipeline-build.jpg -------------------------------------------------------------------------------- /docs/images/devops-jenkins/manual/pipeline-create.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gudaoxuri/dew/23be7cb9e3a7b70124152a1e63219f67e5a9b48c/docs/images/devops-jenkins/manual/pipeline-create.jpg -------------------------------------------------------------------------------- /docs/images/devops-jenkins/manual/pipeline-devops-phase-view.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gudaoxuri/dew/23be7cb9e3a7b70124152a1e63219f67e5a9b48c/docs/images/devops-jenkins/manual/pipeline-devops-phase-view.jpg -------------------------------------------------------------------------------- /docs/images/devops-jenkins/manual/pipeline-dew.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gudaoxuri/dew/23be7cb9e3a7b70124152a1e63219f67e5a9b48c/docs/images/devops-jenkins/manual/pipeline-dew.jpg -------------------------------------------------------------------------------- /docs/images/devops-jenkins/manual/pipeline-scm.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gudaoxuri/dew/23be7cb9e3a7b70124152a1e63219f67e5a9b48c/docs/images/devops-jenkins/manual/pipeline-scm.jpg -------------------------------------------------------------------------------- /docs/images/devops-jenkins/manual/ts-git.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gudaoxuri/dew/23be7cb9e3a7b70124152a1e63219f67e5a9b48c/docs/images/devops-jenkins/manual/ts-git.jpg -------------------------------------------------------------------------------- /docs/images/devops-jenkins/manual/ts-stage-skip.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gudaoxuri/dew/23be7cb9e3a7b70124152a1e63219f67e5a9b48c/docs/images/devops-jenkins/manual/ts-stage-skip.jpg -------------------------------------------------------------------------------- /docs/images/devops-jenkins/parameter.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gudaoxuri/dew/23be7cb9e3a7b70124152a1e63219f67e5a9b48c/docs/images/devops-jenkins/parameter.jpg -------------------------------------------------------------------------------- /docs/images/devops-jenkins/pipeline-scm.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gudaoxuri/dew/23be7cb9e3a7b70124152a1e63219f67e5a9b48c/docs/images/devops-jenkins/pipeline-scm.jpg -------------------------------------------------------------------------------- /docs/images/devops-notify/failure-split.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gudaoxuri/dew/23be7cb9e3a7b70124152a1e63219f67e5a9b48c/docs/images/devops-notify/failure-split.png -------------------------------------------------------------------------------- /docs/images/devops-notify/failure.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gudaoxuri/dew/23be7cb9e3a7b70124152a1e63219f67e5a9b48c/docs/images/devops-notify/failure.png -------------------------------------------------------------------------------- /docs/images/devops-notify/ignore-split.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gudaoxuri/dew/23be7cb9e3a7b70124152a1e63219f67e5a9b48c/docs/images/devops-notify/ignore-split.png -------------------------------------------------------------------------------- /docs/images/devops-notify/non-split.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gudaoxuri/dew/23be7cb9e3a7b70124152a1e63219f67e5a9b48c/docs/images/devops-notify/non-split.png -------------------------------------------------------------------------------- /docs/images/devops-notify/report.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gudaoxuri/dew/23be7cb9e3a7b70124152a1e63219f67e5a9b48c/docs/images/devops-notify/report.png -------------------------------------------------------------------------------- /docs/images/devops-notify/successful-split.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gudaoxuri/dew/23be7cb9e3a7b70124152a1e63219f67e5a9b48c/docs/images/devops-notify/successful-split.png -------------------------------------------------------------------------------- /docs/images/devops-notify/successful.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gudaoxuri/dew/23be7cb9e3a7b70124152a1e63219f67e5a9b48c/docs/images/devops-notify/successful.png -------------------------------------------------------------------------------- /docs/images/gitlab-ci-rollback.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gudaoxuri/dew/23be7cb9e3a7b70124152a1e63219f67e5a9b48c/docs/images/gitlab-ci-rollback.png -------------------------------------------------------------------------------- /docs/images/todo-demo.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gudaoxuri/dew/23be7cb9e3a7b70124152a1e63219f67e5a9b48c/docs/images/todo-demo.gif -------------------------------------------------------------------------------- /docs/src/main/asciidoc/_chapter/appendix/3.x-migration-guide.adoc: -------------------------------------------------------------------------------- 1 | [[dew-3-migration-guide]] 2 | === Dew 3.x Migration guide 3 | 4 | 本手册适用于从原生 Spring Cloud 项目及 Dew 2.x 项目迁移到 Dew 3.x 的操作说明。 5 | 6 | ==== 迁移步骤 7 | 8 | [options="interactive"] 9 | 10 | * [ ] [配置] ``dew.security.router.black-uri`` 更名为 ``dew.security.router.block-uri`` 11 | -------------------------------------------------------------------------------- /docs/src/main/asciidoc/_chapter/devops/q&a.adoc: -------------------------------------------------------------------------------- 1 | [[devops-q-and-a]] 2 | === DevOps常见问题 3 | 4 | ==== javax.net.ssl.SSLHandshakeException: extension (5) should not be presented in certificate_request 5 | 6 | JDK Bug,升级JDK版本或加上 ``-Djdk.tls.client.protocols=TLSv1.2`` 7 | 8 | @See https://github.com/kubernetes-client/java/issues/893 + 9 | @See https://bugs.openjdk.java.net/browse/JDK-8236039 10 | 11 | ==== PKIX path building failed: sun.security.provider.certpath.SunCert PathBuilderException: unable to find valid certification path to requested target 12 | 13 | -Dmaven.wagon.http.ssl.insecure=true -Dmaven.wagon.http.ssl.allowall=true -Dmaven.wagon.http.ssl.ignore.validity.dates=true 14 | -------------------------------------------------------------------------------- /docs/src/main/asciidoc/book.adoc: -------------------------------------------------------------------------------- 1 | = Dew:一站式微服务解决方案 2 | v3.0.0-rc.7 3 | 2020-6-10 4 | :doctype: book 5 | :encoding: utf-8 6 | :lang: zh-CN 7 | :toc: left 8 | :toclevels: 3 9 | :numbered: 10 | 11 | ifndef::imagesdir[:imagesdir: ./images] 12 | 13 | include::../../../../README.adoc[] 14 | 15 | == 架构设计 Architecture Chapter 16 | 17 | 微服务架构设计请参见本书: 18 | 19 | https://github.com/gudaoxuri/Microservices-Architecture 20 | 21 | == 编码开发 Framework Chapter 22 | 23 | include::_chapter/framework/quick-start.adoc[] 24 | 25 | include::_chapter/framework/user-manual.adoc[] 26 | 27 | include::_chapter/framework/configuration.adoc[] 28 | 29 | include::_chapter/framework/best-practices.adoc[] 30 | 31 | -------------------------------------------------------------------------------- /examples/auth-example/src/main/java/group/idealworld/dew/example/auth/AuthExampleApplication.java: -------------------------------------------------------------------------------- 1 | package group.idealworld.dew.example.auth; 2 | 3 | import org.springframework.boot.autoconfigure.SpringBootApplication; 4 | import org.springframework.boot.builder.SpringApplicationBuilder; 5 | 6 | /** 7 | * 工程启动类. 8 | * 9 | * @author gudaoxuri 10 | */ 11 | @SpringBootApplication 12 | public class AuthExampleApplication { 13 | 14 | /** 15 | * The entry point of application. 16 | * 17 | * @param args the input arguments 18 | */ 19 | public static void main(String[] args) { 20 | new SpringApplicationBuilder(AuthExampleApplication.class).run(args); 21 | } 22 | 23 | } 24 | -------------------------------------------------------------------------------- /examples/auth-example/src/main/java/group/idealworld/dew/example/auth/dto/OptInfoExt.java: -------------------------------------------------------------------------------- 1 | package group.idealworld.dew.example.auth.dto; 2 | 3 | import group.idealworld.dew.core.auth.dto.BasicOptInfo; 4 | 5 | /** 6 | * Opt info ext. 7 | * 8 | * @author gudaoxuri 9 | */ 10 | public class OptInfoExt extends BasicOptInfo { 11 | 12 | private String idCard; 13 | 14 | /** 15 | * Gets id card. 16 | * 17 | * @return the id card 18 | */ 19 | public String getIdCard() { 20 | return idCard; 21 | } 22 | 23 | /** 24 | * Sets id card. 25 | * 26 | * @param idCard the id card 27 | * @return the id card 28 | */ 29 | public OptInfoExt setIdCard(String idCard) { 30 | this.idCard = idCard; 31 | return this; 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /examples/auth-example/src/main/resources/application.yml: -------------------------------------------------------------------------------- 1 | spring: 2 | application: 3 | name: auth-example 4 | data: 5 | redis: 6 | host: localhost 7 | port: 6379 8 | 9 | server: 10 | port: 8080 11 | 12 | dew: 13 | cluster: 14 | cache: redis 15 | security: 16 | token-flag: _token_ 17 | token-in-header: true 18 | token-hash: false 19 | 20 | -------------------------------------------------------------------------------- /examples/bone-example/src/main/java/group/idealworld/dew/example/bone/BoneExampleApplication.java: -------------------------------------------------------------------------------- 1 | package group.idealworld.dew.example.bone; 2 | 3 | import org.springframework.boot.autoconfigure.SpringBootApplication; 4 | import org.springframework.boot.builder.SpringApplicationBuilder; 5 | 6 | /** 7 | * 工程启动类. 8 | * 9 | * @author gudaoxuri 10 | */ 11 | @SpringBootApplication(proxyBeanMethods = false) 12 | public class BoneExampleApplication { 13 | 14 | /** 15 | * The entry point of application. 16 | * 17 | * @param args the input arguments 18 | */ 19 | public static void main(String[] args) { 20 | new SpringApplicationBuilder(BoneExampleApplication.class).run(args); 21 | } 22 | 23 | } 24 | -------------------------------------------------------------------------------- /examples/bone-example/src/main/java/group/idealworld/dew/example/bone/BoneExampleConfig.java: -------------------------------------------------------------------------------- 1 | package group.idealworld.dew.example.bone; 2 | 3 | import org.springframework.boot.context.properties.ConfigurationProperties; 4 | import org.springframework.stereotype.Component; 5 | 6 | /** 7 | * 在根路径创建配置隐射类. 8 | * 9 | * @author gudaoxuri 10 | */ 11 | @Component 12 | @ConfigurationProperties(prefix = "bone-example") 13 | public class BoneExampleConfig { 14 | 15 | private String someProp; 16 | 17 | /** 18 | * Gets some prop. 19 | * 20 | * @return the some prop 21 | */ 22 | public String getSomeProp() { 23 | return someProp; 24 | } 25 | 26 | /** 27 | * Sets some prop. 28 | * 29 | * @param someProp the some prop 30 | */ 31 | public void setSomeProp(String someProp) { 32 | this.someProp = someProp; 33 | } 34 | 35 | } 36 | -------------------------------------------------------------------------------- /examples/bone-example/src/main/java/group/idealworld/dew/example/bone/BoneExampleInitiator.java: -------------------------------------------------------------------------------- 1 | package group.idealworld.dew.example.bone; 2 | 3 | import org.slf4j.Logger; 4 | import org.slf4j.LoggerFactory; 5 | import org.springframework.beans.factory.annotation.Autowired; 6 | import org.springframework.stereotype.Component; 7 | 8 | import jakarta.annotation.PostConstruct; 9 | 10 | /** 11 | * 在根路径创建用于初始化数据/行为的类. 12 | *

13 | * 减少滥用PostConstruct造成的不可控因素 14 | * 15 | * @author gudaoxuri 16 | */ 17 | @Component 18 | public class BoneExampleInitiator { 19 | 20 | private static final Logger LOGGER = LoggerFactory.getLogger(BoneExampleInitiator.class); 21 | 22 | @Autowired 23 | private BoneExampleConfig boneExampleConfig; 24 | 25 | /** 26 | * Init. 27 | */ 28 | @PostConstruct 29 | public void init() { 30 | // 在这里初始化 31 | LOGGER.info(">>>> " + boneExampleConfig.getSomeProp()); 32 | 33 | } 34 | 35 | } 36 | -------------------------------------------------------------------------------- /examples/bone-example/src/main/resources/META-INF/native-image/group.idealworld.dew/bone-example/agent-access-filter.json: -------------------------------------------------------------------------------- 1 | { 2 | "rules": [ 3 | { 4 | "excludeClasses": "org.apache.maven.surefire.**" 5 | }, 6 | { 7 | "excludeClasses": "com.oracle.truffle.**" 8 | }, 9 | { 10 | "excludeClasses": "org.graalvm.**" 11 | }, 12 | { 13 | "excludeClasses": "junit.framework.**" 14 | }, 15 | { 16 | "excludeClasses": "sun.**" 17 | } 18 | ] 19 | } 20 | -------------------------------------------------------------------------------- /examples/bone-example/src/main/resources/META-INF/native-image/group.idealworld.dew/bone-example/jni-config.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "name":"java.lang.ClassLoader", 4 | "methods":[ 5 | {"name":"getPlatformClassLoader","parameterTypes":[] }, 6 | {"name":"loadClass","parameterTypes":["java.lang.String"] } 7 | ] 8 | }, 9 | { 10 | "name":"java.lang.ClassNotFoundException" 11 | }, 12 | { 13 | "name":"java.lang.NoSuchMethodError" 14 | } 15 | ] 16 | -------------------------------------------------------------------------------- /examples/bone-example/src/main/resources/META-INF/native-image/group.idealworld.dew/bone-example/native-image.properties: -------------------------------------------------------------------------------- 1 | 2 | 3 | # Args = 4 | -------------------------------------------------------------------------------- /examples/bone-example/src/main/resources/META-INF/native-image/group.idealworld.dew/bone-example/proxy-config.json: -------------------------------------------------------------------------------- 1 | [ 2 | ] 3 | -------------------------------------------------------------------------------- /examples/bone-example/src/main/resources/META-INF/native-image/group.idealworld.dew/bone-example/reflect-config.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "name":"group.idealworld.dew.example.bone.BoneExampleApplicationTest", 4 | "allDeclaredFields":true, 5 | "allDeclaredMethods":true, 6 | "allPublicConstructors":true 7 | }, 8 | { 9 | "name":"java.lang.Object", 10 | "allDeclaredFields":true, 11 | "allDeclaredMethods":true 12 | }, 13 | { 14 | "name":"org.junit.runner.Description", 15 | "methods":[{"name":"createSuiteDescription","parameterTypes":["java.lang.String","java.lang.annotation.Annotation[]"] }] 16 | }, 17 | { 18 | "name":"org.junit.runner.RunWith" 19 | } 20 | ] 21 | -------------------------------------------------------------------------------- /examples/bone-example/src/main/resources/META-INF/native-image/group.idealworld.dew/bone-example/resource-config.json: -------------------------------------------------------------------------------- 1 | { 2 | "resources":[ 3 | {"pattern":"\\Qorg/springframework/boot/autoconfigure/ImportAutoConfigurationImportSelector.class\\E"}, 4 | {"pattern":"\\Qgroup/idealworld/dew/DewStartup.class\\E"}, 5 | {"pattern":"\\Qgroup/idealworld/dew/Dew.class\\E"}, 6 | {"pattern":"\\Qgroup/idealworld/dew/core/web/error/ErrorAutoConfiguration.class\\E"}, 7 | {"pattern":"\\Qgroup/idealworld/dew/core/web/interceptor/InterceptorWebAutoConfiguration.class\\E"}, 8 | {"pattern":"\\Qgroup/idealworld/dew/core/web/interceptor/AutoTrimConfiguration.class\\E"}, 9 | {"pattern":"\\Qgroup/idealworld/dew/core/basic/utils/convert/ConvertAutoConfiguration.class\\E"}, 10 | {"pattern":"\\Qgroup/idealworld/dew/core/auth/AuthAutoConfiguration.class\\E"}, 11 | {"pattern":"\\Qgroup/idealworld/dew/core/doc/DocAutoConfiguration.class\\E"} 12 | ], 13 | "bundles":[] 14 | } 15 | -------------------------------------------------------------------------------- /examples/bone-example/src/main/resources/application.yml: -------------------------------------------------------------------------------- 1 | spring: 2 | application: 3 | name: bone-example 4 | 5 | bone-example: 6 | some-prop: prop1 7 | -------------------------------------------------------------------------------- /examples/bone-example/src/test/java/group/idealworld/dew/example/bone/BoneExampleApplicationTest.java: -------------------------------------------------------------------------------- 1 | package group.idealworld.dew.example.bone; 2 | 3 | import org.junit.Test; 4 | 5 | /** 6 | * The type Bone example application test. 7 | * 8 | * @author gudaoxuri 9 | */ 10 | public class BoneExampleApplicationTest { 11 | 12 | /** 13 | * Test. 14 | */ 15 | @Test 16 | public void test() { 17 | 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /examples/cluster-example/src/main/java/group/idealworld/dew/example/cluster/ClusterExampleApplication.java: -------------------------------------------------------------------------------- 1 | package group.idealworld.dew.example.cluster; 2 | 3 | import org.springframework.boot.autoconfigure.SpringBootApplication; 4 | import org.springframework.boot.builder.SpringApplicationBuilder; 5 | 6 | /** 7 | * 工程启动类. 8 | * 9 | * @author gudaoxuri 10 | */ 11 | @SpringBootApplication 12 | public class ClusterExampleApplication { 13 | 14 | /** 15 | * The entry point of application. 16 | * 17 | * @param args the input arguments 18 | */ 19 | public static void main(String[] args) { 20 | new SpringApplicationBuilder(ClusterExampleApplication.class).run(args); 21 | } 22 | 23 | } 24 | -------------------------------------------------------------------------------- /examples/cluster-example/src/main/resources/application.yml: -------------------------------------------------------------------------------- 1 | spring: 2 | application: 3 | name: cluster-example 4 | redis: 5 | host: localhost 6 | port: 6379 7 | database: 0 8 | password: 123456 9 | lettuce: 10 | pool: 11 | max-active: 10 12 | max-wait: -1 13 | max-idle: 1 14 | min-idle: 0 15 | # rabbitmq: 16 | # host: localhost 17 | # port: 5672 18 | # username: root 19 | # password: 123456 20 | # virtual-host: dew 21 | # hazelcast: 22 | # addresses: ["127.0.0.1"] 23 | 24 | dew: 25 | cluster: 26 | cache: redis 27 | map: redis # 可选 redis/hazelcast 28 | lock: redis # 可选 redis/hazelcast 29 | mq: redis # 可选 redis/hazelcast/rabbit 30 | election: redis # 可选 redis/eureka 31 | -------------------------------------------------------------------------------- /examples/hbase-example/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 4.0.0 6 | 7 | 8 | group.idealworld.dew 9 | parent-starter 10 | 3.0.0-rc.8 11 | ../../framework/modules/parent-starter 12 | 13 | 14 | hbase-example 15 | 3.7 spring boot hbase 示例 16 | spring boot hbase 示例 17 | jar 18 | 19 | 20 | true 21 | true 22 | true 23 | 24 | 25 | 26 | 27 | group.idealworld.dew 28 | boot-starter 29 | 30 | 31 | group.idealworld.dew 32 | hbase-starter 33 | 34 | 35 | 36 | -------------------------------------------------------------------------------- /examples/hbase-example/src/main/java/group/idealworld/dew/example/hbase/HBaseExampleApplication.java: -------------------------------------------------------------------------------- 1 | package group.idealworld.dew.example.hbase; 2 | 3 | import org.springframework.boot.autoconfigure.SpringBootApplication; 4 | import org.springframework.boot.builder.SpringApplicationBuilder; 5 | 6 | /** 7 | * The class of project start. 8 | * 9 | * @author 迹_Jason 10 | */ 11 | @SpringBootApplication 12 | public class HBaseExampleApplication { 13 | 14 | /** 15 | * The entry point of application. 16 | * 17 | * @param args the input arguments 18 | */ 19 | public static void main(String[] args) { 20 | new SpringApplicationBuilder(HBaseExampleApplication.class).run(args); 21 | } 22 | 23 | } 24 | -------------------------------------------------------------------------------- /examples/hbase-example/src/main/java/group/idealworld/dew/example/hbase/HBaseExampleInitiator.java: -------------------------------------------------------------------------------- 1 | package group.idealworld.dew.example.hbase; 2 | 3 | import group.idealworld.dew.core.hbase.HBaseTemplate; 4 | import org.apache.hadoop.hbase.util.Bytes; 5 | import org.slf4j.Logger; 6 | import org.slf4j.LoggerFactory; 7 | import org.springframework.beans.factory.annotation.Autowired; 8 | import org.springframework.stereotype.Component; 9 | 10 | import jakarta.annotation.PostConstruct; 11 | 12 | /** 13 | * Cluster example initiator. 14 | * 15 | * @author 迹_Jason 16 | */ 17 | @Component 18 | public class HBaseExampleInitiator { 19 | 20 | private static final Logger LOGGER = LoggerFactory.getLogger(HBaseExampleInitiator.class); 21 | 22 | @Autowired 23 | private HBaseTemplate hbaseTemplate; 24 | 25 | /** 26 | * Init. 27 | * 28 | * @throws Exception the exception 29 | */ 30 | @PostConstruct 31 | public void init() throws Exception { 32 | String st = hbaseTemplate.get("DMP:D10_DOP.FDN.V2.T_APP_USER", "0002093140000000", 33 | "0", "reg_platform", (result, row) -> Bytes.toString(result.value())); 34 | LOGGER.info("result:{}", st); 35 | } 36 | 37 | } 38 | -------------------------------------------------------------------------------- /examples/hbase-example/src/main/resources/application.yml: -------------------------------------------------------------------------------- 1 | spring: 2 | application: 3 | name: hbase-example 4 | redis: 5 | host: localhost 6 | port: 6379 7 | database: 0 8 | password: 123456 9 | lettuce: 10 | pool: 11 | max-active: 10 12 | max-wait: -1 13 | max-idle: 1 14 | min-idle: 0 15 | hbase: 16 | zkQuorum: localhost 17 | znodeParent: /hbase-secure 18 | auth: 19 | type: kerberos 20 | principal: 21 | keytab: 22 | hbaseMasterPrincipal: 23 | hbaseRegionServerPrincipal: 24 | 25 | 26 | 27 | dew: 28 | cluster: 29 | cache: redis 30 | map: redis # 可选 redis/hazelcast 31 | lock: redis # 可选 redis/hazelcast 32 | mq: redis # 可选 redis/hazelcast/rabbit 33 | election: redis # 可选 redis/eureka 34 | -------------------------------------------------------------------------------- /examples/idempotent-example/src/main/java/group/idealworld/dew/example/idempotent/IdempotentExampleApplication.java: -------------------------------------------------------------------------------- 1 | package group.idealworld.dew.example.idempotent; 2 | 3 | import org.springframework.boot.autoconfigure.SpringBootApplication; 4 | import org.springframework.boot.builder.SpringApplicationBuilder; 5 | 6 | /** 7 | * Idempotent example application. 8 | * 9 | * @author gudaoxuri 10 | */ 11 | @SpringBootApplication 12 | public class IdempotentExampleApplication { 13 | 14 | /** 15 | * The entry point of application. 16 | * 17 | * @param args the input arguments 18 | */ 19 | public static void main(String[] args) { 20 | new SpringApplicationBuilder(IdempotentExampleApplication.class).run(args); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /examples/idempotent-example/src/main/resources/application.yml: -------------------------------------------------------------------------------- 1 | dew: 2 | cluster: 3 | cache: redis 4 | idempotent: 5 | default-expire-ms: 3600000 # 设置默认过期时间,1小时 6 | default-strategy: item # 设置默认策略,支持 bloom(Bloom Filter)和item(逐条记录) 7 | default-opt-id-flag: __IDEMPOTENT_OPT_ID__ # 指定幂等操作ID标识,可以位于HTTP Header或请求参数中 8 | spring: 9 | application: 10 | name: Idempotent-example 11 | redis: 12 | host: 127.0.0.1 13 | port: 6379 14 | password: 123456 -------------------------------------------------------------------------------- /examples/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 4.0.0 6 | 7 | group.idealworld.dew 8 | build-example 9 | 3 Dew Example Build 10 | pom 11 | 3.0.0-rc.8 12 | 13 | 14 | true 15 | true 16 | true 17 | 18 | 19 | 20 | bone-example 21 | web-example 22 | cluster-example 23 | idempotent-example 24 | auth-example 25 | hbase-example 26 | skywalking-example 27 | 28 | 29 | -------------------------------------------------------------------------------- /examples/skywalking-example/src/main/java/group/idealworld/dew/example/skywalking/SkyWalkingExampleApplication.java: -------------------------------------------------------------------------------- 1 | package group.idealworld.dew.example.skywalking; 2 | 3 | import org.springframework.boot.autoconfigure.SpringBootApplication; 4 | import org.springframework.boot.builder.SpringApplicationBuilder; 5 | 6 | /** 7 | * 工程启动类. 8 | *

9 | * visit : http://127.0.0.1:809/swagger-ui.html 10 | * 11 | * @author gudaoxuri 12 | */ 13 | @SpringBootApplication(proxyBeanMethods = false) 14 | public class SkyWalkingExampleApplication { 15 | 16 | public static void main(String[] args) { 17 | new SpringApplicationBuilder(SkyWalkingExampleApplication.class).run(args); 18 | } 19 | 20 | } 21 | -------------------------------------------------------------------------------- /examples/skywalking-example/src/main/java/group/idealworld/dew/example/skywalking/SkyWalkingExampleController.java: -------------------------------------------------------------------------------- 1 | package group.idealworld.dew.example.skywalking; 2 | 3 | import group.idealworld.dew.Dew; 4 | import io.swagger.v3.oas.annotations.Operation; 5 | import io.swagger.v3.oas.annotations.extensions.Extension; 6 | import io.swagger.v3.oas.annotations.extensions.ExtensionProperty; 7 | import io.swagger.v3.oas.annotations.tags.Tag; 8 | import org.springframework.validation.annotation.Validated; 9 | import org.springframework.web.bind.annotation.*; 10 | 11 | /** 12 | * Web example controller. 13 | * 14 | * @author gudaoxuri 15 | */ 16 | @RestController 17 | @Tag(name = "example", description = "示例应用说明") 18 | @Validated // URL 类型的验证需要使用此注解 19 | public class SkyWalkingExampleController { 20 | 21 | /** 22 | * 最基础的Controller示例. 23 | * 24 | * @return result 25 | */ 26 | @GetMapping("example") 27 | @Operation(summary = "示例方法", extensions = { 28 | @Extension(name = "FIN_EXT", properties = @ExtensionProperty(name = "REL", value = "s001,s002")) }) 29 | public String example() { 30 | return Dew.cluster.trace.getTraceId(); 31 | } 32 | 33 | } 34 | -------------------------------------------------------------------------------- /examples/skywalking-example/src/main/resources/application.yml: -------------------------------------------------------------------------------- 1 | spring: 2 | application: 3 | name: skywalking-example 4 | 5 | server: 6 | port: 809 # http端口号 7 | # servlet: 8 | # context-path: /tt 9 | 10 | dew: 11 | trace: skywalking 12 | basic: 13 | name: SkyWalking示例 14 | version: 1.0 15 | desc: 这是一个SkyWalking示例 16 | web-site: http://www.idealworld.group 17 | doc: 18 | base-package: group.idealworld.dew # API文档路径 19 | servers: 20 | dev env: http://localhost:809 21 | test env: http://localhost:8080/tt 22 | request-headers: 23 | Token: token in header 24 | App-Id: app id in header 25 | management: 26 | endpoints: 27 | web: 28 | base-path: /management 29 | exposure: 30 | include: '*' 31 | endpoint: 32 | metrics: 33 | enabled: true 34 | prometheus: 35 | enabled: true 36 | metrics: 37 | export: 38 | prometheus: 39 | enabled: true 40 | 41 | #springdoc: 42 | # swagger-ui: 43 | # urls: 44 | # - url: http://127.0.0.1:809/v3/api-docs/dew-default2 45 | # name: dew-default 46 | -------------------------------------------------------------------------------- /examples/web-example/src/main/java/group/idealworld/dew/example/web/WebExample2Controller.java: -------------------------------------------------------------------------------- 1 | package group.idealworld.dew.example.web; 2 | 3 | import group.idealworld.dew.core.DewConfig; 4 | import io.swagger.v3.oas.annotations.Operation; 5 | import io.swagger.v3.oas.annotations.security.SecurityRequirement; 6 | import io.swagger.v3.oas.annotations.tags.Tag; 7 | import org.springframework.validation.annotation.Validated; 8 | import org.springframework.web.bind.annotation.GetMapping; 9 | import org.springframework.web.bind.annotation.RestController; 10 | 11 | import java.util.HashMap; 12 | import java.util.Map; 13 | 14 | /** 15 | * Web example2 controller. 16 | * 17 | * @author gudaoxuri 18 | */ 19 | @RestController 20 | @Tag(name = "exmaple2", description = "示例应用2说明") 21 | @Validated // URL 类型的验证需要使用此注解 22 | public class WebExample2Controller { 23 | 24 | /** 25 | * 最基础的Controller示例. 26 | * 27 | * @return result 28 | */ 29 | @GetMapping("test") 30 | @Operation(summary = "示例方法", security = { @SecurityRequirement(name = DewConfig.DEW_AUTH_DOC_FLAG) }) 31 | public Map test() { 32 | return new HashMap<>() { 33 | { 34 | put("a", 1); 35 | } 36 | }; 37 | } 38 | 39 | } 40 | -------------------------------------------------------------------------------- /examples/web-example/src/main/java/group/idealworld/dew/example/web/WebExampleApplication.java: -------------------------------------------------------------------------------- 1 | package group.idealworld.dew.example.web; 2 | 3 | import org.springframework.boot.autoconfigure.SpringBootApplication; 4 | import org.springframework.boot.builder.SpringApplicationBuilder; 5 | 6 | /** 7 | * 工程启动类. 8 | *

9 | * visit : http://127.0.0.1:809/swagger-ui.html 10 | * 11 | * @author gudaoxuri 12 | */ 13 | @SpringBootApplication(proxyBeanMethods = false) 14 | public class WebExampleApplication { 15 | 16 | public static void main(String[] args) { 17 | new SpringApplicationBuilder(WebExampleApplication.class).run(args); 18 | } 19 | 20 | } 21 | -------------------------------------------------------------------------------- /examples/web-example/src/main/resources/application.yml: -------------------------------------------------------------------------------- 1 | spring: 2 | application: 3 | name: web-example 4 | 5 | server: 6 | port: 809 # http端口号 7 | # servlet: 8 | # context-path: /tt 9 | 10 | dew: 11 | basic: 12 | name: web示例 13 | version: 1.0 14 | desc: 这是一个Web示例 15 | web-site: http://www.idealworld.group 16 | doc: 17 | base-package: group.idealworld.dew # API文档路径 18 | servers: 19 | dev env: http://localhost:809 20 | test env: http://localhost:8080/tt 21 | request-headers: 22 | Token: token in header 23 | App-Id: app id in header 24 | management: 25 | endpoints: 26 | web: 27 | base-path: /management 28 | exposure: 29 | include: '*' 30 | endpoint: 31 | metrics: 32 | enabled: true 33 | prometheus: 34 | enabled: true 35 | metrics: 36 | export: 37 | prometheus: 38 | enabled: true 39 | 40 | #springdoc: 41 | # swagger-ui: 42 | # urls: 43 | # - url: http://127.0.0.1:809/v3/api-docs/dew-default2 44 | # name: dew-default 45 | -------------------------------------------------------------------------------- /framework/assists/sdkgen-maven-plugin/src/main/java/group/idealworld/dew/sdkgen/Constants.java: -------------------------------------------------------------------------------- 1 | package group.idealworld.dew.sdkgen; 2 | 3 | /** 4 | * The type Constants. 5 | * 6 | * @author gudaoxuri 7 | */ 8 | public class Constants { 9 | 10 | /** 11 | * The constant FLAG_DEW_SDK_GEN. 12 | */ 13 | public static final String FLAG_DEW_SDK_GEN = "dew_sdk_gen"; 14 | /** 15 | * The constant FLAG_DEW_SDK_RELEASE_SKIP. 16 | */ 17 | public static final String FLAG_DEW_SDK_RELEASE_SKIP = "dew_sdk_release_skip"; 18 | /** 19 | * The constant FLAG_DEW_MAIN_CLASS. 20 | */ 21 | public static final String FLAG_DEW_MAIN_CLASS = "dew_main_class"; 22 | /** 23 | * The constant FLAG_DEW_SDK_GEN_OPENAPI_PATH. 24 | */ 25 | public static final String FLAG_DEW_SDK_GEN_OPENAPI_PATH = "dew_sdk_gen_openapi_path"; 26 | /** 27 | * The constant FLAG_DEW_SDK_GEN_LANG. 28 | */ 29 | public static final String FLAG_DEW_SDK_GEN_LANG = "dew_sdk_gen_lang"; 30 | 31 | /** 32 | * The constant GENERATED_BASE_PATH. 33 | */ 34 | public static final String GENERATED_BASE_PATH = "dew_sdkgen"; 35 | /** 36 | * The constant GENERATED_OPENAPI_FILE_NAME. 37 | */ 38 | public static final String GENERATED_OPENAPI_FILE_NAME = "openapi.json"; 39 | 40 | private Constants() { 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /framework/assists/sdkgen-maven-plugin/src/main/java/group/idealworld/dew/sdkgen/helper/HandlebarsHelper.java: -------------------------------------------------------------------------------- 1 | package group.idealworld.dew.sdkgen.helper; 2 | 3 | import com.github.jknack.handlebars.Handlebars; 4 | import com.github.jknack.handlebars.Helper; 5 | 6 | /** 7 | * The type Handlebars helper. 8 | * 9 | * @author gudaoxuri 10 | */ 11 | public class HandlebarsHelper { 12 | 13 | private HandlebarsHelper() { 14 | } 15 | 16 | public static void registerFormatClassName(Handlebars handlebars) { 17 | handlebars.registerHelper("formatClassName", 18 | (Helper) (s, options) -> NameHelper.formatClassName(s)); 19 | } 20 | 21 | public static void registerFormatPackage(Handlebars handlebars) { 22 | handlebars.registerHelper("formatPackage", 23 | (Helper) (s, options) -> NameHelper.formatPackage(s)); 24 | } 25 | 26 | } 27 | -------------------------------------------------------------------------------- /framework/assists/sdkgen-maven-plugin/src/main/java/group/idealworld/dew/sdkgen/helper/NameHelper.java: -------------------------------------------------------------------------------- 1 | package group.idealworld.dew.sdkgen.helper; 2 | 3 | import java.util.regex.Matcher; 4 | import java.util.regex.Pattern; 5 | 6 | /** 7 | * The type Name helper. 8 | * 9 | * @author gudaoxuri 10 | */ 11 | public class NameHelper { 12 | 13 | private static final Pattern CLASS_NAME_PATTERN = Pattern.compile("[^a-zA-Z0-9]+(\\w{1})"); 14 | 15 | private NameHelper() { 16 | } 17 | 18 | /** 19 | * Format package. 20 | * 21 | * @param pkg the pkg 22 | * @return the result 23 | */ 24 | public static String formatPackage(String pkg) { 25 | return pkg.toLowerCase().replaceAll("[^a-zA-Z0-9.]+", ""); 26 | } 27 | 28 | /** 29 | * Format class name. 30 | * 31 | * @param name the name 32 | * @return the result 33 | */ 34 | public static String formatClassName(String name) { 35 | name = name.substring(0, 1).toUpperCase() + name.substring(1, name.length() - 4) + "SDK"; 36 | Matcher matcher = CLASS_NAME_PATTERN.matcher(name); 37 | return matcher.replaceAll(s -> s.group(1).toUpperCase()); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /framework/assists/sdkgen-maven-plugin/src/main/resources/handlebars/Java/sdk.mustache: -------------------------------------------------------------------------------- 1 | {{>licenseInfo}}package {{formatPackage groupId}}.{{formatPackage artifactId}}; 2 | 3 | {{#apiInfo.apis}}import {{package}}.{{classFilename}}; 4 | {{/apiInfo.apis}} 5 | import {{formatPackage groupId}}.{{formatPackage artifactId}}.invoker.Configuration; 6 | 7 | /** 8 | * {{artifactId}} 入口. 9 | * 10 | * @author dewms 11 | */ 12 | public class {{formatClassName artifactId}} { 13 | 14 | /** 15 | * 初始化方法. 16 | * 17 | * @param basePath 服务器地址 18 | */ 19 | public static void init(String basePath){ 20 | Configuration.getDefaultApiClient().setBasePath(basePath); 21 | } 22 | 23 | public static class Auth { 24 | 25 | /** 26 | * 设置Token. 27 | * 28 | * @param token Token 29 | */ 30 | public static void setToken(String token) { 31 | Configuration.getDefaultApiClient().setApiKey(token); 32 | } 33 | 34 | } 35 | 36 | {{#apiInfo.apis}} 37 | public static final {{classFilename}} {{classVarName}} = new {{classFilename}}(); 38 | {{/apiInfo.apis}} 39 | 40 | } 41 | -------------------------------------------------------------------------------- /framework/assists/sdkgen-maven-plugin/src/test/java/group/idealworld/dew/devops/BasicTest.java: -------------------------------------------------------------------------------- 1 | package group.idealworld.dew.devops; 2 | 3 | /** 4 | * Basic test. 5 | * 6 | * @author gudaoxuri 7 | */ 8 | public abstract class BasicTest { 9 | 10 | } 11 | -------------------------------------------------------------------------------- /framework/modules/boot-starter/src/main/java/group/idealworld/dew/core/auth/AuthAutoConfiguration.java: -------------------------------------------------------------------------------- 1 | package group.idealworld.dew.core.auth; 2 | 3 | import org.slf4j.Logger; 4 | import org.slf4j.LoggerFactory; 5 | import org.springframework.context.annotation.Bean; 6 | import org.springframework.context.annotation.Configuration; 7 | 8 | import jakarta.annotation.PostConstruct; 9 | 10 | /** 11 | * Auth auto configuration. 12 | * 13 | * @author gudaoxuri 14 | */ 15 | @Configuration 16 | public class AuthAutoConfiguration { 17 | 18 | private static final Logger LOGGER = LoggerFactory.getLogger(AuthAutoConfiguration.class); 19 | 20 | /** 21 | * Basic auth adapter. 22 | * 23 | * @return the basic auth adapter 24 | */ 25 | @Bean 26 | public BasicAuthAdapter basicAuthAdapter() { 27 | return new BasicAuthAdapter(); 28 | } 29 | 30 | /** 31 | * Init. 32 | */ 33 | @PostConstruct 34 | public void init() { 35 | LOGGER.info("Load Auto Configuration : {}", this.getClass().getName()); 36 | } 37 | 38 | } 39 | -------------------------------------------------------------------------------- /framework/modules/boot-starter/src/main/java/group/idealworld/dew/core/basic/fun/VoidExecutor.java: -------------------------------------------------------------------------------- 1 | package group.idealworld.dew.core.basic.fun; 2 | 3 | /** 4 | * The interface Void executor. 5 | * 6 | * @author gudaoxuri 7 | */ 8 | @FunctionalInterface 9 | public interface VoidExecutor { 10 | 11 | /** 12 | * Exec. 13 | */ 14 | void exec(); 15 | 16 | } 17 | -------------------------------------------------------------------------------- /framework/modules/boot-starter/src/main/java/group/idealworld/dew/core/basic/fun/VoidPredicate.java: -------------------------------------------------------------------------------- 1 | package group.idealworld.dew.core.basic.fun; 2 | 3 | /** 4 | * The interface Void predicate. 5 | * 6 | * @author gudaoxuri 7 | */ 8 | @FunctionalInterface 9 | public interface VoidPredicate { 10 | 11 | /** 12 | * Test boolean. 13 | * 14 | * @return the boolean 15 | */ 16 | boolean test(); 17 | 18 | } 19 | -------------------------------------------------------------------------------- /framework/modules/boot-starter/src/main/java/group/idealworld/dew/core/basic/loading/DewLoadImmediately.java: -------------------------------------------------------------------------------- 1 | package group.idealworld.dew.core.basic.loading; 2 | 3 | import java.lang.annotation.*; 4 | 5 | /** 6 | * Dew专用的Bean加载注解,在Dew.class初始化立即加载对应的Bean. 7 | * 8 | * @author gudaoxuri 9 | */ 10 | @Documented 11 | @Retention(RetentionPolicy.RUNTIME) 12 | @Target(ElementType.TYPE) 13 | public @interface DewLoadImmediately { 14 | 15 | /** 16 | * 加载优先级. 17 | *

18 | * 暂未实现 19 | * 20 | * @return 优先级 21 | */ 22 | int value() default 10; 23 | 24 | } 25 | -------------------------------------------------------------------------------- /framework/modules/boot-starter/src/main/java/group/idealworld/dew/core/basic/utils/TraceIdUtil.java: -------------------------------------------------------------------------------- 1 | package group.idealworld.dew.core.basic.utils; 2 | 3 | 4 | import com.ecfront.dew.common.$; 5 | import group.idealworld.dew.Dew; 6 | import org.slf4j.Logger; 7 | import org.slf4j.LoggerFactory; 8 | 9 | /** 10 | * @author yiye 11 | **/ 12 | public class TraceIdUtil { 13 | private static final Logger LOGGER = LoggerFactory.getLogger(TraceIdUtil.class); 14 | 15 | private TraceIdUtil() { 16 | } 17 | 18 | public static String createResponseCode(String code, String businessFlag) { 19 | var trace = Dew.Info.name + businessFlag + ":" + Dew.cluster.trace.getTraceId(); 20 | LOGGER.trace("TRACE:[{}] {}", businessFlag, trace); 21 | return code + "-" + $.security.digest.digest(trace, "MD5"); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /framework/modules/boot-starter/src/main/java/group/idealworld/dew/core/basic/utils/convert/InstantConvert.java: -------------------------------------------------------------------------------- 1 | package group.idealworld.dew.core.basic.utils.convert; 2 | 3 | import org.springframework.core.convert.converter.Converter; 4 | import org.springframework.util.ObjectUtils; 5 | 6 | import java.time.Instant; 7 | 8 | /** 9 | * Instant convert. 10 | * 11 | * @author gudaoxuri 12 | */ 13 | public class InstantConvert implements Converter { 14 | @Override 15 | public Instant convert(String str) { 16 | if (ObjectUtils.isEmpty(str)) { 17 | return null; 18 | } 19 | return Instant.ofEpochMilli(Long.valueOf(str)); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /framework/modules/boot-starter/src/main/java/group/idealworld/dew/core/basic/utils/convert/LocalDateConverter.java: -------------------------------------------------------------------------------- 1 | package group.idealworld.dew.core.basic.utils.convert; 2 | 3 | import org.springframework.core.convert.converter.Converter; 4 | import org.springframework.util.ObjectUtils; 5 | 6 | import java.time.LocalDate; 7 | import java.time.format.DateTimeFormatter; 8 | 9 | /** 10 | * Local date converter. 11 | * 12 | * @author gudaoxuri 13 | */ 14 | public class LocalDateConverter implements Converter { 15 | 16 | @Override 17 | public LocalDate convert(String str) { 18 | if (ObjectUtils.isEmpty(str)) { 19 | return null; 20 | } 21 | return LocalDate.parse(str, DateTimeFormatter.ofPattern("yyyy-MM-dd")); 22 | } 23 | 24 | } 25 | -------------------------------------------------------------------------------- /framework/modules/boot-starter/src/main/java/group/idealworld/dew/core/basic/utils/convert/LocalDateTimeConverter.java: -------------------------------------------------------------------------------- 1 | package group.idealworld.dew.core.basic.utils.convert; 2 | 3 | import org.springframework.core.convert.converter.Converter; 4 | import org.springframework.util.ObjectUtils; 5 | 6 | import java.time.Instant; 7 | import java.time.LocalDateTime; 8 | import java.time.ZoneId; 9 | import java.time.format.DateTimeFormatter; 10 | 11 | /** 12 | * Local date time converter. 13 | * 14 | * @author gudaoxuri 15 | */ 16 | public class LocalDateTimeConverter implements Converter { 17 | @Override 18 | public LocalDateTime convert(String str) { 19 | if (ObjectUtils.isEmpty(str)) { 20 | return null; 21 | } 22 | if (str.matches("[1-9][0-9]+")) { 23 | return LocalDateTime.ofInstant(Instant.ofEpochMilli(Long.valueOf(str)), ZoneId.systemDefault()); 24 | } 25 | return LocalDateTime.parse(str, DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /framework/modules/boot-starter/src/main/java/group/idealworld/dew/core/basic/utils/convert/LocalTimeConverter.java: -------------------------------------------------------------------------------- 1 | package group.idealworld.dew.core.basic.utils.convert; 2 | 3 | import org.springframework.core.convert.converter.Converter; 4 | import org.springframework.util.ObjectUtils; 5 | 6 | import java.time.LocalTime; 7 | import java.time.format.DateTimeFormatter; 8 | 9 | /** 10 | * Local time converter. 11 | * 12 | * @author gudaoxuri 13 | */ 14 | public class LocalTimeConverter implements Converter { 15 | 16 | @Override 17 | public LocalTime convert(String str) { 18 | if (ObjectUtils.isEmpty(str)) { 19 | return null; 20 | } 21 | return LocalTime.parse(str, DateTimeFormatter.ofPattern("HH:mm:ss")); 22 | } 23 | 24 | } 25 | -------------------------------------------------------------------------------- /framework/modules/boot-starter/src/main/java/group/idealworld/dew/core/notification/Channel.java: -------------------------------------------------------------------------------- 1 | package group.idealworld.dew.core.notification; 2 | 3 | import java.util.Set; 4 | 5 | /** 6 | * 通知通道. 7 | * 8 | * @author gudaoxuri 9 | */ 10 | public interface Channel { 11 | 12 | /** 13 | * 初始化通道. 14 | * 15 | * @param notifyConfig the notify config 16 | */ 17 | void init(NotifyConfig notifyConfig); 18 | 19 | /** 20 | * 销毁通道. 21 | */ 22 | void destroy(); 23 | 24 | /** 25 | * 发送消息. 26 | * 27 | * @param content 消息内容 28 | * @param title 消息标题 29 | * @param receivers 接收人列表 30 | * @return 是否成功 31 | */ 32 | boolean send(String content, String title, Set receivers); 33 | 34 | } 35 | -------------------------------------------------------------------------------- /framework/modules/boot-starter/src/main/java/group/idealworld/dew/core/util/ThreadLocalUtil.java: -------------------------------------------------------------------------------- 1 | package group.idealworld.dew.core.util; 2 | 3 | /** 4 | * thread local 5 | * 6 | * @author rpf 7 | */ 8 | public class ThreadLocalUtil { 9 | 10 | /** 11 | * store thread local variables 12 | */ 13 | private final ThreadLocal threadLocal = new ThreadLocal<>(); 14 | 15 | /** 16 | * set value 17 | * 18 | * @param value the value 19 | */ 20 | public void set(T value) { 21 | threadLocal.set(value); 22 | } 23 | 24 | /** 25 | * get thread local variables 26 | * 27 | * @return the local variables 28 | */ 29 | public T get() { 30 | return threadLocal.get(); 31 | } 32 | 33 | /** 34 | * remove thread local variables 35 | */ 36 | public void remove() { 37 | threadLocal.remove(); 38 | } 39 | 40 | } 41 | -------------------------------------------------------------------------------- /framework/modules/boot-starter/src/main/java/group/idealworld/dew/core/web/validation/CreateGroup.java: -------------------------------------------------------------------------------- 1 | package group.idealworld.dew.core.web.validation; 2 | 3 | /** 4 | * The interface Create group. 5 | * 6 | * @author gudaoxuri 7 | */ 8 | public interface CreateGroup { 9 | // doNothing 10 | } 11 | -------------------------------------------------------------------------------- /framework/modules/boot-starter/src/main/java/group/idealworld/dew/core/web/validation/IdNumberValidator.java: -------------------------------------------------------------------------------- 1 | package group.idealworld.dew.core.web.validation; 2 | 3 | import com.ecfront.dew.common.$; 4 | import org.springframework.util.ObjectUtils; 5 | 6 | import jakarta.validation.ConstraintValidator; 7 | import jakarta.validation.ConstraintValidatorContext; 8 | 9 | /** 10 | * Id number validator. 11 | * 12 | * @author gudaoxuri 13 | */ 14 | public class IdNumberValidator implements ConstraintValidator { 15 | 16 | @Override 17 | public void initialize(IdNumber constraintAnnotation) { 18 | // doNothing 19 | } 20 | 21 | @Override 22 | public boolean isValid(String value, ConstraintValidatorContext context) { 23 | return ObjectUtils.isEmpty(value) || $.field.validateIdNumber(value); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /framework/modules/boot-starter/src/main/java/group/idealworld/dew/core/web/validation/PhoneValidator.java: -------------------------------------------------------------------------------- 1 | package group.idealworld.dew.core.web.validation; 2 | 3 | import com.ecfront.dew.common.$; 4 | import org.springframework.util.ObjectUtils; 5 | 6 | import jakarta.validation.ConstraintValidator; 7 | import jakarta.validation.ConstraintValidatorContext; 8 | 9 | /** 10 | * Phone validator. 11 | * 12 | * @author gudaoxuri 13 | */ 14 | public class PhoneValidator implements ConstraintValidator { 15 | @Override 16 | public void initialize(Phone constraintAnnotation) { 17 | // doNothing 18 | } 19 | 20 | @Override 21 | public boolean isValid(String value, ConstraintValidatorContext context) { 22 | return ObjectUtils.isEmpty(value) || $.field.validateMobile(value); 23 | } 24 | 25 | } 26 | -------------------------------------------------------------------------------- /framework/modules/boot-starter/src/main/java/group/idealworld/dew/core/web/validation/RemoveGroup.java: -------------------------------------------------------------------------------- 1 | package group.idealworld.dew.core.web.validation; 2 | 3 | /** 4 | * The interface Remove group. 5 | * 6 | * @author gudaoxuri 7 | */ 8 | public interface RemoveGroup { 9 | // doNothing 10 | } 11 | -------------------------------------------------------------------------------- /framework/modules/boot-starter/src/main/java/group/idealworld/dew/core/web/validation/UpdateGroup.java: -------------------------------------------------------------------------------- 1 | package group.idealworld.dew.core.web.validation; 2 | 3 | /** 4 | * The interface Update group. 5 | * 6 | * @author gudaoxuri 7 | */ 8 | public interface UpdateGroup { 9 | // doNothing 10 | } 11 | -------------------------------------------------------------------------------- /framework/modules/boot-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports: -------------------------------------------------------------------------------- 1 | group.idealworld.dew.DewStartup 2 | group.idealworld.dew.Dew 3 | group.idealworld.dew.core.web.error.ErrorAutoConfiguration 4 | group.idealworld.dew.core.web.interceptor.InterceptorWebAutoConfiguration 5 | group.idealworld.dew.core.web.interceptor.AutoTrimConfiguration 6 | group.idealworld.dew.core.basic.utils.convert.ConvertAutoConfiguration 7 | group.idealworld.dew.core.auth.AuthAutoConfiguration 8 | group.idealworld.dew.core.doc.DocAutoConfiguration 9 | -------------------------------------------------------------------------------- /framework/modules/boot-starter/src/test/java/com/trc/test/BootTestApplication.java: -------------------------------------------------------------------------------- 1 | package com.trc.test; 2 | 3 | import org.springframework.boot.autoconfigure.SpringBootApplication; 4 | import org.springframework.boot.builder.SpringApplicationBuilder; 5 | 6 | /** 7 | * Boot test application. 8 | * 9 | * @author gudaoxuri 10 | */ 11 | @SpringBootApplication 12 | public class BootTestApplication { 13 | 14 | /** 15 | * The entry point of application. 16 | * 17 | * @param args the input arguments 18 | */ 19 | public static void main(String[] args) { 20 | new SpringApplicationBuilder(BootTestApplication.class).run(args); 21 | } 22 | 23 | } 24 | -------------------------------------------------------------------------------- /framework/modules/boot-starter/src/test/java/com/trc/test/auth/OptInfoExt.java: -------------------------------------------------------------------------------- 1 | package com.trc.test.auth; 2 | 3 | import group.idealworld.dew.core.auth.dto.BasicOptInfo; 4 | 5 | /** 6 | * Opt info ext. 7 | * 8 | * @author gudaoxuri 9 | */ 10 | public class OptInfoExt extends BasicOptInfo { 11 | 12 | private String idCard; 13 | 14 | /** 15 | * Gets id card. 16 | * 17 | * @return the id card 18 | */ 19 | public String getIdCard() { 20 | return idCard; 21 | } 22 | 23 | /** 24 | * Sets id card. 25 | * 26 | * @param idCard the id card 27 | * @return the id card 28 | */ 29 | public OptInfoExt setIdCard(String idCard) { 30 | this.idCard = idCard; 31 | return this; 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /framework/modules/boot-starter/src/test/java/com/trc/test/notification/NotifyIntegrationTest.java: -------------------------------------------------------------------------------- 1 | package com.trc.test.notification; 2 | 3 | import com.ecfront.dew.common.Resp; 4 | import group.idealworld.dew.Dew; 5 | import org.junit.jupiter.api.Assertions; 6 | import org.springframework.stereotype.Component; 7 | 8 | /** 9 | * The type Notify integration test. 10 | * 11 | * @author gudaoxuri 12 | */ 13 | @Component 14 | public class NotifyIntegrationTest { 15 | 16 | /** 17 | * Test all. 18 | */ 19 | public void testAll() { 20 | Resp result = Dew.notify.send("flag1", "测试消息,默认通知人", "测试"); 21 | Assertions.assertTrue(result.ok()); 22 | } 23 | 24 | } 25 | -------------------------------------------------------------------------------- /framework/modules/boot-starter/src/test/java/com/trc/test/web/AuthException.java: -------------------------------------------------------------------------------- 1 | package com.trc.test.web; 2 | 3 | /** 4 | * Auth exception. 5 | * 6 | * @author gudaoxuri 7 | */ 8 | public class AuthException extends RuntimeException { 9 | 10 | } 11 | -------------------------------------------------------------------------------- /framework/modules/boot-starter/src/test/java/com/trc/test/web2/Web2Controller.java: -------------------------------------------------------------------------------- 1 | package com.trc.test.web2; 2 | 3 | import com.ecfront.dew.common.Resp; 4 | import io.swagger.v3.oas.annotations.Operation; 5 | import io.swagger.v3.oas.annotations.Parameter; 6 | import io.swagger.v3.oas.annotations.enums.ParameterIn; 7 | import io.swagger.v3.oas.annotations.tags.Tag; 8 | import org.springframework.validation.annotation.Validated; 9 | import org.springframework.web.bind.annotation.GetMapping; 10 | import org.springframework.web.bind.annotation.RequestMapping; 11 | import org.springframework.web.bind.annotation.RequestParam; 12 | import org.springframework.web.bind.annotation.RestController; 13 | 14 | /** 15 | * Web controller. 16 | * 17 | * @author gudaoxuri 18 | */ 19 | @RestController 20 | @Tag(name = "test2", description = "Test2 API") 21 | @RequestMapping(value = "/test2/") 22 | @Validated 23 | public class Web2Controller { 24 | 25 | @GetMapping(value = "test2") 26 | @Operation(summary = "test2") 27 | public Resp test2(@Parameter(name = "q", in = ParameterIn.QUERY, required = true) @RequestParam String q) { 28 | return Resp.success("test2"); 29 | } 30 | 31 | } 32 | -------------------------------------------------------------------------------- /framework/modules/boot-starter/src/test/resources/application-ident.yml: -------------------------------------------------------------------------------- 1 | dew: 2 | security: 3 | ident-info-enabled: true 4 | un_ident_urls: /ident/white 5 | 6 | server: 7 | port: 8089 -------------------------------------------------------------------------------- /framework/modules/cluster-common-test/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 4.0.0 6 | 7 | 8 | group.idealworld.dew 9 | parent-starter 10 | 3.0.0-rc.8 11 | ../parent-starter 12 | 13 | 14 | cluster-common-test 15 | 1.1.1 Dew Cluster Common InitTest 16 | Dew 集群服务测试 17 | jar 18 | 19 | 20 | 21 | 22 | 23 | 24 | group.idealworld.dew 25 | cluster-common 26 | 27 | 28 | org.xerial 29 | sqlite-jdbc 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /framework/modules/cluster-common-test/src/main/java/group/idealworld/dew/core/cluster/test/ClusterElectionTest.java: -------------------------------------------------------------------------------- 1 | package group.idealworld.dew.core.cluster.test; 2 | 3 | import group.idealworld.dew.core.cluster.ClusterElection; 4 | 5 | /** 6 | * Cluster election test. 7 | * 8 | * @author gudaoxuri 9 | */ 10 | public class ClusterElectionTest { 11 | 12 | /** 13 | * Test. 14 | * 15 | * @param election the election 16 | * @throws InterruptedException the interrupted exception 17 | */ 18 | public void test(ClusterElection election) throws InterruptedException { 19 | Thread.sleep(10000); 20 | assert election.isLeader(); 21 | } 22 | 23 | } 24 | -------------------------------------------------------------------------------- /framework/modules/cluster-common/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 4.0.0 6 | 7 | 8 | group.idealworld.dew 9 | parent-starter 10 | 3.0.0-rc.8 11 | ../parent-starter 12 | 13 | 14 | cluster-common 15 | 1.1.0 Dew Cluster Common 16 | Dew 集群服务接口 17 | jar 18 | 19 | 20 | 21 | 22 | 23 | 24 | com.ecfront.dew 25 | common 26 | 27 | 28 | org.xerial 29 | sqlite-jdbc 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /framework/modules/cluster-common/src/main/java/group/idealworld/dew/core/cluster/ClusterCacheWrap.java: -------------------------------------------------------------------------------- 1 | package group.idealworld.dew.core.cluster; 2 | 3 | /** 4 | * 缓存服务多实例封装. 5 | * 6 | * @author gudaoxuri 7 | */ 8 | public interface ClusterCacheWrap { 9 | 10 | /** 11 | * 缓存服务实例获取,默认实例. 12 | * 13 | * @return 缓存服务实例 14 | */ 15 | default ClusterCache instance() { 16 | return instance(""); 17 | } 18 | 19 | /** 20 | * 缓存服务服务实例获取. 21 | * 22 | * @param key 实例Key 23 | * @return 缓存服务实例 24 | */ 25 | ClusterCache instance(String key); 26 | 27 | /** 28 | * 是否存在对应的缓存服务实例. 29 | * 30 | * @param key 实例Key 31 | * @return 是否存在 32 | */ 33 | boolean exist(String key); 34 | 35 | } 36 | -------------------------------------------------------------------------------- /framework/modules/cluster-common/src/main/java/group/idealworld/dew/core/cluster/ClusterElection.java: -------------------------------------------------------------------------------- 1 | package group.idealworld.dew.core.cluster; 2 | 3 | /** 4 | * 领导者选举服务. 5 | * 6 | * @author gudaoxuri 7 | */ 8 | public interface ClusterElection { 9 | 10 | /** 11 | * 当前工程是否是领导者. 12 | * 13 | * @return 是否是领导者 14 | */ 15 | boolean isLeader(); 16 | 17 | } 18 | -------------------------------------------------------------------------------- /framework/modules/cluster-common/src/main/java/group/idealworld/dew/core/cluster/ClusterElectionWrap.java: -------------------------------------------------------------------------------- 1 | package group.idealworld.dew.core.cluster; 2 | 3 | /** 4 | * 领导者选举服务多实例封装. 5 | * 6 | * @author gudaoxuri 7 | */ 8 | public interface ClusterElectionWrap { 9 | 10 | /** 11 | * 领导者选举服务实例获取,默认实例. 12 | * 13 | * @return 领导者选举服务实例 14 | */ 15 | ClusterElection instance(); 16 | 17 | /** 18 | * 领导者选举服务实例获取. 19 | * 20 | * @param key 实例Key 21 | * @return 领导者选举服务实例 22 | */ 23 | ClusterElection instance(String key); 24 | 25 | } 26 | -------------------------------------------------------------------------------- /framework/modules/cluster-common/src/main/java/group/idealworld/dew/core/cluster/ClusterLockWrap.java: -------------------------------------------------------------------------------- 1 | package group.idealworld.dew.core.cluster; 2 | 3 | /** 4 | * 分布式锁服务多实例封装. 5 | * 6 | * @author gudaoxuri 7 | */ 8 | public interface ClusterLockWrap { 9 | 10 | /** 11 | * 分布式锁服务实例获取. 12 | * 13 | * @param key 实例Key 14 | * @return 分布式锁服务实例 15 | */ 16 | ClusterLock instance(String key); 17 | 18 | } 19 | -------------------------------------------------------------------------------- /framework/modules/cluster-common/src/main/java/group/idealworld/dew/core/cluster/ClusterMapWrap.java: -------------------------------------------------------------------------------- 1 | package group.idealworld.dew.core.cluster; 2 | 3 | /** 4 | * 分布式Map服务多实例封装. 5 | * 6 | * @author gudaoxuri 7 | */ 8 | public interface ClusterMapWrap { 9 | 10 | /** 11 | * 分布式Map服务实例获取. 12 | * 13 | * @param key 实例Key 14 | * @param clazz 值的类型 15 | * @param 值的类型 16 | * @return 分布式Map服务实例 17 | */ 18 | ClusterMap instance(String key, Class clazz); 19 | 20 | } 21 | -------------------------------------------------------------------------------- /framework/modules/cluster-common/src/main/java/group/idealworld/dew/core/cluster/ClusterTrace.java: -------------------------------------------------------------------------------- 1 | package group.idealworld.dew.core.cluster; 2 | 3 | /** 4 | * Created on 2022/9/25. 5 | * 6 | * @author 迹_Jason 7 | */ 8 | public interface ClusterTrace { 9 | 10 | default String getTraceId() { 11 | return ""; 12 | } 13 | 14 | void setTraceId(String traceId); 15 | 16 | void removeTraceId(); 17 | } 18 | -------------------------------------------------------------------------------- /framework/modules/cluster-common/src/main/java/group/idealworld/dew/core/cluster/VoidProcessFun.java: -------------------------------------------------------------------------------- 1 | package group.idealworld.dew.core.cluster; 2 | 3 | /** 4 | * 输入输出均为空的函数. 5 | * 6 | * @author gudaoxuri 7 | */ 8 | @FunctionalInterface 9 | public interface VoidProcessFun { 10 | 11 | /** 12 | * 执行函数. 13 | */ 14 | void exec(); 15 | 16 | } 17 | -------------------------------------------------------------------------------- /framework/modules/cluster-common/src/main/java/group/idealworld/dew/core/cluster/dto/MessageHeader.java: -------------------------------------------------------------------------------- 1 | package group.idealworld.dew.core.cluster.dto; 2 | 3 | import java.util.Map; 4 | 5 | /** 6 | * 消息Meta. 7 | * 8 | * @author gudaoxuri 9 | */ 10 | public class MessageHeader { 11 | 12 | /** 13 | * The message name/topic. 14 | */ 15 | public String name; 16 | /** 17 | * The message header. 18 | */ 19 | public Map header; 20 | 21 | /** 22 | * Instantiates a new Message header. 23 | * 24 | * @param name the message name/topic 25 | * @param header the message header 26 | */ 27 | public MessageHeader(String name, Map header) { 28 | this.name = name; 29 | this.header = header; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /framework/modules/cluster-common/src/main/java/group/idealworld/dew/core/cluster/exception/NotImplementedException.java: -------------------------------------------------------------------------------- 1 | package group.idealworld.dew.core.cluster.exception; 2 | 3 | /** 4 | * 方法未实现异常. 5 | * 6 | * @author gudaoxuri 7 | */ 8 | public class NotImplementedException extends RuntimeException { 9 | 10 | } 11 | -------------------------------------------------------------------------------- /framework/modules/cluster-common/src/main/java/group/idealworld/dew/core/cluster/ha/ClusterHA.java: -------------------------------------------------------------------------------- 1 | package group.idealworld.dew.core.cluster.ha; 2 | 3 | import group.idealworld.dew.core.cluster.dto.MessageWrap; 4 | import group.idealworld.dew.core.cluster.ha.dto.HAConfig; 5 | import group.idealworld.dew.core.cluster.ha.entity.PrepareCommitMsg; 6 | 7 | import java.sql.SQLException; 8 | import java.util.List; 9 | 10 | /** 11 | * 集群HA处理接口. 12 | * 13 | * @author gudaoxuri 14 | */ 15 | public interface ClusterHA { 16 | 17 | /** 18 | * 初始化. 19 | * 20 | * @param haConfig HA配置 21 | * @throws SQLException the sql exception 22 | */ 23 | void init(HAConfig haConfig) throws SQLException; 24 | 25 | /** 26 | * 获取到消息后的处理方法. 27 | *

28 | * 多为暂存消息以做灾备 29 | * 30 | * @param addr the addr 31 | * @param msg the msg 32 | * @return the id 33 | */ 34 | String mqAfterPollMsg(String addr, MessageWrap msg); 35 | 36 | /** 37 | * 消息被确认后的处理方法. 38 | *

39 | * 多为删除暂存消息 40 | * 41 | * @param id the id 42 | */ 43 | void mqAfterMsgAcked(String id); 44 | 45 | /** 46 | * 获取所有已接收但未确认的消息. 47 | * 48 | * @param addr the addr 49 | * @return the list 50 | */ 51 | List mqFindAllUnCommittedMsg(String addr); 52 | 53 | } 54 | -------------------------------------------------------------------------------- /framework/modules/cluster-hazelcast/src/main/java/group/idealworld/dew/core/cluster/spi/hazelcast/HazelcastClusterLockWrap.java: -------------------------------------------------------------------------------- 1 | package group.idealworld.dew.core.cluster.spi.hazelcast; 2 | 3 | import group.idealworld.dew.core.cluster.ClusterLock; 4 | import group.idealworld.dew.core.cluster.ClusterLockWrap; 5 | 6 | import java.util.concurrent.ConcurrentHashMap; 7 | 8 | /** 9 | * 分布式锁服务多实例封装 Hazelcast 实现. 10 | * 11 | * @author gudaoxuri 12 | */ 13 | public class HazelcastClusterLockWrap implements ClusterLockWrap { 14 | 15 | private static final ConcurrentHashMap LOCK_CONTAINER = new ConcurrentHashMap<>(); 16 | 17 | private HazelcastAdapter hazelcastAdapter; 18 | 19 | /** 20 | * Instantiates a new Hazelcast cluster lock wrap. 21 | * 22 | * @param hazelcastAdapter the hazelcast adapter 23 | */ 24 | public HazelcastClusterLockWrap(HazelcastAdapter hazelcastAdapter) { 25 | this.hazelcastAdapter = hazelcastAdapter; 26 | } 27 | 28 | @Override 29 | public ClusterLock instance(String key) { 30 | LOCK_CONTAINER.putIfAbsent(key, new HazelcastClusterLock(key, hazelcastAdapter.getHazelcastInstance())); 31 | return LOCK_CONTAINER.get(key); 32 | } 33 | 34 | } 35 | -------------------------------------------------------------------------------- /framework/modules/cluster-hazelcast/src/main/java/group/idealworld/dew/core/cluster/spi/hazelcast/HazelcastClusterMapWrap.java: -------------------------------------------------------------------------------- 1 | package group.idealworld.dew.core.cluster.spi.hazelcast; 2 | 3 | import group.idealworld.dew.core.cluster.ClusterMap; 4 | import group.idealworld.dew.core.cluster.ClusterMapWrap; 5 | 6 | import java.util.concurrent.ConcurrentHashMap; 7 | 8 | /** 9 | * 分布式Map服务多实例封装 Hazelcast 实现. 10 | * 11 | * @author gudaoxuri 12 | */ 13 | public class HazelcastClusterMapWrap implements ClusterMapWrap { 14 | 15 | private static final ConcurrentHashMap MAP_CONTAINER = new ConcurrentHashMap<>(); 16 | 17 | private HazelcastAdapter hazelcastAdapter; 18 | 19 | /** 20 | * Instantiates a new Hazelcast cluster map wrap. 21 | * 22 | * @param hazelcastAdapter the hazelcast adapter 23 | */ 24 | public HazelcastClusterMapWrap(HazelcastAdapter hazelcastAdapter) { 25 | this.hazelcastAdapter = hazelcastAdapter; 26 | } 27 | 28 | @Override 29 | public ClusterMap instance(String key, Class clazz) { 30 | MAP_CONTAINER.putIfAbsent(key, new HazelcastClusterMap(key, hazelcastAdapter.getHazelcastInstance())); 31 | return MAP_CONTAINER.get(key); 32 | } 33 | 34 | } 35 | -------------------------------------------------------------------------------- /framework/modules/cluster-hazelcast/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports: -------------------------------------------------------------------------------- 1 | group.idealworld.dew.core.cluster.spi.hazelcast.HazelcastAutoConfiguration -------------------------------------------------------------------------------- /framework/modules/cluster-hazelcast/src/test/resources/application.yml: -------------------------------------------------------------------------------- 1 | dew: 2 | cluster: 3 | lock: hazelcast 4 | map: hazelcast 5 | mq: hazelcast 6 | 7 | spring: 8 | hazelcast: 9 | addresses: ["127.0.0.1"] 10 | -------------------------------------------------------------------------------- /framework/modules/cluster-mqtt/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports: -------------------------------------------------------------------------------- 1 | group.idealworld.dew.core.cluster.spi.mqtt.MqttAutoConfiguration -------------------------------------------------------------------------------- /framework/modules/cluster-mqtt/src/test/resources/application.yml: -------------------------------------------------------------------------------- 1 | dew: 2 | cluster: 3 | mq: mqtt 4 | mw: 5 | mqtt: 6 | broker: tcp://127.0.0.1:1883 7 | persistence: memory 8 | -------------------------------------------------------------------------------- /framework/modules/cluster-rabbit/src/main/java/group/idealworld/dew/core/cluster/spi/rabbit/RabbitAdapter.java: -------------------------------------------------------------------------------- 1 | package group.idealworld.dew.core.cluster.spi.rabbit; 2 | 3 | import org.springframework.amqp.rabbit.connection.Connection; 4 | import org.springframework.amqp.rabbit.core.RabbitTemplate; 5 | 6 | /** 7 | * Rabbit adapter. 8 | * 9 | * @author gudaoxuri 10 | */ 11 | public class RabbitAdapter { 12 | 13 | private final RabbitTemplate rabbitTemplate; 14 | 15 | /** 16 | * Instantiates a new Rabbit adapter. 17 | * 18 | * @param rabbitTemplate the rabbit template 19 | */ 20 | public RabbitAdapter(RabbitTemplate rabbitTemplate) { 21 | this.rabbitTemplate = rabbitTemplate; 22 | } 23 | 24 | /** 25 | * Gets connection. 26 | * 27 | * @return the connection 28 | */ 29 | Connection getConnection() { 30 | return rabbitTemplate.getConnectionFactory().createConnection(); 31 | } 32 | 33 | } 34 | -------------------------------------------------------------------------------- /framework/modules/cluster-rabbit/src/main/java/group/idealworld/dew/core/cluster/spi/rabbit/ReceiveBeforeFun.java: -------------------------------------------------------------------------------- 1 | package group.idealworld.dew.core.cluster.spi.rabbit; 2 | 3 | import com.rabbitmq.client.AMQP; 4 | 5 | /** 6 | * The interface Receive before fun. 7 | * 8 | * @author gudaoxuri 9 | */ 10 | @FunctionalInterface 11 | public interface ReceiveBeforeFun { 12 | 13 | /** 14 | * Invoke object. 15 | * 16 | * @param exchange the exchange 17 | * @param routingKey the routing key 18 | * @param queueName the queue name 19 | * @param messageProperties the message properties 20 | * @return the object 21 | */ 22 | Object invoke(String exchange, String routingKey, String queueName, AMQP.BasicProperties messageProperties); 23 | 24 | } 25 | -------------------------------------------------------------------------------- /framework/modules/cluster-rabbit/src/main/java/group/idealworld/dew/core/cluster/spi/rabbit/ReceiveErrorFun.java: -------------------------------------------------------------------------------- 1 | package group.idealworld.dew.core.cluster.spi.rabbit; 2 | 3 | /** 4 | * The interface Receive error fun. 5 | * 6 | * @author gudaoxuri 7 | */ 8 | @FunctionalInterface 9 | public interface ReceiveErrorFun { 10 | 11 | /** 12 | * Invoke. 13 | * 14 | * @param ex the ex 15 | * @param beforeResult the before result 16 | */ 17 | void invoke(Exception ex, Object beforeResult); 18 | 19 | } 20 | -------------------------------------------------------------------------------- /framework/modules/cluster-rabbit/src/main/java/group/idealworld/dew/core/cluster/spi/rabbit/ReceiveFinishFun.java: -------------------------------------------------------------------------------- 1 | package group.idealworld.dew.core.cluster.spi.rabbit; 2 | 3 | /** 4 | * The interface Receive finish fun. 5 | * 6 | * @author gudaoxuri 7 | */ 8 | @FunctionalInterface 9 | public interface ReceiveFinishFun { 10 | 11 | /** 12 | * Invoke. 13 | * 14 | * @param beforeResult the before result 15 | */ 16 | void invoke(Object beforeResult); 17 | 18 | } 19 | -------------------------------------------------------------------------------- /framework/modules/cluster-rabbit/src/main/java/group/idealworld/dew/core/cluster/spi/rabbit/SendBeforeFun.java: -------------------------------------------------------------------------------- 1 | package group.idealworld.dew.core.cluster.spi.rabbit; 2 | 3 | import com.rabbitmq.client.AMQP; 4 | 5 | /** 6 | * The interface Send before fun. 7 | * 8 | * @author gudaoxuri 9 | */ 10 | @FunctionalInterface 11 | public interface SendBeforeFun { 12 | 13 | /** 14 | * Invoke object. 15 | * 16 | * @param exchange the exchange 17 | * @param routingKey the routing key 18 | * @param messageProperties the message properties 19 | * @return the object 20 | */ 21 | Object invoke(String exchange, String routingKey, AMQP.BasicProperties messageProperties); 22 | 23 | } 24 | -------------------------------------------------------------------------------- /framework/modules/cluster-rabbit/src/main/java/group/idealworld/dew/core/cluster/spi/rabbit/SendErrorFun.java: -------------------------------------------------------------------------------- 1 | package group.idealworld.dew.core.cluster.spi.rabbit; 2 | 3 | /** 4 | * The interface Send error fun. 5 | * 6 | * @author gudaoxuri 7 | */ 8 | @FunctionalInterface 9 | public interface SendErrorFun { 10 | 11 | /** 12 | * Invoke. 13 | * 14 | * @param ex the ex 15 | * @param beforeResult the before result 16 | */ 17 | void invoke(Exception ex, Object beforeResult); 18 | 19 | } 20 | -------------------------------------------------------------------------------- /framework/modules/cluster-rabbit/src/main/java/group/idealworld/dew/core/cluster/spi/rabbit/SendFinishFun.java: -------------------------------------------------------------------------------- 1 | package group.idealworld.dew.core.cluster.spi.rabbit; 2 | 3 | /** 4 | * The interface Send finish fun. 5 | * 6 | * @author gudaoxuri 7 | */ 8 | @FunctionalInterface 9 | public interface SendFinishFun { 10 | 11 | /** 12 | * Invoke. 13 | * 14 | * @param beforeResult the before result 15 | */ 16 | void invoke(Object beforeResult); 17 | 18 | } 19 | -------------------------------------------------------------------------------- /framework/modules/cluster-rabbit/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports: -------------------------------------------------------------------------------- 1 | group.idealworld.dew.core.cluster.spi.rabbit.RabbitAutoConfiguration -------------------------------------------------------------------------------- /framework/modules/cluster-rabbit/src/test/resources/application.yml: -------------------------------------------------------------------------------- 1 | dew: 2 | cluster: 3 | mq: rabbit 4 | 5 | -------------------------------------------------------------------------------- /framework/modules/cluster-redis/src/main/java/group/idealworld/dew/core/cluster/spi/redis/MultiRedisConfig.java: -------------------------------------------------------------------------------- 1 | package group.idealworld.dew.core.cluster.spi.redis; 2 | 3 | import org.springframework.boot.autoconfigure.data.redis.RedisProperties; 4 | import org.springframework.boot.context.properties.ConfigurationProperties; 5 | 6 | import java.util.HashMap; 7 | import java.util.Map; 8 | 9 | /** 10 | * Multi redis config. 11 | * 12 | * @author gudaoxuri 13 | */ 14 | @ConfigurationProperties(prefix = "spring.data.redis") 15 | public class MultiRedisConfig { 16 | 17 | private Map multi = new HashMap<>(); 18 | 19 | /** 20 | * Gets multi. 21 | * 22 | * @return the multi 23 | */ 24 | public Map getMulti() { 25 | return multi; 26 | } 27 | 28 | /** 29 | * Sets multi. 30 | * 31 | * @param multi the multi 32 | */ 33 | public void setMulti(Map multi) { 34 | this.multi = multi; 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /framework/modules/cluster-redis/src/main/java/group/idealworld/dew/core/cluster/spi/redis/RedisClusterCacheWrap.java: -------------------------------------------------------------------------------- 1 | package group.idealworld.dew.core.cluster.spi.redis; 2 | 3 | import group.idealworld.dew.core.cluster.ClusterCache; 4 | import group.idealworld.dew.core.cluster.ClusterCacheWrap; 5 | import org.springframework.data.redis.core.RedisTemplate; 6 | 7 | import java.util.Map; 8 | import java.util.concurrent.ConcurrentHashMap; 9 | 10 | /** 11 | * 缓存服务多实例封装 Redis 实现. 12 | * 13 | * @author gudaoxuri 14 | */ 15 | public class RedisClusterCacheWrap implements ClusterCacheWrap { 16 | 17 | private static final ConcurrentHashMap CACHE_CONTAINER = new ConcurrentHashMap<>(); 18 | 19 | RedisClusterCacheWrap(Map> redisTemplates) { 20 | redisTemplates.forEach((k, v) -> CACHE_CONTAINER.put(k, new RedisClusterCache(v))); 21 | } 22 | 23 | @Override 24 | public ClusterCache instance(String key) { 25 | return CACHE_CONTAINER.get(key); 26 | } 27 | 28 | @Override 29 | public boolean exist(String key) { 30 | return CACHE_CONTAINER.contains(key); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /framework/modules/cluster-redis/src/main/java/group/idealworld/dew/core/cluster/spi/redis/RedisClusterLockWrap.java: -------------------------------------------------------------------------------- 1 | package group.idealworld.dew.core.cluster.spi.redis; 2 | 3 | import group.idealworld.dew.core.cluster.ClusterLock; 4 | import group.idealworld.dew.core.cluster.ClusterLockWrap; 5 | import org.springframework.data.redis.core.RedisTemplate; 6 | 7 | import java.util.concurrent.ConcurrentHashMap; 8 | 9 | /** 10 | * 分布式锁服务多实例封装 Redis 实现. 11 | * 12 | * @author gudaoxuri 13 | */ 14 | public class RedisClusterLockWrap implements ClusterLockWrap { 15 | 16 | private static final ConcurrentHashMap LOCK_CONTAINER = new ConcurrentHashMap<>(); 17 | 18 | private RedisTemplate redisTemplate; 19 | 20 | /** 21 | * Instantiates a new Redis cluster lock wrap. 22 | * 23 | * @param redisTemplate the redis template 24 | */ 25 | public RedisClusterLockWrap(RedisTemplate redisTemplate) { 26 | this.redisTemplate = redisTemplate; 27 | } 28 | 29 | @Override 30 | public ClusterLock instance(String key) { 31 | LOCK_CONTAINER.putIfAbsent(key, new RedisClusterLock(key, redisTemplate)); 32 | return LOCK_CONTAINER.get(key); 33 | } 34 | 35 | } 36 | -------------------------------------------------------------------------------- /framework/modules/cluster-redis/src/main/java/group/idealworld/dew/core/cluster/spi/redis/RedisClusterMapWrap.java: -------------------------------------------------------------------------------- 1 | package group.idealworld.dew.core.cluster.spi.redis; 2 | 3 | import group.idealworld.dew.core.cluster.ClusterMap; 4 | import group.idealworld.dew.core.cluster.ClusterMapWrap; 5 | import org.springframework.data.redis.core.RedisTemplate; 6 | 7 | import java.util.concurrent.ConcurrentHashMap; 8 | 9 | /** 10 | * 分布式Map服务多实例封装 Redis 实现. 11 | * 12 | * @author gudaoxuri 13 | */ 14 | public class RedisClusterMapWrap implements ClusterMapWrap { 15 | 16 | private static final ConcurrentHashMap MAP_CONTAINER = new ConcurrentHashMap<>(); 17 | 18 | private RedisTemplate redisTemplate; 19 | 20 | /** 21 | * Instantiates a new Redis cluster map wrap. 22 | * 23 | * @param redisTemplate the redis template 24 | */ 25 | public RedisClusterMapWrap(RedisTemplate redisTemplate) { 26 | this.redisTemplate = redisTemplate; 27 | } 28 | 29 | @Override 30 | public ClusterMap instance(String key, Class clazz) { 31 | MAP_CONTAINER.putIfAbsent(key, new RedisClusterMap<>(key, clazz, redisTemplate)); 32 | return MAP_CONTAINER.get(key); 33 | } 34 | 35 | } 36 | -------------------------------------------------------------------------------- /framework/modules/cluster-redis/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports: -------------------------------------------------------------------------------- 1 | group.idealworld.dew.core.cluster.spi.redis.RedisAutoConfiguration -------------------------------------------------------------------------------- /framework/modules/cluster-redis/src/test/resources/application.yml: -------------------------------------------------------------------------------- 1 | dew: 2 | cluster: 3 | cache: redis 4 | mq: redis 5 | lock: redis 6 | map: redis 7 | election: redis 8 | 9 | logging: 10 | level: 11 | ROOT: INFO 12 | group.idealworld.dew: TRACE 13 | -------------------------------------------------------------------------------- /framework/modules/cluster-rocket/src/main/java/group/idealworld/dew/core/cluster/spi/rocket/ReceiveBeforeFun.java: -------------------------------------------------------------------------------- 1 | package group.idealworld.dew.core.cluster.spi.rocket; 2 | 3 | import java.util.Map; 4 | 5 | @FunctionalInterface 6 | public interface ReceiveBeforeFun { 7 | 8 | Object invoke(String topic, Map properties); 9 | 10 | } 11 | -------------------------------------------------------------------------------- /framework/modules/cluster-rocket/src/main/java/group/idealworld/dew/core/cluster/spi/rocket/ReceiveErrorFun.java: -------------------------------------------------------------------------------- 1 | package group.idealworld.dew.core.cluster.spi.rocket; 2 | 3 | @FunctionalInterface 4 | public interface ReceiveErrorFun { 5 | 6 | /** 7 | * Invoke. 8 | * 9 | * @param ex the ex 10 | * @param beforeResult the before result 11 | */ 12 | void invoke(Exception ex, Object beforeResult); 13 | 14 | } 15 | -------------------------------------------------------------------------------- /framework/modules/cluster-rocket/src/main/java/group/idealworld/dew/core/cluster/spi/rocket/ReceiveFinishFun.java: -------------------------------------------------------------------------------- 1 | package group.idealworld.dew.core.cluster.spi.rocket; 2 | 3 | @FunctionalInterface 4 | public interface ReceiveFinishFun { 5 | 6 | /** 7 | * Invoke. 8 | * 9 | * @param beforeResult the before result 10 | */ 11 | void invoke(Object beforeResult); 12 | 13 | } 14 | -------------------------------------------------------------------------------- /framework/modules/cluster-rocket/src/main/java/group/idealworld/dew/core/cluster/spi/rocket/RocketAdapter.java: -------------------------------------------------------------------------------- 1 | package group.idealworld.dew.core.cluster.spi.rocket; 2 | 3 | import org.apache.rocketmq.client.producer.DefaultMQProducer; 4 | import org.apache.rocketmq.spring.core.RocketMQTemplate; 5 | 6 | /** 7 | * Rocket adapter. 8 | * 9 | * @author nipeixuan 10 | */ 11 | public class RocketAdapter { 12 | 13 | private final RocketMQTemplate rocketMQTemplate; 14 | 15 | /** 16 | * Instantiates a new Rabbit adapter. 17 | * 18 | * @param rocketMQTemplate the rabbit template 19 | */ 20 | public RocketAdapter(RocketMQTemplate rocketMQTemplate) { 21 | this.rocketMQTemplate = rocketMQTemplate; 22 | } 23 | 24 | DefaultMQProducer getProducer() { 25 | return rocketMQTemplate.getProducer(); 26 | } 27 | 28 | RocketMQTemplate getRocketMQTemplate() { 29 | return this.rocketMQTemplate; 30 | } 31 | 32 | } 33 | -------------------------------------------------------------------------------- /framework/modules/cluster-rocket/src/main/java/group/idealworld/dew/core/cluster/spi/rocket/SendBeforeFun.java: -------------------------------------------------------------------------------- 1 | package group.idealworld.dew.core.cluster.spi.rocket; 2 | 3 | import java.util.Map; 4 | 5 | @FunctionalInterface 6 | public interface SendBeforeFun { 7 | 8 | Object invoke(String topic, Map properties); 9 | 10 | } 11 | -------------------------------------------------------------------------------- /framework/modules/cluster-rocket/src/main/java/group/idealworld/dew/core/cluster/spi/rocket/SendErrorFun.java: -------------------------------------------------------------------------------- 1 | package group.idealworld.dew.core.cluster.spi.rocket; 2 | 3 | @FunctionalInterface 4 | public interface SendErrorFun { 5 | 6 | /** 7 | * Invoke. 8 | * 9 | * @param ex the ex 10 | * @param beforeResult the before result 11 | */ 12 | void invoke(Exception ex, Object beforeResult); 13 | 14 | } 15 | -------------------------------------------------------------------------------- /framework/modules/cluster-rocket/src/main/java/group/idealworld/dew/core/cluster/spi/rocket/SendFinishFun.java: -------------------------------------------------------------------------------- 1 | package group.idealworld.dew.core.cluster.spi.rocket; 2 | 3 | @FunctionalInterface 4 | public interface SendFinishFun { 5 | 6 | /** 7 | * Invoke. 8 | * 9 | * @param beforeResult the before result 10 | */ 11 | void invoke(Object beforeResult); 12 | 13 | } 14 | -------------------------------------------------------------------------------- /framework/modules/cluster-rocket/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports: -------------------------------------------------------------------------------- 1 | group.idealworld.dew.core.cluster.spi.rocket.RocketAutoConfiguration 2 | org.apache.rocketmq.spring.autoconfigure.RocketMQAutoConfiguration -------------------------------------------------------------------------------- /framework/modules/cluster-rocket/src/test/resources/application.yml: -------------------------------------------------------------------------------- 1 | dew: 2 | cluster: 3 | mq: rocket 4 | 5 | -------------------------------------------------------------------------------- /framework/modules/cluster-skywalking/src/main/java/group/idealworld/dew/core/cluster/spi/skywalking/SkyWalkingClusterTrace.java: -------------------------------------------------------------------------------- 1 | package group.idealworld.dew.core.cluster.spi.skywalking; 2 | 3 | import group.idealworld.dew.core.cluster.ClusterTrace; 4 | 5 | /** 6 | * Created on 2022/9/25. 7 | * 8 | * @author 迹_Jason 9 | */ 10 | 11 | public class SkyWalkingClusterTrace implements ClusterTrace { 12 | private final ThreadLocal TRACE_ID_STORAGE = new ThreadLocal<>(); 13 | 14 | @Override 15 | public void setTraceId(String traceId) { 16 | TRACE_ID_STORAGE.set(traceId); 17 | } 18 | 19 | @Override 20 | public void removeTraceId() { 21 | TRACE_ID_STORAGE.remove(); 22 | } 23 | 24 | @Override 25 | public String getTraceId() { 26 | return TRACE_ID_STORAGE.get(); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /framework/modules/cluster-skywalking/src/main/java/group/idealworld/dew/core/cluster/spi/skywalking/SkyWalkingTracingAutoConfiguration.java: -------------------------------------------------------------------------------- 1 | package group.idealworld.dew.core.cluster.spi.skywalking; 2 | 3 | import group.idealworld.dew.core.cluster.spi.skywalking.config.TraceInterceptorConfigurer; 4 | import group.idealworld.dew.core.cluster.ClusterTrace; 5 | import lombok.extern.slf4j.Slf4j; 6 | import org.springframework.context.annotation.Bean; 7 | import org.springframework.context.annotation.Configuration; 8 | 9 | import jakarta.annotation.PostConstruct; 10 | 11 | /** 12 | * Created on 2022/9/25. 13 | * 14 | * @author 迹_Jason 15 | */ 16 | @Slf4j 17 | @Configuration 18 | public class SkyWalkingTracingAutoConfiguration { 19 | 20 | @PostConstruct 21 | public void init() { 22 | log.info("Load Auto Configuration : {}", this.getClass().getName()); 23 | } 24 | 25 | @Bean 26 | public ClusterTrace skyWalkingClusterTrace() { 27 | return new SkyWalkingClusterTrace(); 28 | } 29 | 30 | @Bean 31 | public TraceInterceptorConfigurer traceInterceptorConfigurer(ClusterTrace clusterTrace) { 32 | return new TraceInterceptorConfigurer(clusterTrace); 33 | } 34 | 35 | } 36 | -------------------------------------------------------------------------------- /framework/modules/cluster-skywalking/src/main/java/group/idealworld/dew/core/cluster/spi/skywalking/config/TraceInterceptorConfigurer.java: -------------------------------------------------------------------------------- 1 | package group.idealworld.dew.core.cluster.spi.skywalking.config; 2 | 3 | import group.idealworld.dew.core.cluster.spi.skywalking.interceptor.TraceInterceptor; 4 | import group.idealworld.dew.core.cluster.ClusterTrace; 5 | import lombok.extern.slf4j.Slf4j; 6 | import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication; 7 | import org.springframework.web.servlet.config.annotation.InterceptorRegistry; 8 | import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; 9 | 10 | /** 11 | * @author yiye 12 | **/ 13 | @Slf4j 14 | @ConditionalOnWebApplication 15 | public class TraceInterceptorConfigurer implements WebMvcConfigurer { 16 | 17 | private final ClusterTrace clusterTrace; 18 | 19 | public TraceInterceptorConfigurer(ClusterTrace clusterTrace) { 20 | this.clusterTrace = clusterTrace; 21 | } 22 | 23 | @Override 24 | public void addInterceptors(InterceptorRegistry registry) { 25 | log.info("Enabled SkyWalking Tracing..."); 26 | registry.addInterceptor(new TraceInterceptor(clusterTrace)).addPathPatterns("/**").order(1); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /framework/modules/cluster-skywalking/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports: -------------------------------------------------------------------------------- 1 | group.idealworld.dew.core.cluster.spi.skywalking.SkyWalkingTracingAutoConfiguration -------------------------------------------------------------------------------- /framework/modules/dbutils-starter/src/main/java/group/idealworld/dew/core/dbutils/dialect/Dialect.java: -------------------------------------------------------------------------------- 1 | package group.idealworld.dew.core.dbutils.dialect; 2 | 3 | import java.sql.SQLException; 4 | import java.util.List; 5 | import java.util.Map; 6 | 7 | public interface Dialect { 8 | 9 | String paging(String sql, long pageNumber, long pageSize) throws SQLException; 10 | 11 | String count(String sql) throws SQLException; 12 | 13 | String getTableInfo(String tableName) throws SQLException; 14 | 15 | @Deprecated 16 | String createTableIfNotExist(String tableName, String tableDesc, Map fields, 17 | Map fieldsDesc, List indexFields, 18 | List uniqueFields, String pkField) throws SQLException; 19 | 20 | String validationQuery(); 21 | 22 | String getDriver(); 23 | 24 | DialectType getDialectType(); 25 | } 26 | -------------------------------------------------------------------------------- /framework/modules/dbutils-starter/src/main/java/group/idealworld/dew/core/dbutils/dialect/DialectFactory.java: -------------------------------------------------------------------------------- 1 | package group.idealworld.dew.core.dbutils.dialect; 2 | 3 | public class DialectFactory { 4 | 5 | private DialectFactory() { 6 | } 7 | 8 | public static Dialect parseDialect(String url) { 9 | if (url.startsWith("jdbc:mysql")) { 10 | return new MySQLDialect(); 11 | } else if (url.startsWith("jdbc:postgresql")) { 12 | return new PostgresDialect(); 13 | } else if (url.startsWith("jdbc:hive2")) { 14 | return new HiveDialect(); 15 | } 16 | return null; 17 | } 18 | 19 | } 20 | -------------------------------------------------------------------------------- /framework/modules/dbutils-starter/src/main/java/group/idealworld/dew/core/dbutils/dialect/DialectType.java: -------------------------------------------------------------------------------- 1 | package group.idealworld.dew.core.dbutils.dialect; 2 | 3 | public enum DialectType { 4 | 5 | MYSQL, POSTGRE, HIVE 6 | 7 | } 8 | -------------------------------------------------------------------------------- /framework/modules/dbutils-starter/src/main/java/group/idealworld/dew/core/dbutils/dto/DBUtilsConfig.java: -------------------------------------------------------------------------------- 1 | package group.idealworld.dew.core.dbutils.dto; 2 | 3 | import lombok.Data; 4 | import org.springframework.boot.context.properties.ConfigurationProperties; 5 | 6 | import java.util.ArrayList; 7 | import java.util.List; 8 | 9 | /** 10 | * 配置类 11 | * 12 | * @author gudaoxuri 13 | */ 14 | @ConfigurationProperties(prefix = "ds") 15 | @Data 16 | public class DBUtilsConfig { 17 | 18 | private List ds = new ArrayList<>(); 19 | private DynamicDS dynamicDS = new DynamicDS(); 20 | 21 | @Data 22 | public static class DynamicDS { 23 | 24 | private Boolean enabled = false; 25 | private String dsCode; 26 | private String fetchSql = "select code,url,username,password,monitor,pool_initialSize,pool_maxActive from multi_ds"; 27 | 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /framework/modules/dbutils-starter/src/main/java/group/idealworld/dew/core/dbutils/dto/DSConfig.java: -------------------------------------------------------------------------------- 1 | package group.idealworld.dew.core.dbutils.dto; 2 | 3 | import lombok.Builder; 4 | import lombok.Data; 5 | import lombok.experimental.Tolerate; 6 | 7 | /** 8 | * @author gudaoxuri 9 | */ 10 | @Data 11 | @Builder 12 | public class DSConfig { 13 | 14 | private String code; 15 | private String url; 16 | private String username; 17 | private String password; 18 | @Builder.Default 19 | private Boolean monitor = false; 20 | @Builder.Default 21 | private PoolConfig pool = new PoolConfig(); 22 | 23 | @Data 24 | @Builder 25 | public static class PoolConfig { 26 | 27 | @Builder.Default 28 | private Integer initialSize = 5; 29 | @Builder.Default 30 | private Integer maxActive = 20; 31 | 32 | @Tolerate 33 | public PoolConfig() { 34 | } 35 | 36 | } 37 | 38 | @Tolerate 39 | public DSConfig() { 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /framework/modules/dbutils-starter/src/main/java/group/idealworld/dew/core/dbutils/dto/Meta.java: -------------------------------------------------------------------------------- 1 | package group.idealworld.dew.core.dbutils.dto; 2 | 3 | import lombok.Data; 4 | 5 | @Data 6 | public class Meta { 7 | 8 | private int type; 9 | private String code; 10 | private String label; 11 | 12 | public Meta(int type, String code, String label) { 13 | this.type = type; 14 | this.code = code; 15 | this.label = label; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /framework/modules/dbutils-starter/src/main/java/group/idealworld/dew/core/dbutils/dto/Page.java: -------------------------------------------------------------------------------- 1 | package group.idealworld.dew.core.dbutils.dto; 2 | 3 | import lombok.Data; 4 | 5 | import java.util.List; 6 | 7 | /** 8 | * 分页辅助类. 9 | * 10 | * @param 实体类型 11 | * @author gudaoxuri 12 | */ 13 | @Data 14 | public class Page { 15 | 16 | // start with 1 17 | private long pageNumber; 18 | private long pageSize; 19 | private long pageTotal; 20 | private long recordTotal; 21 | private List objects; 22 | 23 | } 24 | -------------------------------------------------------------------------------- /framework/modules/dbutils-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports: -------------------------------------------------------------------------------- 1 | group.idealworld.dew.core.dbutils.dto.DBUtilsConfig -------------------------------------------------------------------------------- /framework/modules/dbutils-starter/src/main/resources/application.yml: -------------------------------------------------------------------------------- 1 | ds: 2 | ds[0]: 3 | code: default 4 | url: jdbc:mysql://127.0.0.1:3306/test?useUnicode=true&characterEncoding=utf-8 5 | username: test 6 | password: test 7 | monitor: true 8 | pool: 9 | initialSize: 0 10 | maxActive: 8 11 | dynamicDS: 12 | dsCode: default 13 | enabled: false 14 | fetchSql: select code,url,username,password,monitor,pool_initialSize,pool_maxActive from multi_ds 15 | -------------------------------------------------------------------------------- /framework/modules/dbutils-starter/src/test/java/group/idealworld/dew/core/dbutils/DBUtilsApplication.java: -------------------------------------------------------------------------------- 1 | package group.idealworld.dew.core.dbutils; 2 | 3 | import org.springframework.boot.autoconfigure.SpringBootApplication; 4 | import org.springframework.boot.builder.SpringApplicationBuilder; 5 | 6 | /** 7 | * @author rpf 8 | * @version 1.0 9 | * @date 2024/1/9 18:27 10 | */ 11 | @SpringBootApplication 12 | public class DBUtilsApplication { 13 | 14 | /** 15 | * The entry point of application. 16 | * 17 | * @param args the input arguments 18 | */ 19 | public static void main(String[] args) { 20 | new SpringApplicationBuilder(DBUtilsApplication.class).run(args); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /framework/modules/dbutils-starter/src/test/java/group/idealworld/dew/core/dbutils/User.java: -------------------------------------------------------------------------------- 1 | package group.idealworld.dew.core.dbutils; 2 | 3 | import lombok.Data; 4 | 5 | import java.math.BigDecimal; 6 | import java.util.Date; 7 | 8 | @Data 9 | public class User { 10 | 11 | private long id; 12 | private String name; 13 | private String password; 14 | private int age; 15 | private float height1; 16 | private double height2; 17 | private Date createTime; 18 | private BigDecimal asset; 19 | private String txt; 20 | private boolean enable; 21 | 22 | } 23 | -------------------------------------------------------------------------------- /framework/modules/dbutils-starter/src/test/resources/application.yml: -------------------------------------------------------------------------------- 1 | ds: 2 | ds[0]: 3 | code: default 4 | url: jdbc:mysql://127.0.0.1:3306/test?useUnicode=true&characterEncoding=utf-8 5 | username: test 6 | password: test 7 | monitor: true 8 | pool: 9 | initialSize: 0 10 | maxActive: 8 11 | ds[1]: 12 | code: postgresql 13 | url: jdbc:postgresql://127.0.0.1:5432/test?useUnicode=true&characterEncoding=utf-8 14 | username: test 15 | password: test 16 | monitor: true 17 | pool: 18 | initialSize: 0 19 | maxActive: 8 20 | dynamicDS: 21 | dsCode: default 22 | enabled: false 23 | fetchSql: select code,url,username,password,monitor,pool_initialSize,pool_maxActive from multi_ds -------------------------------------------------------------------------------- /framework/modules/hbase-starter/src/main/java/group/idealworld/dew/core/hbase/HBaseRunTimeException.java: -------------------------------------------------------------------------------- 1 | package group.idealworld.dew.core.hbase; 2 | 3 | /** 4 | * The spring boot hbase cause error while run time. 5 | * 6 | * @author 迹_Jason 7 | */ 8 | public class HBaseRunTimeException extends RuntimeException { 9 | 10 | /** 11 | * Init the spring boot hbase exception. 12 | * 13 | * @param cause throwable 14 | */ 15 | public HBaseRunTimeException(Throwable cause) { 16 | super(cause); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /framework/modules/hbase-starter/src/main/java/group/idealworld/dew/core/hbase/MutatorCallback.java: -------------------------------------------------------------------------------- 1 | package group.idealworld.dew.core.hbase; 2 | 3 | import org.apache.hadoop.hbase.client.BufferedMutator; 4 | 5 | /** 6 | * Mutator action interface. 7 | * 8 | * @author 迹_Jason 9 | */ 10 | @FunctionalInterface 11 | public interface MutatorCallback { 12 | 13 | /** 14 | * Mutator action function. 15 | * 16 | * @param mutator mutator 17 | * @throws Throwable Throwable exception 18 | */ 19 | void doInMutator(BufferedMutator mutator) throws Throwable; 20 | } 21 | -------------------------------------------------------------------------------- /framework/modules/hbase-starter/src/main/java/group/idealworld/dew/core/hbase/RowMapper.java: -------------------------------------------------------------------------------- 1 | package group.idealworld.dew.core.hbase; 2 | 3 | import org.apache.hadoop.hbase.client.Result; 4 | 5 | /** 6 | * The row mapper of the data that hbase data. 7 | * 8 | * @param the type parameter 9 | * @author 迹_Jason 10 | */ 11 | @FunctionalInterface 12 | public interface RowMapper { 13 | 14 | /** 15 | * The row action function. 16 | * 17 | * @param result hbase data 18 | * @param rowNum row number 19 | * @return T hope return object. 20 | * @throws Exception exception 21 | */ 22 | T mapRow(Result result, int rowNum) throws Exception; 23 | } 24 | -------------------------------------------------------------------------------- /framework/modules/hbase-starter/src/main/java/group/idealworld/dew/core/hbase/TableCallback.java: -------------------------------------------------------------------------------- 1 | package group.idealworld.dew.core.hbase; 2 | 3 | import org.apache.hadoop.hbase.client.Table; 4 | 5 | /** 6 | * The hbase table action. 7 | * 8 | * @param the type parameter 9 | * @author 迹_Jason 10 | */ 11 | @FunctionalInterface 12 | public interface TableCallback { 13 | /** 14 | * The hbase table action function. 15 | * 16 | * @param table table object 17 | * @return hope return object 18 | * @throws Throwable exception 19 | */ 20 | T doInTable(Table table) throws Throwable; 21 | } 22 | -------------------------------------------------------------------------------- /framework/modules/hbase-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports: -------------------------------------------------------------------------------- 1 | group.idealworld.dew.core.hbase.HBaseAutoConfiguration -------------------------------------------------------------------------------- /framework/modules/hbase-starter/src/test/resources/application.yml: -------------------------------------------------------------------------------- 1 | dew: 2 | cluster: 3 | cache: redis 4 | mq: redis 5 | lock: redis 6 | map: redis 7 | election: redis 8 | 9 | spring: 10 | redis: 11 | host: 127.0.0.1 12 | port: 6379 13 | multi: 14 | auth: 15 | host: 127.0.0.1 16 | port: 6379 17 | database: 10 18 | hbase: 19 | zkQuorum: 20 | znodeParent: /hbase-secure 21 | auth: 22 | type: kerberos 23 | principal: 24 | keytab: 25 | hbaseMasterPrincipal: 26 | hbaseRegionServerPrincipal: -------------------------------------------------------------------------------- /framework/modules/idempotent-starter/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 4.0.0 6 | 7 | 8 | group.idealworld.dew 9 | parent-starter 10 | 3.0.0-rc.8 11 | ../parent-starter 12 | 13 | 14 | idempotent-starter 15 | 1.2.3 Dew Idempotent Starter 16 | 幂等功能 17 | jar 18 | 19 | 20 | 21 | group.idealworld.dew 22 | boot-starter 23 | 24 | 25 | group.idealworld.dew 26 | cluster-spi-redis 27 | 28 | 29 | group.idealworld.dew 30 | test-starter 31 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /framework/modules/idempotent-starter/src/main/java/group/idealworld/dew/idempotent/annotations/Idempotent.java: -------------------------------------------------------------------------------- 1 | package group.idealworld.dew.idempotent.annotations; 2 | 3 | import group.idealworld.dew.idempotent.strategy.StrategyEnum; 4 | 5 | import java.lang.annotation.ElementType; 6 | import java.lang.annotation.Retention; 7 | import java.lang.annotation.RetentionPolicy; 8 | import java.lang.annotation.Target; 9 | 10 | /** 11 | * The interface Idempotent. 12 | * 13 | * @author gudaoxuri 14 | */ 15 | @Retention(RetentionPolicy.RUNTIME) 16 | @Target(ElementType.METHOD) 17 | public @interface Idempotent { 18 | 19 | /** 20 | * 指定幂等操作ID标识,可以位于HTTP Header或请求参数中. 21 | * 22 | * @return 设置的幂等操作ID标识 23 | */ 24 | String optIdFlag() default ""; 25 | 26 | /** 27 | * 设置过期时间,单位毫秒. 28 | * 29 | * @return 设置的过期时间 30 | */ 31 | long expireMs() default 1000 * 60 * 60; 32 | 33 | /** 34 | * 设置默认策略. 35 | * 36 | * @return 设置的策略 37 | */ 38 | StrategyEnum strategy() default StrategyEnum.AUTO; 39 | 40 | /** 41 | * 设置是否需要显式确认. 42 | * 43 | * @return 是否需要确认 44 | */ 45 | boolean needConfirm() default true; 46 | 47 | } 48 | -------------------------------------------------------------------------------- /framework/modules/idempotent-starter/src/main/java/group/idealworld/dew/idempotent/interceptor/IdempotentException.java: -------------------------------------------------------------------------------- 1 | package group.idealworld.dew.idempotent.interceptor; 2 | 3 | /** 4 | * Idempotent exception. 5 | * 6 | * @author gudaoxuri 7 | */ 8 | public class IdempotentException extends RuntimeException { 9 | 10 | /** 11 | * Instantiates a new Idempotent exception. 12 | * 13 | * @param message the message 14 | */ 15 | public IdempotentException(String message) { 16 | super(message); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /framework/modules/idempotent-starter/src/main/java/group/idealworld/dew/idempotent/strategy/BloomFilterProcessor.java: -------------------------------------------------------------------------------- 1 | package group.idealworld.dew.idempotent.strategy; 2 | 3 | import group.idealworld.dew.core.cluster.exception.NotImplementedException; 4 | 5 | /** 6 | * Bloom filter processor. 7 | * 8 | * @author gudaoxuri 9 | */ 10 | public class BloomFilterProcessor implements IdempotentProcessor { 11 | 12 | @Override 13 | public StatusEnum process(String optType, String optId, StatusEnum initStatus, long expireMs) { 14 | throw new NotImplementedException(); 15 | } 16 | 17 | @Override 18 | public boolean confirm(String optType, String optId) { 19 | throw new NotImplementedException(); 20 | } 21 | 22 | @Override 23 | public boolean cancel(String optType, String optId) { 24 | throw new NotImplementedException(); 25 | } 26 | 27 | } 28 | -------------------------------------------------------------------------------- /framework/modules/idempotent-starter/src/main/java/group/idealworld/dew/idempotent/strategy/IdempotentProcessor.java: -------------------------------------------------------------------------------- 1 | package group.idealworld.dew.idempotent.strategy; 2 | 3 | /** 4 | * The interface Idempotent processor. 5 | * 6 | * @author gudaoxuri 7 | */ 8 | public interface IdempotentProcessor { 9 | 10 | /** 11 | * Process status enum. 12 | * 13 | * @param optType the opt type 14 | * @param optId the opt id 15 | * @param initStatus the init status 16 | * @param expireMs the expire ms 17 | * @return the status enum 18 | */ 19 | StatusEnum process(String optType, String optId, StatusEnum initStatus, long expireMs); 20 | 21 | /** 22 | * Confirm boolean. 23 | * 24 | * @param optType the opt type 25 | * @param optId the opt id 26 | * @return the boolean 27 | */ 28 | boolean confirm(String optType, String optId); 29 | 30 | /** 31 | * Cancel boolean. 32 | * 33 | * @param optType the opt type 34 | * @param optId the opt id 35 | * @return the boolean 36 | */ 37 | boolean cancel(String optType, String optId); 38 | 39 | } 40 | -------------------------------------------------------------------------------- /framework/modules/idempotent-starter/src/main/java/group/idealworld/dew/idempotent/strategy/StatusEnum.java: -------------------------------------------------------------------------------- 1 | package group.idealworld.dew.idempotent.strategy; 2 | 3 | /** 4 | * Status enum. 5 | * 6 | * @author gudaoxuri 7 | */ 8 | public enum StatusEnum { 9 | 10 | /** 11 | * Not exist status enum. 12 | */ 13 | NOT_EXIST("NOT_EXIST"), 14 | /** 15 | * Un confirm status enum. 16 | */ 17 | UN_CONFIRM("UN_CONFIRM"), 18 | /** 19 | * Confirmed status enum. 20 | */ 21 | CONFIRMED("CONFIRMED"); 22 | 23 | private String value; 24 | 25 | StatusEnum(String value) { 26 | this.value = value; 27 | } 28 | 29 | @Override 30 | public String toString() { 31 | return String.valueOf(value); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /framework/modules/idempotent-starter/src/main/java/group/idealworld/dew/idempotent/strategy/StrategyEnum.java: -------------------------------------------------------------------------------- 1 | package group.idealworld.dew.idempotent.strategy; 2 | 3 | /** 4 | * Strategy enum. 5 | * 6 | * @author gudaoxuri 7 | */ 8 | public enum StrategyEnum { 9 | 10 | /** 11 | * Item strategy enum. 12 | */ 13 | ITEM("item"), 14 | /** 15 | * Bloom flter strategy enum. 16 | */ 17 | BLOOM_FLTER("bloom"), 18 | /** 19 | * Auto strategy enum. 20 | */ 21 | AUTO("auto"); 22 | 23 | private String value; 24 | 25 | StrategyEnum(String value) { 26 | this.value = value; 27 | } 28 | 29 | @Override 30 | public String toString() { 31 | return String.valueOf(value); 32 | } 33 | 34 | } 35 | -------------------------------------------------------------------------------- /framework/modules/idempotent-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports: -------------------------------------------------------------------------------- 1 | group.idealworld.dew.idempotent.interceptor.IdempotentWebAutoConfiguration -------------------------------------------------------------------------------- /framework/modules/idempotent-starter/src/test/java/group/idealworld/dew/idempotent/IdempotentApplication.java: -------------------------------------------------------------------------------- 1 | package group.idealworld.dew.idempotent; 2 | 3 | import org.springframework.boot.autoconfigure.SpringBootApplication; 4 | import org.springframework.boot.builder.SpringApplicationBuilder; 5 | 6 | /** 7 | * Idempotent application. 8 | * 9 | * @author gudaoxuri 10 | */ 11 | @SpringBootApplication 12 | public class IdempotentApplication { 13 | /** 14 | * The entry point of application. 15 | * 16 | * @param args the input arguments 17 | */ 18 | public static void main(String[] args) { 19 | new SpringApplicationBuilder(IdempotentApplication.class).run(args); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /framework/modules/idempotent-starter/src/test/resources/application.yml: -------------------------------------------------------------------------------- 1 | dew: 2 | cluster: 3 | cache: redis 4 | spring: 5 | application: 6 | name: Idempotent-test 7 | -------------------------------------------------------------------------------- /framework/modules/ossutils-starter/src/main/java/group/idealworld/dew/ossutils/config/OssUtilsAutoConfiguration.java: -------------------------------------------------------------------------------- 1 | package group.idealworld.dew.ossutils.config; 2 | 3 | 4 | import group.idealworld.dew.ossutils.utils.OssClientUtil; 5 | import group.idealworld.dew.ossutils.constants.OssTypeEnum; 6 | import group.idealworld.dew.ossutils.general.DewOssClient; 7 | import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication; 8 | import org.springframework.boot.context.properties.EnableConfigurationProperties; 9 | import org.springframework.context.annotation.Bean; 10 | import org.springframework.context.annotation.Configuration; 11 | 12 | /** 13 | * @author yiye 14 | **/ 15 | @Configuration 16 | @ConditionalOnWebApplication 17 | @EnableConfigurationProperties(OssConfigProperties.class) 18 | public class OssUtilsAutoConfiguration { 19 | @Bean 20 | public DewOssClient initOssClient(OssConfigProperties ossConfigProperties) { 21 | if (!OssTypeEnum.contains(ossConfigProperties.getOssType())) { 22 | throw new IllegalArgumentException("ossType is not support,expect:oss,obs,minio"); 23 | } 24 | return OssClientUtil.init(ossConfigProperties); 25 | } 26 | 27 | 28 | } 29 | -------------------------------------------------------------------------------- /framework/modules/ossutils-starter/src/main/java/group/idealworld/dew/ossutils/constants/OssTypeEnum.java: -------------------------------------------------------------------------------- 1 | package group.idealworld.dew.ossutils.constants; 2 | 3 | /** 4 | * @author yiye 5 | */ 6 | public enum OssTypeEnum { 7 | /** 8 | * 支持oss类型 9 | */ 10 | OSS("oss"), 11 | OBS("obs"), 12 | MINIO("minio"); 13 | 14 | private String code; 15 | 16 | OssTypeEnum(String name) { 17 | this.code = name; 18 | } 19 | 20 | public String getCode() { 21 | return code; 22 | } 23 | 24 | public void setCode(String code) { 25 | this.code = code; 26 | } 27 | 28 | public static boolean contains(String code) { 29 | for (OssTypeEnum ossTypeEnum : OssTypeEnum.values()) { 30 | if (ossTypeEnum.getCode().equals(code)) { 31 | return true; 32 | } 33 | } 34 | return false; 35 | } 36 | 37 | 38 | } 39 | -------------------------------------------------------------------------------- /framework/modules/ossutils-starter/src/main/java/group/idealworld/dew/ossutils/general/OssClientInitProcess.java: -------------------------------------------------------------------------------- 1 | package group.idealworld.dew.ossutils.general; 2 | 3 | import group.idealworld.dew.ossutils.config.OssConfigProperties; 4 | 5 | /** 6 | * @author yiye 7 | */ 8 | public interface OssClientInitProcess { 9 | /** 10 | * 初始化原始客户端 11 | * 12 | * @param config 配置 13 | * @return 是否初始化成功 14 | */ 15 | boolean initClient(OssConfigProperties config); 16 | } 17 | -------------------------------------------------------------------------------- /framework/modules/ossutils-starter/src/main/java/group/idealworld/dew/ossutils/handle/DewOssHandleClient.java: -------------------------------------------------------------------------------- 1 | package group.idealworld.dew.ossutils.handle; 2 | 3 | 4 | /** 5 | * @param 客户端类型 6 | * @author yiye 7 | **/ 8 | public class DewOssHandleClient { 9 | private T ossClient; 10 | 11 | public T getOssClient() { 12 | return this.ossClient; 13 | } 14 | 15 | public void setOssClient(T ossClient) { 16 | this.ossClient = ossClient; 17 | } 18 | 19 | } 20 | -------------------------------------------------------------------------------- /framework/modules/ossutils-starter/src/main/java/group/idealworld/dew/ossutils/utils/OssClientUtil.java: -------------------------------------------------------------------------------- 1 | package group.idealworld.dew.ossutils.utils; 2 | 3 | import group.idealworld.dew.ossutils.config.OssConfigProperties; 4 | import group.idealworld.dew.ossutils.general.DewOssClient; 5 | 6 | /** 7 | * @author yiye 8 | **/ 9 | public class OssClientUtil { 10 | 11 | private static final ThreadLocal OSS_CLIENT_THREAD_LOCAL = new ThreadLocal<>(); 12 | 13 | private OssClientUtil() { 14 | } 15 | 16 | public static Object getOssClient() { 17 | return OSS_CLIENT_THREAD_LOCAL.get(); 18 | } 19 | 20 | public static void setOssClient(Object ossClient) { 21 | OSS_CLIENT_THREAD_LOCAL.set(ossClient); 22 | } 23 | 24 | public static void removeOssClient() { 25 | if (OSS_CLIENT_THREAD_LOCAL.get() != null) { 26 | OSS_CLIENT_THREAD_LOCAL.remove(); 27 | } 28 | } 29 | 30 | public static DewOssClient init(OssConfigProperties ossConfigProperties) { 31 | return new DewOssClient(ossConfigProperties); 32 | } 33 | 34 | 35 | } 36 | -------------------------------------------------------------------------------- /framework/modules/ossutils-starter/src/main/java/group/idealworld/dew/ossutils/utils/OssHandleException.java: -------------------------------------------------------------------------------- 1 | package group.idealworld.dew.ossutils.utils; 2 | 3 | import group.idealworld.dew.ossutils.bean.OssCommonParam; 4 | import org.springframework.util.StringUtils; 5 | 6 | /** 7 | * @author yiye 8 | */ 9 | public class OssHandleException { 10 | 11 | private OssHandleException() { 12 | } 13 | 14 | public static void isNull(OssCommonParam param) { 15 | if (param == null) { 16 | throw new IllegalArgumentException("param必要参数不能为空"); 17 | } 18 | if (!StringUtils.hasLength(param.getBucketName()) || !StringUtils.hasLength(param.getObjectName())) { 19 | throw new IllegalArgumentException("操作对象存储服务器必要参数不能为空"); 20 | } 21 | } 22 | 23 | public static void isExpirationNull(OssCommonParam param) { 24 | isNull(param); 25 | if (param.getExpiration() == null || param.getExpiration() <= 0) { 26 | throw new IllegalArgumentException("expiration不能为空"); 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /framework/modules/ossutils-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports: -------------------------------------------------------------------------------- 1 | group.idealworld.dew.ossutils.config.OssUtilsAutoConfiguration 2 | -------------------------------------------------------------------------------- /framework/modules/test-starter/src/main/resources/mosquitto.conf: -------------------------------------------------------------------------------- 1 | allow_anonymous true 2 | bind_address 0.0.0.0 -------------------------------------------------------------------------------- /pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 4.0.0 6 | 7 | group.idealworld.dew 8 | build 9 | 0 Dew Build 10 | pom 11 | 3.0.0-rc.8 12 | 13 | 14 | UTF-8 15 | ${project.build.sourceEncoding} 16 | ${project.build.sourceEncoding} 17 | 18 | true 19 | true 20 | 21 | 22 | 23 | framework 24 | 25 | examples 26 | docs 27 | 28 | 29 | --------------------------------------------------------------------------------