lf知识星球banner

项目部署

2018-03-14 11:43:08
admin
11486
最后编辑:Seagull 于 2019-07-10 17:33:55
简介:介绍项目部署以及启动的方式

项目部署

服务端部署

服务端采用的Spring boot,部署相对来说比较简单,首先需要在IDE中 右键选择项目 >>Run As>>Maven install ,点击此菜单后,会对 Web服务端项目编译构建,并生成一个编译好的项目Jar包。



项目编译好以后,如果你想在IDE里面直接启动项目,那么可以打开LuckyFrameWebApplication.java文件,直接运行或是以Debug模式运行即可。


当然你也可以直接运行JAR包,有两种方式,一种是前台方式,一种后台方式,前台方式当你关闭Windows命令行窗口或是在Linux 下按下C trl+C键时,服务会关闭,后台方式则不会。

如果你想部署到Linux服务器上,只需要把JAR包COPY到服务器对应目录下,在当前目录下运行如下命令,使Web程序采用后台方式运行。

nohup java -jar LuckyFrameWeb.jar &
当然如果你想用前台方式运行,也可以用下面的命令(Linux&Windows下一样):
java -jar LuckyFrameWeb.jar

服务端启动后默认端口是80,浏览器访问地址:http://XX.XXX.XXX.XX  即可


客户端部署

客户端的部署也很简单,首先保证项目中没有报错的地方,右键项目 >>Run As>>Maven install,点击此菜单,客户端项目会自动进行构建。


构建成功后,在项目的 \LuckyFrameClient\target目前下生成一个LuckyFrameClient.jar文件

\LuckyFrameClient\target\classes目录下会出现如下一些文件。

注意:重点注意下在此路径下有没有生成一个lib目录,此目录是存放客户端所依赖jar的。


客户端正常构建完成后,您可以把此目录下的所有文件复制到其他更方便的路径下新建的一个文件夹中进行后续操作,也可以直接在当前项目路径下操作。


1: 打开此目录(新建文件夹或直接在此项目目录)中的 sys_config.properties文件,进行客户端的相关配置(配置细节参照上一配置相关章节的介绍)。

2:客户端在服务器上的部署基本都是一样 ,在本地构建编译好项目以后,在服务器上某个路径下,新建一个目录,把在本地 \LuckyFrameClient\target\classes目录下编译构建好的所有文件COPY到此文件夹中,双击此目录中的 start_service.cmd文件,启动监听即可。


注意: 如果你是在mac或是linux类型的操作系统上部署客户端,那么请首先把项目根目录下所有 .sh 后缀的文件使用chmod命令修改访问权限,否则有可能会出现任务启动失败的情况。修改完成后,执行  ./ start_service.sh  启动客户端监听。


特别提示:客户端不要在IDE工具中启动,只能通过运行 start_service的方式启动,否则会出现无法调起测试任务的情况!!!!

  正常情况下客户端启动后,我们在Web服务端的客户端管理界面,先添加对应的客户端信息以及IP,就能看到可以正常检测到客户端的状态了。


