'exec'에 해당되는 글 1건

  1. 2008.10.23 자동화환경에서 WAS를 핸들링하는 방법
WAS를 start/stop/restart하거나 웹어플리케이션을 deploy/undeploy/redeploy하는 작업을 자동으로 처리하기 위해 쓸 수 있는 방법은 어떤게 있을까?

1. 스크립트 실행
작업을 정의한 스크립트를 실행한다. 아마 이게 제일 속편한 방법일지도 모른다.
Ant에서는 telnet, exec, sshexec 등의 타스크를 이용하여 실행하면 된다.

Ant sshexec 타스크를 통해서 원격지의 Tomcat을 start하는 예제

<target name="remote-tomcat-start">
  <sshexec host="${ssh.hostname}"
  port="${ssh.port}"
  username="${ssh.username}"
  passphrase=""
  trust="true"
  keyfile="${ssh.key.file}"
  command="${tomcat.home}/bin/startup" />
  <sleep seconds="${sleep.time}" />
</target>


2. WAS에서 제공하는 Ant 타스크 또는 Maven 플러그인 이용
대부분의 WAS가 어드민화면을 통하지 않고 여러가지 작업을 수행할 수 있는 수단을 제공한다.

Tomcat에서 제공하는 deploy 타스크를 이용하여 war를 deploy하는 Ant 예제

    <target name="install" description="Install application in Tomcat"
        depends="package-web">
        <deploy url="${tomcat.manager.url}"
            username="${tomcat.username}"
            password="${tomcat.password}"
            path="/${webapp.name}"
            war="file:${webapp.dist}/${webapp.war}"/>
    </target>


3. Cargo 이용
Cargo는 WAS 마다 다른 형태의 API를 래핑하여 표준적인 방법으로 WAS를 핸들링할 수 있게 해준다. 그러나 아직 지원하는 WAS가 많지 않다.

Ant에서 cargo 타스트를 이용하여 Tomcat을 start하는 예제

  <cargo containerId="tomcat5x" home="${tomcat.home}" output="${tomcatlog.dir}/output.log"
      log="${tomcatlog.dir}/cargo.log" action="start">
    <configuration home="${tomcatconfig.dir}">
      <property name="cargo.servlet.port" value="8080"/>
      <property name="cargo.logging" value="high"/>
      <deployable type="war" file="${mywarfile}"/>
    </configuration>
  </cargo>
Posted by 에코지오
,