vip saturn task scheduler uses: saturn upgrade to support sb2.x feeds

Wechat Public Number: Architect Front Line
Original Statement: This article is originally created by the author. It refuses unauthorized reprinting of personal, media, public numbers or websites. Violators shall be held liable.

Catalog

Article directory


vip saturn is an open source task scheduling platform that supports multi-language end task development. However, some details are not well handled. For example, although spring boot 1.x has stopped maintenance, vip saturn commiter has not yet supported sb 2.x. At present, I see some shortcomings of saturn from the production practice:

  1. The latest version of saturn 3.3.1 only supports spring boot 1.x, not 2.x.
  2. The network card name in executor must contain eth0 string problem, in fact, it can be fine-tuned to support the specified network card.
  3. Whether it is java stack or shell stack, executor instance deployment flexibility is poor, each company's CI/CD processes are particularly different, saturn packaging is too restrictive, flexible support mechanism is poor.
  4. Package deployment is an executable jar package approach, which is not conducive to incremental upgrades.
  5. Configuration files are not yet directly accessible to apollo.
  6. Many dependencies on toolkit versions are too low to be updated to the latest stable versions in real time.
  7. The way of embedded job is more in line with R&D's understanding of job.

... Wait a minute.
In the process of using saturn, based on version 3.3.1, I have made some adjustments to these small problems in the company. Personally, I think it will be easier to use saturn, especially for novices. Hope to help more plans to use Saturn coder.

This article will record some of the local adjustments involved when saturn upgrades support sb 2.x.

I. Adjusting Details

1.0 saturn-job project adjustment

In the pom.xml file:

<gson.version>2.5</gson.version> 
<springframework.version>4.3.2.RELEASE</springframework.version>
<spring-boot-test.version>1.5.3.RELEASE</spring-boot-test.version>
<spring.data.commons.version>1.13.16.RELEASE</spring.data.commons.version>
<druid.version>0.2.9</druid.version>

<!--Adjusted to:-->
<gson.version>2.6.2</gson.version>
<springframework.version>5.1.8.RELEASE</springframework.version>
<spring-boot-test.version>2.1.6.RELEASE</spring-boot-test.version>
<spring.data.commons.version>2.1.10.RELEASE</spring.data.commons.version>
<druid.version>1.1.19</druid.version>

Add the following dependency packages:

<dependency>
   <groupId>ch.qos.logback</groupId>
   <artifactId>logback-core</artifactId>
   <version>${logback.version}</version>
</dependency>

Delete:

<javaee-web-api.version>7.0</javaee-web-api.version>
<dependency>
    <groupId>javax</groupId>
    <artifactId>javaee-web-api</artifactId>
    <version>${javaee-web-api.version}</version>
    <!--<scope>provided</scope> -->
</dependency>

Adjust druid:

<dependency>
   <groupId>com.alibaba.druid</groupId>
   <artifactId>druid-wrapper</artifactId>
   <version>${druid.version}</version>
</dependency>

<!--Adjusted to:-->
<dependency>
   <groupId>com.alibaba</groupId>
   <artifactId>druid</artifactId>
   <version>${druid.version}</version>
</dependency>

1.1 saturn-console-api subproject adjustment

In the pom.xml file:

Change the spring-boot-dependencies dependencies package version from 1.4.x to 2.x, for example, to 2.1.6.RELEASE;

Remove the following dependency packages:

<dependency>
   <groupId>org.springframework.cloud</groupId>
   <artifactId>spring-cloud-starter</artifactId>
   <version>1.1.1.RELEASE</version>
   <exclusions>
      <exclusion>
         <artifactId>logback-classic</artifactId>
         <groupId>ch.qos.logback</groupId>
      </exclusion>
   </exclusions>
</dependency>

<dependency>
   <groupId>com.fasterxml.jackson.core</groupId>
   <artifactId>jackson-databind</artifactId>
</dependency>

<dependency>
   <groupId>org.springframework</groupId>
   <artifactId>springloaded</artifactId>
   <scope>provided</scope>
</dependency>

<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-tomcat</artifactId>
    <scope>provided</scope>
</dependency>

<dependency>
     <groupId>ch.qos.logback</groupId>
     <artifactId>logback-core</artifactId>
</dependency>

Add the following dependency packages:

<dependency>
  <groupId>ch.qos.logback</groupId>
  <artifactId>logback-classic</artifactId>
</dependency>

druid adjustment:

<dependency>
    <groupId>com.alibaba.druid</groupId>
    <artifactId>druid-wrapper</artifactId>
</dependency>

<!--Adjusted to:-->
<dependency>
   <groupId>com.alibaba</groupId>
   <artifactId>druid</artifactId>
</dependency>

The getOffset return value type in the PageableUtil class is changed from int to long. When the getJobSubListByPage method in the corresponding JobOverview Controller calls getOffset, it needs to be forced to int.

