Provide the below paths at top in below test.sh file:
Step1: Run with gradlew
create below gradle.sh file.
gradle.sh :
export GRADLE_HOME=/opt/gradle/gradle-3.0;
export PATH="$PATH:$GRADLE_HOME/bin";
cd <PROJECT_HOME_PATH>;
gradle clean bootRun -PdebugPort=8000 --debug ;
---------------------------------------------------------------------
$sh gradle.sh ---for runing sh file
Step2: Run with nohup, So we can close console
for Better use, create below folders:
-- /<my-dir>/checkouts - Here cheeckout/copy springboot project
--/<my-dir>/deployment - here we we will add bootPackage run details from /<my-dir>checkouts/<project>/build/app-classpath/* and /<my-dir>checkouts/<project>/build/libs/<project-version.jar>
Steps:
1. checkout gradle project in /<my-dir>/<gradle_project>
2. go to /<my-dir>/<gradle_project> and run below commands
chmod +x gradlew
./gradlew clean eclipse
./gradlew clean bootRepackage -Pprofile=<local/qa9>
3. copy /<my-dir>checkouts/<project>/build/app-classpath/* to <my-dir>/deployment/<gradle_project_name>/config/ folder. here we need to create confiig folder before copy
4.copy /<my-dir>checkouts/<project>/build/libs/<project-version.jar> to /<my-dir>/deployment/<project>/
5. go to /<my-dir>/deployment/<project>/
6. Run below nohup command
nohup java -Dloader.path="config/*" -Xms256m -Xmx1024m -jar <project-version.jar> --spring.config.location=config/<gradle_project_name>.yml --logging.config=config/log4j2-spring.yml --spring.profiles.active=<local/qa9> > console.log &
To automate above steps in shell script: below is deploy.sh file:
Steps:
1. Put this deploy.sh file in checkouts/<projectName>/ path
2. Make sure Checkouts and deployment folder at parallel
3. run sh deploy.sh <profile_name> command from terminal
deploy.sh:
--------------------------------
project_root_dir="$PWD"
profile=$1;
project_name=$( echo $project_root_dir | rev | cut -d/ -f1 | rev);
echo "Project name: $project_name";
deployment_dir=$project_root_dir/../../deployment;
echo "Deploy project profile : $profile";
echo "project root dir: $project_root_dir";
cd $project_root_dir;
pwd;
cd $deployment_dir;
pwd;
echo "Creating project folder in deployment";
echo "Removing config and jar";
rm -rf $project_name/config $project_name/content*.jar;
echo "Removed config and jar";
mkdir $deployment_dir/$project_name;
cd $deployment_dir/$project_name;
pwd;
ls;
mkdir config;
echo "Dir created :$project_root_dir/../../deployment/config ";
echo "Creating jar and config the springBoot project";
cd $project_root_dir;
chmod +x gradlew;
./gradlew clean eclipse;
./gradlew clean bootRepackage -Pprofile=$profile;
date;
echo "Copying jar and config folder to deployment folder";
cp -r $project_root_dir/build/app-classpath/* $deployment_dir/$project_name/config;
echo "Copied $project_root_dir/../../deployment/$project_name/config";
cd $project_root_dir/../../deployment/$project_name/config;
ls -lart;
cp -r $project_root_dir/build/libs/content*.jar $deployment_dir/$project_name/;
echo "Copied jar file";
cd $deployment_dir/$project_name;
ls -lart;
echo "Runing Jar Dir:$pwd";
echo "Running jar with nohup";
echo "nohup java -Dloader.path=config/* -Xms256m -Xmx512m -XX:+PrintGCDetails -XX:+PrintGCDateStamps -Xloggc:"$project_name"_gc.log -XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=5 -XX:GCLogFileSize=20000k -XX:+UseG1GC -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath="$project_name"_java_pid.hprof -jar "$project_name"-1.0.0.jar --spring.config.location=config/"$project_name".yml --logging.config=config/log4j2-spring.yml --spring.profiles.active=$profile > console.log &";
nohup java -Dloader.path=config/* -Xms256m -Xmx512m -XX:+PrintGCDetails -XX:+PrintGCDateStamps -Xloggc:"$project_name"_gc.log -XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=5 -XX:GCLogFileSize=20000k -XX:+UseG1GC -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath="$project_name"_java_pid.hprof -jar "$project_name"-1.0.0.jar --spring.config.location=config/"$project_name".yml --logging.config=config/log4j2-spring.yml --spring.profiles.active=$profile > console.log &
tail -f console.log;
-----------------------------------
Step1: Run with gradlew
create below gradle.sh file.
gradle.sh :
export GRADLE_HOME=/opt/gradle/gradle-3.0;
export PATH="$PATH:$GRADLE_HOME/bin";
cd <PROJECT_HOME_PATH>;
gradle clean bootRun -PdebugPort=8000 --debug ;
---------------------------------------------------------------------
$sh gradle.sh ---for runing sh file
Step2: Run with nohup, So we can close console
for Better use, create below folders:
-- /<my-dir>/checkouts - Here cheeckout/copy springboot project
--/<my-dir>/deployment - here we we will add bootPackage run details from /<my-dir>checkouts/<project>/build/app-classpath/* and /<my-dir>checkouts/<project>/build/libs/<project-version.jar>
Steps:
1. checkout gradle project in /<my-dir>/<gradle_project>
2. go to /<my-dir>/<gradle_project> and run below commands
chmod +x gradlew
./gradlew clean eclipse
./gradlew clean bootRepackage -Pprofile=<local/qa9>
3. copy /<my-dir>checkouts/<project>/build/app-classpath/* to <my-dir>/deployment/<gradle_project_name>/config/ folder. here we need to create confiig folder before copy
4.copy /<my-dir>checkouts/<project>/build/libs/<project-version.jar> to /<my-dir>/deployment/<project>/
5. go to /<my-dir>/deployment/<project>/
6. Run below nohup command
nohup java -Dloader.path="config/*" -Xms256m -Xmx1024m -jar <project-version.jar> --spring.config.location=config/<gradle_project_name>.yml --logging.config=config/log4j2-spring.yml --spring.profiles.active=<local/qa9> > console.log &
To automate above steps in shell script: below is deploy.sh file:
Steps:
1. Put this deploy.sh file in checkouts/<projectName>/ path
2. Make sure Checkouts and deployment folder at parallel
3. run sh deploy.sh <profile_name> command from terminal
deploy.sh:
--------------------------------
project_root_dir="$PWD"
profile=$1;
project_name=$( echo $project_root_dir | rev | cut -d/ -f1 | rev);
echo "Project name: $project_name";
deployment_dir=$project_root_dir/../../deployment;
echo "Deploy project profile : $profile";
echo "project root dir: $project_root_dir";
cd $project_root_dir;
pwd;
cd $deployment_dir;
pwd;
echo "Creating project folder in deployment";
echo "Removing config and jar";
rm -rf $project_name/config $project_name/content*.jar;
echo "Removed config and jar";
mkdir $deployment_dir/$project_name;
cd $deployment_dir/$project_name;
pwd;
ls;
mkdir config;
echo "Dir created :$project_root_dir/../../deployment/config ";
echo "Creating jar and config the springBoot project";
cd $project_root_dir;
chmod +x gradlew;
./gradlew clean eclipse;
./gradlew clean bootRepackage -Pprofile=$profile;
date;
echo "Copying jar and config folder to deployment folder";
cp -r $project_root_dir/build/app-classpath/* $deployment_dir/$project_name/config;
echo "Copied $project_root_dir/../../deployment/$project_name/config";
cd $project_root_dir/../../deployment/$project_name/config;
ls -lart;
cp -r $project_root_dir/build/libs/content*.jar $deployment_dir/$project_name/;
echo "Copied jar file";
cd $deployment_dir/$project_name;
ls -lart;
echo "Runing Jar Dir:$pwd";
echo "Running jar with nohup";
echo "nohup java -Dloader.path=config/* -Xms256m -Xmx512m -XX:+PrintGCDetails -XX:+PrintGCDateStamps -Xloggc:"$project_name"_gc.log -XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=5 -XX:GCLogFileSize=20000k -XX:+UseG1GC -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath="$project_name"_java_pid.hprof -jar "$project_name"-1.0.0.jar --spring.config.location=config/"$project_name".yml --logging.config=config/log4j2-spring.yml --spring.profiles.active=$profile > console.log &";
nohup java -Dloader.path=config/* -Xms256m -Xmx512m -XX:+PrintGCDetails -XX:+PrintGCDateStamps -Xloggc:"$project_name"_gc.log -XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=5 -XX:GCLogFileSize=20000k -XX:+UseG1GC -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath="$project_name"_java_pid.hprof -jar "$project_name"-1.0.0.jar --spring.config.location=config/"$project_name".yml --logging.config=config/log4j2-spring.yml --spring.profiles.active=$profile > console.log &
tail -f console.log;
-----------------------------------
No comments:
Post a Comment