Springboot production Environment
Caution 1. Remove unwanted jars
monitor be sure to do the right control or remove
-
control jar:spring-boot-starter-actuator
-
druid monitoring
-
swagger interface 3, packaging , skip test
-
maven:cleanpackage -dmaven.test.skip=true
-
Script
#!/bin/sh## chang hereservice_dir=/var/www/ctoeduservice_name= Blog-api-boot-jpa-data-0.0.1-snapshotspring_profiles_active=dev## java envexport java_home=/opt /jdk1.8export jre_home=${java_home}/jrecase "$" in start) procedure= ' ps -ef | grep -w "${service_name}" |grep -w "java" | grep -v "grep" | awk ' {print $2} ' if [ ' ${procedure} ' = ' ];thenecho ' start   "if [ " " != " " ];thenSPRING_PROFILES_ACTIVE=$2fiecho " Spring.profiles.active=${spring_profiles_active} "exec nohup ${jre_home}/bin/java -xms128m -xmx512m -jar ${service_dir}/${service_name}\.jar --spring.profiles.active=${spring_profiles_ active} >/dev/null 2>&1 &echo "start success" elseecho "${SERVICE_ Name} is start "FI;; Stop) procedure= ' ps -ef | grep -w "${service_name}" |grep -w "java" | grep -v "grep" | awk ' {print $2} ' if [ ' ${procedure} ' = ' ];thenecho ' ${service_name} is stop "Elsekill -9 ${procedure}sleep 1argprocedure= ' Ps -ef | grep -w "${service_name}" |grep -w "java" | grep -v "grep" | awk ' {print $2} ' if [ ' ${argprocedure} ' = ' ];thenecho ' ${service_name} stop success "elsekill -9 ${argprocedure}echo " ${service_name} stop error " Fifi;; Restart) $0 stopsleep 1$0 start $2;; *) echo "Usage: $0 [start|stop|restart] [dev|test|prod]";; esac
Execute script
./ctoedu.sh Start
./ctoedu.sh Stop/ctoedu.sh start test./ctoedu.sh start dev./ctoedu.sh Start prod
Ps-ef | grep blog-api-boot-jpa-data-0.0.1-snapshot
TAIL-100F logs
Spring Boot 2.0.0.M7 Production Environment deployment