在项目he-project下建两个文件夹,分别为resin和webapp
安装的resin放在resin文件夹中,resin文件夹如下
conf/resin.xml配置如下:
<!--
- Resin 4.0 configuration file.
-->
<resin xmlns="http://caucho.com/ns/resin"
xmlns:resin="urn:java:com.caucho.resin">
<!-- property-based Resin configuration -->
<resin:properties path="${__DIR__}/resin.properties" optional="true"/>
<resin:properties path="cloud:/resin.properties"
optional="true" recover="true"/>
<resin:if test="${properties_import_url}">
<resin:properties path="${properties_import_url}"
optional="true" recover="true"/>
</resin:if>
<!-- Logging configuration for the JDK logging API -->
<log-handler name="" level="all" path="stdout:"
timestamp="[%y-%m-%d %H:%M:%S.%s]"
format=" {${thread}} ${log.message}"/>
<!--
- Alternative pseudo-TTCC log format
-
- <log-handler name="" level="all" path="stdout:"
- timestamp="%y-%m-%d %H:%M:%S.%s"
- format=" [${thread}] ${log.level} ${log.shortName} - ${log.message}"/>
-->
<!--
- level='info' for production
- 'fine' or 'finer' for development and troubleshooting
-->
<logger name="" level="${log_level?:'info'}"/>
<logger name="com.caucho.java" level="config"/>
<logger name="com.caucho.loader" level="config"/>
<!--
- Default configuration applied to all clusters, including
- HTTP, HTTPS, and /resin-admin configuration.
-->
<resin:import path="${__DIR__}/cluster-default.xml"/>
<!--
- health configuration
-->
<resin:import path="${__DIR__}/health.xml"/>
<!--
- Remote management requires at least one enabled admin user.
-->
<resin:AdminAuthenticator>
<user name="${admin_user}" password="${admin_password}"/>
<resin:import path="${__DIR__}/admin-users.xml" optional="true"/>
<resin:import path="cloud:/admin-users.xml" optional="true" recover="true"/>
</resin:AdminAuthenticator>
<!--
- For clustered systems, create a password in as cluster_system_key
-->
<cluster-system-key>${cluster_system_key}</cluster-system-key>
<!--
- For production sites, change dependency-check-interval to something
- like 600s, so it only checks for updates every 10 minutes.
-->
<dependency-check-interval>2s</dependency-check-interval>
<!-- For resin.properties dynamic cluster joining -->
<home-cluster>${home_cluster}</home-cluster>
<home-server>${home_server}</home-server>
<elastic-server>${elastic_server}</elastic-server>
<elastic-dns>${elastic_dns}</elastic-dns>
<!--
- Configures the main application cluster. Load-balancing configurations
- will also have a web cluster.
-->
<cluster id="app">
<!-- define the servers in the cluster -->
<server-multi id-prefix="app-" address-list="${app_servers}" port="6800"/>
<host-default>
<!-- creates the webapps directory for .war expansion -->
<web-app-deploy path="webapps"
expand-preserve-fileset="WEB-INF/work/**"
multiversion-routing="${webapp_multiversion_routing}"
path-suffix="${elastic_webapp?resin.id:''}"/>
</host-default>
<!-- auto virtual host deployment in hosts/foo.example.com/webapps -->
<host-deploy path="hosts">
<host-default>
<resin:import path="host.xml" optional="true"/>
</host-default>
</host-deploy>
<!-- the default host, matching any host name -->
<host id="" root-directory=".">
<!--
- webapps can be overridden/extended in the resin.xml
-->
<web-app id="/" root-directory="webapps/ROOT"/>
</host>
<resin:if test="${resin_doc}">
<host id="${resin_doc_host}" root-directory="${resin_doc_host}">
<web-app id="/resin-doc" root-directory="${resin.root}/doc/resin-doc"/>
</host>
</resin:if>
</cluster>
<!--
- Configures the main appliction cluster. Load-balancing configurations
- will also have a load-balance-tier cluster.
-->
<cluster id="hellodake">
<root-directory>.</root-directory>
<server-default>
<watchdog-port>6601</watchdog-port> <!--resin的端口-->
<thread-max>4096</thread-max>
<thread-idle-max>256</thread-idle-max>
<thread-idle-min>64</thread-idle-min>
<http address="*" port="8085"> <!--你服务的端口-->
<accept-thread-max>512</accept-thread-max>
<accept-thread-min>32</accept-thread-min>
<connection-max>3096</connection-max>
<port-thread-max>3096</port-thread-max>
</http>
<keepalive-max>1024</keepalive-max>
<keepalive-timeout>60s</keepalive-timeout>
<jvm-arg>-Xmn128M</jvm-arg>
<jvm-arg>-Xmx1024M</jvm-arg>
<jvm-arg>-Xms1024M</jvm-arg>
<jvm-arg>-Xloggc:/home/work/log/he-project/gc.log</jvm-arg>
<jvm-arg>-Duse.local.proxy=true</jvm-arg>
</server-default>
<server id="he-project"></server> <!--项目-->
<host id="" root-directory=".">
<web-app id="/" root-directory='/home/work/bin/he-project/webapp'>
</web-app>
<access-log path='/home/work/log/he-project/access.log'
format='%t >>>> [%h] [%s] [%v] [%r]'
rollover-period="1D"/>
<stdout-log path='/home/work/log/he-project/stdout.log' rollover-period='1D'/>
<stderr-log path='/home/work/log/he-project/stderr.log' rollover-period='1D'/>
</host>
</cluster>
</resin>
把/target下的文件放在he-project/webapp下,可以写个脚本来做这件事
#!/bin/bash
##
# 使用release.sh, 将he-project发布到onebox
##
SCRIPT_DIR=`cd $(dirname $0); pwd -P`
build_dir="he-project-1.0.0-SNAPSHOT"
wwwprj="he-project"
cd ${SCRIPT_DIR}
mvn install -DskipTests=true -Pnewstaging
echo "replace $wwprj war file"
rm -rf /home/work/bin/${wwwprj}/webapp/*
cp -r $SCRIPT_DIR/target/${build_dir}/* /home/work/bin/${wwwprj}/webapp
cd -