1.2 saturn-core sub-project adjustment

Remove:

<dependency>
   <groupId>ch.qos.logback</groupId>
   <artifactId>logback-core</artifactId>
</dependency>

1.3 saturn-it sub-project adjustment

spring-boot-dependencies adjustment:

<dependencyManagement>
   <dependencies>
      <dependency>
         <!-- Import dependency management from Spring Boot -->
         <groupId>org.springframework.boot</groupId>
         <artifactId>spring-boot-dependencies</artifactId>
         <version>1.4.0.RELEASE</version>
         <type>pom</type>
         <scope>import</scope>
      </dependency>
   </dependencies>
</dependencyManagement>

<!--Adjusted to:-->
<dependencyManagement>
   <dependencies>
      <dependency>
         <!-- Import dependency management from Spring Boot -->
         <groupId>org.springframework.boot</groupId>
         <artifactId>spring-boot-dependencies</artifactId>
         <version>2.1.6.RELEASE</version>
         <type>pom</type>
         <scope>import</scope>
         <exclusions>
            <exclusion>
               <groupId>ch.qos.logback</groupId>
               <artifactId>logback-classic</artifactId>
            </exclusion>
            <exclusion>
               <groupId>ch.qos.logback</groupId>
               <artifactId>logback-core</artifactId>
            </exclusion>
         </exclusions>
      </dependency>
   </dependencies>

</dependencyManagement>

Delete:

<dependency>
   <groupId>ch.qos.logback</groupId>
   <artifactId>logback-core</artifactId>
   <version>${logback.version}</version>
</dependency>

logback-classic adjustment:

<dependency>
    <groupId>ch.qos.logback</groupId>
    <artifactId>logback-classic</artifactId>
</dependency>

<!--Adjusted to:-->
<dependency>
    <groupId>ch.qos.logback</groupId>
    <artifactId>logback-classic</artifactId>
    <version>${logback.version}</version>
</dependency>

1.4 Saturn-demo-spring boot sub-project adjustment

Change the version number of spring-boot-starter-parent to 2.1.6.RELEASE
Rewrite the main function of the Application class to read as follows:

public static void main(String[] args) {
        SpringApplication.run(Application.class, args);
    }

1.5 Saturn-demo-spring boot-embedded subproject adjustment

Change the version number of spring-boot-starter-parent to 2.1.6.RELEASE

1.6 Saturn-job-sharing sub-project adjustment

Remove:

<dependency>
    <groupId>ch.qos.logback</groupId>
    <artifactId>logback-core</artifactId>
</dependency>

1.7 saturn-console sub-project adjustment

Remove:

<dependency>
   <groupId>org.springframework.boot</groupId>
   <artifactId>spring-boot-starter-tomcat</artifactId>
   <!--<scope>provided</scope> -->
</dependency>

<dependency>
   <groupId>javax.servlet</groupId>
   <artifactId>javax.servlet-api</artifactId>
</dependency>

<dependency>
    <groupId>javax</groupId>
    <artifactId>javaee-web-api</artifactId>
</dependency>

Increase:

<dependency>
    <groupId>ch.qos.logback</groupId>
    <artifactId>logback-classic</artifactId>
</dependency>

spring-boot-maven-plugin adjustment

<plugin>
     <groupId>org.springframework.boot</groupId>
     <artifactId>spring-boot-maven-plugin</artifactId>
     <version>1.4.0.RELEASE</version>
     <configuration>
        <mainClass>com.vip.saturn.job.console.springboot.SaturnConsoleApp</mainClass>
        <layout>JAR</layout>
        <executable>true</executable>
        <classifier>exec</classifier>
     </configuration>
     <executions>
         <execution>
           <goals>
               <goal>repackage</goal>
           </goals>
         </execution>
     </executions>
</plugin>

<!--Adjusted to:-->
<plugin>
     <groupId>org.springframework.boot</groupId>
     <artifactId>spring-boot-maven-plugin</artifactId>
     <configuration>
        <mainClass>com.vip.saturn.job.console.springboot.SaturnConsoleApp</mainClass>
        <layout>JAR</layout>
        <executable>true</executable>
        <classifier>exec</classifier>
     </configuration>
     <executions>
         <execution>
           <goals>
               <goal>repackage</goal>
           </goals>
         </execution>
     </executions>
</plugin>

In application.properties, add:

spring.main.allow-bean-definition-overriding=true
saturn.stdout=true

1.8 Saturn-spring boot sub-project adjustment

<springboot.version>1.5.16.RELEASE</springboot.version> 

Version number changed to: 2.1.6.RELEASE

GenericSpringBootSaturnApplication class:

protected Object source() {
   return this.getClass();
}

Changed to:

protected Class source() {
   return this.getClass();
}

Tags: Spring Druid JavaEE SpringBoot

Posted on Tue, 17 Sep 2019 07:03:11 -0700 by supermars