From e6e27404a27c8cfbd2d3e1ff55e8dd04f0fe5321 Mon Sep 17 00:00:00 2001 From: Zhang Peng Date: Fri, 12 Oct 2018 18:31:56 +0800 Subject: [PATCH] =?UTF-8?q?:bookmark:=20=E6=B7=BB=E5=8A=A0=E6=9B=B4?= =?UTF-8?q?=E6=96=B0=E8=84=9A=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- demos/scripts/build-javaapp.bat | 12 +++++++----- demos/scripts/build-reactapp.bat | 8 ++++---- demos/scripts/demo01-start.bat | 12 ++++++++---- demos/scripts/demo02-start.bat | 10 +++++++--- demos/scripts/demo03-start.bat | 11 +++++++---- demos/scripts/demo04-start.bat | 9 ++++++--- demos/scripts/demo05-start.bat | 14 ++++++++++++++ 7 files changed, 53 insertions(+), 23 deletions(-) create mode 100644 demos/scripts/demo05-start.bat diff --git a/demos/scripts/build-javaapp.bat b/demos/scripts/build-javaapp.bat index 9dbbcfa..7fc4ca0 100644 --- a/demos/scripts/build-javaapp.bat +++ b/demos/scripts/build-javaapp.bat @@ -1,9 +1,11 @@ +@echo off rem ------------------------------------------------- -rem 本脚本用于编译打包 JavaWebApp -rem 环境要求:Maven + JDK8 +rem 本脚本用于编译打包 JavaWebApp +rem 环境要求:Maven + JDK8 rem ------------------------------------------------- -@echo off -cd "../javaapp" -mvn clean package -Dmaven.test.skip=true +pushd %~dp0..\javaapp +call mvn clean package -Dmaven.test.skip=true +popd + pause diff --git a/demos/scripts/build-reactapp.bat b/demos/scripts/build-reactapp.bat index 51199f8..d048d1e 100644 --- a/demos/scripts/build-reactapp.bat +++ b/demos/scripts/build-reactapp.bat @@ -1,12 +1,10 @@ +@echo off rem ------------------------------------------------- rem The script is use to package JavaWebApp rem Env: Nodejs 8.x rem ------------------------------------------------- -@echo off - -rem 删除 dist 目录 -cd ../reactapp +pushd %~dp0..\reactapp echo ">>>> 1. Delete node_modules" rd /s /q node_modules @@ -19,4 +17,6 @@ echo ">>>> 3. npm run prod" rem 构建生产环境,构建的静态资源文件在 dist 目录 call npm run prod +popd + pause diff --git a/demos/scripts/demo01-start.bat b/demos/scripts/demo01-start.bat index 406b59b..dbfbe7a 100644 --- a/demos/scripts/demo01-start.bat +++ b/demos/scripts/demo01-start.bat @@ -1,16 +1,20 @@ +@echo off rem ------------------------------------------------- rem 启动 Demo1 rem 1. 启动 Nginx rem 2. 启动一个 JavaApp,访问地址为:localhost:9010 rem ------------------------------------------------- -@echo off + echo ">>>> 1. Start nginx" -cd "../nginx-1.14.0" +pushd %~dp0..\nginx-1.14.0 call nginx-start.bat +popd echo ">>>> 2. Start javaapp - localhost:9010" -cd "../javaapp" -java -Dtomcat.connector.port=9010 -cp "target/JavaWebApp/WEB-INF/classes;target/JavaWebApp/WEB-INF/lib/*" io.github.dunwu.Main +pushd %~dp0..\javaapp +call java -Dtomcat.connector.port=9010 -cp "target/JavaWebApp/WEB-INF/classes;target/JavaWebApp/WEB-INF/lib/*" io.github.dunwu.Main +popd + pause diff --git a/demos/scripts/demo02-start.bat b/demos/scripts/demo02-start.bat index 7ab3519..1d10a16 100644 --- a/demos/scripts/demo02-start.bat +++ b/demos/scripts/demo02-start.bat @@ -1,3 +1,4 @@ +@echo off rem ----------------------------------------------------------------------------- rem Demo02 - 负载均衡配置(Nginx/demos/nginx-1.14.0/conf/demos/demo02.conf) rem 1. 启动 Nginx @@ -6,16 +7,19 @@ rem localhost:9021 rem localhost:9022 rem localhost:9023 rem ----------------------------------------------------------------------------- -@echo off + echo ">>>> 1. Start nginx" -cd "../nginx-1.14.0" +pushd %~dp0..\nginx-1.14.0 call nginx-start.bat +popd echo ">>>> 2. Start 3 java app: localhost:9021, localhost:9022, localhost:9023" -cd "../javaapp" +pushd %~dp0..\javaapp start /min java -Dtomcat.connector.port=9021 -cp "target/JavaWebApp/WEB-INF/classes;target/JavaWebApp/WEB-INF/lib/*" io.github.dunwu.Main start /min java -Dtomcat.connector.port=9022 -cp "target/JavaWebApp/WEB-INF/classes;target/JavaWebApp/WEB-INF/lib/*" io.github.dunwu.Main start /min java -Dtomcat.connector.port=9023 -cp "target/JavaWebApp/WEB-INF/classes;target/JavaWebApp/WEB-INF/lib/*" io.github.dunwu.Main +popd + pause diff --git a/demos/scripts/demo03-start.bat b/demos/scripts/demo03-start.bat index 3c4208f..64ab495 100644 --- a/demos/scripts/demo03-start.bat +++ b/demos/scripts/demo03-start.bat @@ -1,3 +1,4 @@ +@echo off rem ----------------------------------------------------------------------------- rem Demo03 - 网站有多个 webapp 的配置(Nginx/demos/nginx-1.14.0/conf/demos/demo03.conf) rem 1. 启动 Nginx @@ -6,16 +7,18 @@ rem localhost:9030/ rem localhost:9031/product rem localhost:9032/user rem ----------------------------------------------------------------------------- -@echo off + echo ">>>> 1. Start nginx" -cd "../nginx-1.14.0" +pushd %~dp0..\nginx-1.14.0 call nginx-start.bat +popd echo ">>>> 2. Start 3 java app: localhost:9030, localhost:9031/product, localhost:9032/user" -cd "../javaapp" +pushd %~dp0..\javaapp start /min java -Dtomcat.connector.port=9030 -Dtomcat.context.path=/ -cp "target/JavaWebApp/WEB-INF/classes;target/JavaWebApp/WEB-INF/lib/*" io.github.dunwu.Main start /min java -Dtomcat.connector.port=9031 -Dtomcat.context.path=/product -cp "target/JavaWebApp/WEB-INF/classes;target/JavaWebApp/WEB-INF/lib/*" io.github.dunwu.Main start /min java -Dtomcat.connector.port=9032 -Dtomcat.context.path=/user -cp "target/JavaWebApp/WEB-INF/classes;target/JavaWebApp/WEB-INF/lib/*" io.github.dunwu.Main +popd + pause - diff --git a/demos/scripts/demo04-start.bat b/demos/scripts/demo04-start.bat index ab8d672..50d71cf 100644 --- a/demos/scripts/demo04-start.bat +++ b/demos/scripts/demo04-start.bat @@ -1,17 +1,20 @@ +@echo off rem ----------------------------------------------------------------------------- rem Demo04 - 动静分离 rem 1. 启动 Nginx rem 2. 启动一个 JavaApp,访问地址分别为: rem localhost:9040 rem ----------------------------------------------------------------------------- -@echo off + echo ">>>> 1. Start nginx" -cd "../nginx-1.14.0" +pushd %~dp0..\nginx-1.14.0 call nginx-start.bat +popd echo ">>>> 2. Start 3 java app: localhost:9040" -cd "../javaapp" +pushd %~dp0..\javaapp start /min java -Dtomcat.connector.port=9040 -cp "target/JavaWebApp/WEB-INF/classes;target/JavaWebApp/WEB-INF/lib/*" io.github.dunwu.Main +popd pause diff --git a/demos/scripts/demo05-start.bat b/demos/scripts/demo05-start.bat new file mode 100644 index 0000000..7592f7d --- /dev/null +++ b/demos/scripts/demo05-start.bat @@ -0,0 +1,14 @@ +@echo off +rem ----------------------------------------------------------------------------- +rem Demo05 - 使用 Nginx 搭建文件服务器 +rem 1. 启动 Nginx +rem 2. 访问地址: +rem localhost:9050 +rem ----------------------------------------------------------------------------- + +echo ">>>> 1. Start nginx" +pushd %~dp0..\nginx-1.14.0 +call nginx-start.bat +popd + +