First, during development, the configuration of the configuration service uses the local path, not SVN and git, because each developer will modify the configuration, resulting in others also get the configuration modified by others. The local configuration example is as follows:

spring:
  application:
    name: simple-config-server
  cloud:
    config:
      server:      
        default-label: trunk 
        native:
          searchLocations: file:///D:\works\smart\simple-config-repo                 
  profiles:
    active: native
Copy the code

Two, for the production environment deployed to the Ali cloud, docker can not be used, because docker files usually have hundreds of megabytes, deployment upload is very slow. Not only can you not use Docker, but there is no need to include all packages when packaging. If you remove the dependencies, each jar will compile to only a few hundred K, which makes deployment much easier. Pom compilation options can be set as follows:

<build> <plugins> <plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId>  </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-jar-plugin</artifactId> <configuration> <archive> <manifest> <addClasspath>true</addClasspath>
                            <mainClass>ebtins.smart.proxy.SmartProxyApplication</mainClass>
                            <classpathPrefix>lib/</classpathPrefix>
                        </manifest>
                    </archive>
                </configuration>
            </plugin>
        </plugins>
        <defaultGoal>compile</defaultGoal>
    </build>
Copy the code

The directory of services in your production environment will look like this, with simple-service.jar being only a few hundred K.

simple-service.jar simple-service.sh lib logs

Use scripts to start and stop services. The following scripts can be used to start and stop services:

start(){ 
 now=`date "+%Y%m%d%H%M%S"` 
 execJava -xms64m -xmx256m -jar./simple-service-0.0.1.jar --server.port=7085 --config.name=pro > logs/ simple-service-.log &}# stop method
stop(){ 
 ps aux|grep simple-service|grep 7085|grep -v grep|awk '{print $2}'|while read pid 
 do 
    kill9 -$pid
 done
} 
   
case "The $1" in 
start) 
start 
;; 
stop) 
stop 
;;   
restart) 
stop 
start 
;; 
*) 
printf 'Usage: %s {start|stop|restart}\n' "$testg" 
exit1;;esac
Copy the code

Jar start You can start all services on the server in the script or use the automatic deployment mechanism to automatically start automatic deployment. This is a little bit of experience in production and development environments. More detailed reference source: source minglisoft. Cn/honghu/tech…