티스토리 뷰

반응형

jetty는 디렉토리 내의 변경 사항을 모니터링하여 변경점이 생겼을 경우 웹 애플리케이션을 배포하는 hot-deploy 기능이 있다. 이 설정은 기본적으로 1(1초 마다 스캔)로 설정되어있어 자동 배포를 원하지 않을 경우 0(감지 하지 않음)으로 설정하여 비활성화 시켜줘야한다.

 

 

jetty8의 경우 /etc/jetty-webapps.xml과 /etc/jetty-contexts.xml 파일 내의 scanInterval 값을 0으로 세팅

<!-- jetty-webapps.xml -->
<?xml version="1.0"?>
<!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "http://www.eclipse.org/jetty/configure.dtd">

<!-- =============================================================== -->
<!-- Add a WebAppProvider to the deployment manager                  -->
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<!-- This scans the webapps directory for war files and directories  -->
<!-- to deploy.                                                      -->
<!-- This configuration must be used with jetty-deploy.xml, which    -->
<!-- creates the deployment manager instance                         -->
<!-- =============================================================== -->
<Configure id="Server" class="org.eclipse.jetty.server.Server">
    <Ref id="DeploymentManager">
          <Call id="webappprovider" name="addAppProvider">
            <Arg>
              <New class="org.eclipse.jetty.deploy.providers.WebAppProvider">
                <Set name="monitoredDirName"><Property name="jetty.home" default="." />/webapps</Set>
                <Set name="defaultsDescriptor"><Property name="jetty.home" default="."/>/etc/webdefault.xml</Set>
                <Set name="scanInterval">1</Set>
                <!-- scanInterval의 값을 0으로 세팅 -->
                <Set name="contextXmlDir"><Property name="jetty.home" default="." />/contexts</Set>
		<Set name="extractWars">true</Set>
              </New>
            </Arg>
          </Call>
    </Ref>
</Configure>

 

<!-- jetty-contexts.xml -->
<?xml version="1.0"?>
<!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "http://www.eclipse.org/jetty/configure.dtd">

<!-- =============================================================== -->
<!-- Add a ContextProvider to the deployment manager                 -->
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<!-- This scans the webapps directory for war files and directories  -->
<!-- to deploy.                                                      -->
<!-- This configuration must be used with jetty-deploy.xml, which    -->
<!-- creates the deployment manager instance                         -->
<!-- =============================================================== -->
<Configure id="Server" class="org.eclipse.jetty.server.Server">
        <Ref id="DeploymentManager">
          <Call name="addAppProvider">
            <Arg>
              <New class="org.eclipse.jetty.deploy.providers.ContextProvider">
                <Set name="monitoredDirName"><Property name="jetty.home" default="." />/contexts</Set>
                <Set name="scanInterval">1</Set>
                <!-- scanInterval의 값을 0으로 세팅 -->
              </New>
            </Arg>
          </Call>
        </Ref>
</Configure>

 

 

jetty9의 경우 /etc/jetty-deploy.xml 파일 내의 scanInterval 값을 0으로 세팅

<?xml version="1.0"?>
<!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "http://www.eclipse.org/jetty/configure_9_3.dtd">

<!-- =============================================================== -->
<!-- Create the deployment manager                                   -->
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<!-- The deplyment manager handles the lifecycle of deploying web    -->
<!-- applications. Apps are provided by instances of the             -->
<!-- AppProvider interface.                                          -->
<!-- =============================================================== -->
<Configure id="Server" class="org.eclipse.jetty.server.Server">

  <Call name="addBean">
    <Arg>
      <New id="DeploymentManager" class="org.eclipse.jetty.deploy.DeploymentManager">
        <Set name="contexts">
          <Ref refid="Contexts" />
        </Set>
        <Call name="setContextAttribute">
          <Arg>org.eclipse.jetty.server.webapp.ContainerIncludeJarPattern</Arg>
          <Arg>.*/[^/]*servlet-api-[^/]*\.jar$|.*/javax.servlet.jsp.jstl-.*\.jar$|.*/org.apache.taglibs.taglibs-standard-impl-.*\.jar$</Arg>
        </Call>

        <!-- Add a customize step to the deployment lifecycle -->
        <!-- uncomment and replace DebugBinding with your extended AppLifeCycle.Binding class
        <Call name="insertLifeCycleNode">
          <Arg>deployed</Arg>
          <Arg>starting</Arg>
          <Arg>customise</Arg>
        </Call>
        <Call name="addLifeCycleBinding">
          <Arg>
            <New class="org.eclipse.jetty.deploy.bindings.DebugBinding">
              <Arg>customise</Arg>
            </New>
          </Arg>
        </Call> -->

        <Call id="webappprovider" name="addAppProvider">
          <Arg>
            <New class="org.eclipse.jetty.deploy.providers.WebAppProvider">
              <Set name="monitoredDirName">
                <Property>
                  <Name>jetty.deploy.monitoredPath</Name>
                  <Default>
                    <Property name="jetty.base" default="." />/<Property name="jetty.deploy.monitoredDir" deprecated="jetty.deploy.monitoredDirName" default="webapps"/>
                  </Default>
                </Property>
              </Set>
              <Set name="defaultsDescriptor">
                <Property>
                  <Name>jetty.deploy.defaultsDescriptorPath</Name>
                  <Default>
                    <Property name="jetty.home" default="." />/etc/webdefault.xml
                  </Default>
                </Property>
              </Set>
              <Set name="scanInterval"><Property name="jetty.deploy.scanInterval" default="1"/></Set>
              <!--jetty.deploy.scanInterval의 default 값을 0으로 세팅-->
              <Set name="extractWars"><Property name="jetty.deploy.extractWars" default="true"/></Set>
              <Set name="configurationManager">
                <New class="org.eclipse.jetty.deploy.PropertiesConfigurationManager">
                  <!-- file of context configuration properties
                  <Set name="file"><SystemProperty name="jetty.base"/>/etc/some.properties</Set>
                  -->
                  <!-- set a context configuration property
                  <Call name="put"><Arg>name</Arg><Arg>value</Arg></Call>
                  -->
                </New>
              </Set>
            </New>
          </Arg>
        </Call>
      </New>
    </Arg>
  </Call>
</Configure>

 

 

위처럼 scanInterval 속성의 값을 0으로 세팅하게되면 hot-deploy 기능이 비활성화된다.

 


참조

 

Jetty/Feature/ContextProvider - Eclipsepedia

Introduction Jetty provides capability to deploy an arbitrary context or web application with Jetty-specific configuration. The ContextProvider mechanism, which is now an extension of the core deployment infrastructure, implements this capability. You can

wiki.eclipse.org

 

 

Jetty/Feature/ContextProvider - Eclipsepedia

Introduction Jetty provides capability to deploy an arbitrary context or web application with Jetty-specific configuration. The ContextProvider mechanism, which is now an extension of the core deployment infrastructure, implements this capability. You can

wiki.eclipse.org

 

Hot Deployment

Jetty lets you deploy an arbitrary context or web application by monitoring a directory for changes. If you add a web application or a context descriptor to the directory, Jetty's DeploymentManager (DM) deploys a new context. If you touch or update a conte

docs.huihoo.com

 

반응형
댓글
반응형
공지사항
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
«   2024/05   »
1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 31
글 보관함