评论列表
yaohuan 2019-08-15 18:12:03 回复
你好,我服务器端下载百度云上编译好的,然后在linux上运行。启动没有报错,算成功了。但是网页打不开,telnet IP 端口 连不上。同样的入站规则设置,新安装的数据库的3306端口却可以访问。下面是启动日志。
##################################################################
17:49:09.398 [main] INFO c.l.LuckyFrameWebApplication - [logStarting,50] - Starting LuckyFrameWebApplication v3.0 on izwz93j8or3olu9c2k5i2qz with PID 26822 (/root/luckyframe/LuckyFrameWeb.jar started by root in /root/luckyframe)
17:49:09.402 [main] DEBUG c.l.LuckyFrameWebApplication - [logStarting,53] - Running with Spring Boot v2.1.1.RELEASE, Spring v5.1.3.RELEASE
17:49:09.403 [main] INFO c.l.LuckyFrameWebApplication - [logStartupProfileInfo,679] - The following profiles are active: druid
17:49:15.427 [main] INFO o.a.s.c.e.EhCacheManager - [getCache,158] - Cache with name 'com.luckyframe.framework.shiro.realm.UserRealm.authorizationCache' does not yet exist. Creating now.
17:49:15.428 [main] INFO o.a.s.c.e.EhCacheManager - [getCache,165] - Added EhCache named [com.luckyframe.framework.shiro.realm.UserRealm.authorizationCache]
17:49:18.468 [main] INFO o.a.s.c.e.EhCacheManager - [getCache,169] - Using existing EHCache named [loginRecordCache]
17:49:20.901 [main] INFO o.a.c.h.Http11NioProtocol - [log,173] - Initializing ProtocolHandler ["http-nio-8855"]
17:49:20.948 [main] INFO o.a.c.c.StandardService - [log,173] - Starting service [Tomcat]
17:49:20.951 [main] INFO o.a.c.c.StandardEngine - [log,173] - Starting Servlet Engine: Apache Tomcat/9.0.13
17:49:20.977 [main] INFO o.a.c.c.AprLifecycleListener - [log,173] - The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: [/usr/java/packages/lib/amd64:/usr/lib64:/lib64:/lib:/usr/lib]
17:49:21.284 [main] INFO o.a.c.c.C.[.[.[/] - [log,173] - Initializing Spring embedded WebApplicationContext
17:49:22.337 [main] INFO c.a.d.p.DruidDataSource - [init,930] - {dataSource-1} inited
17:49:22.503 [main] INFO o.q.i.StdSchedulerFactory - [instantiate,1208] - Using default implementation for ThreadExecutor
17:49:22.640 [main] INFO o.q.c.SchedulerSignalerImpl - [<init>,61] - Initialized Scheduler Signaller of type: class org.quartz.core.SchedulerSignalerImpl
17:49:22.641 [main] INFO o.q.c.QuartzScheduler - [<init>,229] - Quartz Scheduler v.2.3.0 created.
17:49:22.649 [main] INFO o.q.c.QuartzScheduler - [initialize,294] - Scheduler meta-data: Quartz Scheduler (v2.3.0) 'LuckyFrameScheduler' with instanceId 'izwz93j8or3olu9c2k5i2qz1565862562540'
Scheduler class: 'org.quartz.core.QuartzScheduler' - running locally.
NOT STARTED.
Currently in standby mode.
Number of jobs executed: 0
Using thread pool 'org.quartz.simpl.SimpleThreadPool' - with 50 threads.
Using job-store 'org.springframework.scheduling.quartz.LocalDataSourceJobStore' - which supports persistence. and is clustered.

17:49:22.649 [main] INFO o.q.i.StdSchedulerFactory - [instantiate,1362] - Quartz scheduler 'LuckyFrameScheduler' initialized from an externally provided properties instance.
17:49:22.649 [main] INFO o.q.i.StdSchedulerFactory - [instantiate,1366] - Quartz scheduler version: 2.3.0
17:49:22.651 [main] INFO o.q.c.QuartzScheduler - [setJobFactory,2287] - JobFactory set to: org.springframework.scheduling.quartz.AdaptableJobFactory@6c45ee6e
17:49:22.758 [main] DEBUG c.l.p.m.j.m.J.selectJobAll - [debug,159] - ==> Preparing: select job_id, job_name, job_group, method_name, method_params, cron_expression, misfire_policy, status, create_by, create_time, remark from sys_job
17:49:23.096 [main] DEBUG c.l.p.m.j.m.J.selectJobAll - [debug,159] - ==> Parameters:
17:49:23.178 [main] DEBUG c.l.p.m.j.m.J.selectJobAll - [debug,159] - <== Total: 0
17:49:26.176 [main] INFO s.d.s.w.PropertySourcedRequestMappingHandlerMapping - [initHandlerMethods,69] - Mapped URL path [/v2/api-docs] onto method [public org.springframework.http.ResponseEntity<springfox.documentation.spring.web.json.Json> springfox.documentation.swagger2.web.Swagger2Controller.getDocumentation(java.lang.String,javax.servlet.http.HttpServletRequest)]
17:49:28.296 [main] INFO s.d.s.w.p.DocumentationPluginsBootstrapper - [start,147] - Context refreshed
17:49:28.371 [main] INFO s.d.s.w.p.DocumentationPluginsBootstrapper - [start,150] - Found 1 custom documentation plugin(s)
17:49:28.670 [main] INFO s.d.s.w.s.ApiListingReferenceScanner - [scan,41] - Scanning for api listing references
17:49:29.207 [main] INFO o.a.c.h.Http11NioProtocol - [log,173] - Starting ProtocolHandler ["http-nio-8855"]
17:49:29.212 [main] INFO o.a.t.u.n.NioSelectorPool - [log,173] - Using a shared selector for servlet write/read
17:49:29.617 [main] INFO c.l.LuckyFrameWebApplication - [logStarted,59] - Started LuckyFrameWebApplication in 21.936 seconds (JVM running for 23.569)
LuckyFrameWeb启动成功......
17:49:30.369 [Quartz Scheduler [LuckyFrameScheduler]] INFO o.q.c.QuartzScheduler - [start,547] - Scheduler LuckyFrameScheduler_$_izwz93j8or3olu9c2k5i2qz1565862562540 started.

Seagull 2019-08-16 15:10:57 回复
确认你访问的地址以及端口是不是对的,再看看防火墙档住了没有
jia 2019-08-12 20:20:30 回复
添加客户端后 显示状态未知是为什么呢
Seagull 2019-08-13 17:18:55 回复
把当前页面刷新一睛,未知状态是定时任务还没有开始检测客户端
小于 2019-07-26 17:54:58 回复

下载的都是v3.0版本的,启动时不知道为什么说版本不一致

Jul 26, 2019 5:46:27 PM org.apache.catalina.core.StandardService startInternal
信息: Starting service [Tomcat]
Jul 26, 2019 5:46:27 PM org.apache.catalina.core.StandardEngine startInternal
信息: Starting Servlet Engine: Apache Tomcat/8.5.31
Jul 26, 2019 5:46:27 PM org.apache.catalina.core.AprLifecycleListener lifecycleEvent
信息: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: [C:\Program Files (x86)\Common Files\Oracle\Java\javapath;C:\Windows\Sun\Java\bin;C:\Windows\system32;C:\Windows;C:\Program Files\VanDyke Software\Clients\;C:\Program Files (x86)\Common Files\Oracle\Java\javapath;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files\Java\jdk1.8.0_201\bin;"C:\Program Files\Java\jdk1.8.0_201\jre\bin;%CATALINA_HOME%\bin;";D:\mysql-5.7.26-winx64\bin;D:\apache-jmeter-5.1.1\bin;D:\apache-maven-3.6.1\bin;C:\Program Files\MySQL\MySQL Shell 8.0\bin\;.]
Jul 26, 2019 5:46:27 PM org.apache.catalina.core.ApplicationContext log
信息: Initializing Spring embedded WebApplicationContext
2019-07-26 17:46:27:994:springboot.RunService.main(RunService.java:32) -
INFO: 启动客户端监听,请稍后......监听IP:169.254.177.18
2019-07-26 17:46:27:997:springboot.HttpImpl.checkHostNet(HttpImpl.java:368) -
INFO: 检查客户端配置中,请稍后......
2019-07-26 17:46:28:257:springboot.HttpImpl.checkHostNet(HttpImpl.java:378) -
WARN: 客户端版本:3.0 Beta 服务端版本:<!doctype html><html lang="en"><head><title>HTTP Status 404 鈥? Not Found</title><style type="text/css">h1 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:22px;} h2 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:16px;} h3 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:14px;} body {font-family:Tahoma,Arial,sans-serif;color:black;background-color:white;} b {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;} p {font-family:Tahoma,Arial,sans-serif;background:white;color:black;font-size:12px;} a {color:black;} a.name {color:black;} .line {height:1px;background-color:#525D76;border:none;}</style></head><body><h1>HTTP Status 404 鈥? Not Found</h1><hr class="line" /><p><b>Type</b> Status Report</p><p><b>Message</b> &#47;openGetApi&#47;clientGetServerVersion.do</p><p><b>Description</b> The origin server did not find a current representation for the target resource or is not willing to disclose that one exists.</p><hr class="line" /><h3>Apache Tomcat/8.5.43</h3></body></html> 客户端与服务端版本不一致,有可能会导致未知问题,请检查...
Seagull 2019-08-01 13:39:58 回复
看这个报错是你的服务端版本有问题呢
wq 2019-04-03 17:31:45 回复
A ResourcePool could not acquire a resource from its primary factory or source 一登陆就提示这个
Seagull 2019-04-08 08:42:25 回复
数据库链接问题,看下数据库版本
summer 2019-03-01 22:43:36 回复
我是下载的最新的版本,直接下载的2.7.2的zip包。
summer 2019-03-01 22:40:12 回复
您好,我按照上面的配置,服务器部署成功,客户端启用监听总是报错:
2019-03-01 22:29:50:531:springboot.HttpImpl.checkhostnet(HttpImpl.java:398) -
ERROR: 客户端配置检测异常,请确认您项目根目录下的客户端配置文件(sys_config.properties)是否已经正确配置。
java.net.ConnectException: Connection timed out: connect
at java.net.DualStackPlainSocketImpl.connect0(Native Method)
at java.net.DualStackPlainSocketImpl.socketConnect(Unknown Source)
at java.net.AbstractPlainSocketImpl.doConnect(Unknown Source)
at java.net.AbstractPlainSocketImpl.connectToAddress(Unknown Source)
at java.net.AbstractPlainSocketImpl.connect(Unknown Source)
at java.net.PlainSocketImpl.connect(Unknown Source)
at java.net.SocksSocketImpl.connect(Unknown Source)
at java.net.Socket.connect(Unknown Source)
at java.net.Socket.connect(Unknown Source)
at springboot.HttpImpl.checkhostnet(HttpImpl.java:393)
at springboot.RunService.main(RunService.java:33)
配置文件:server.web.ip=192.168.*.* --服务器端的ip
server.web.port=9999 --服务端tomcat端口号
数据库、邮箱都按照要求改了,不知道哪里不对。
Seagull 2019-03-06 14:30:15 回复
请您先检查客户端与服务端之前的网络是不是通的,从客户端telnet一下服务端的端口就知道了
1/1
发表评论
评论通过审核后显示。
搞事bannar