7.5. HTTP API を使用したアプリケーションのデプロイ

HTTP API を使用してアプリケーションを JBoss EAP にデプロイするには、curl コマンドを使用します。HTTP API の使用に関する詳細は、「HTTP API」を参照してください。

7.5.1. HTTP API を使用したアプリケーションのスタンドアロンサーバーへのデプロイ

デフォルトでは、HTTP API は http://HOST:PORT/management でアクセスできます (例: http://localhost:9990/management)。

アプリケーションのデプロイ
$ curl --digest -L -D - http://HOST:PORT/management --header "Content-Type: application/json" -u USER:PASSWORD -d '{"operation" : "composite", "address" : [], "steps" : [{"operation" : "add", "address" : {"deployment" : "test-application.war"}, "content" : [{"url" : "file:/path/to/test-application.war"}]},{"operation" : "deploy", "address" : {"deployment" : "test-application.war"}}],"json.pretty":1}'
アプリケーションのアンデプロイ
$ curl --digest -L -D - http://HOST:PORT/management --header "Content-Type: application/json" -u USER:PASSWORD -d '{"operation" : "composite", "address" : [], "steps" : [{"operation" : "undeploy", "address" : {"deployment" : "test-application.war"}},{"operation" : "remove", "address" : {"deployment" : "test-application.war"}}],"json.pretty":1}'

JSON リクエストをプログラムで生成する方法の詳細は、この Red Hat ナレッジベースの記事を参照してください。

7.5.2. HTTP API を使用した管理対象ドメインでのアプリケーションのデプロイ

デフォルトでは、HTTP API は http://HOST:PORT/management でアクセスできます (例: http://localhost:9990/management)。

アプリケーションのデプロイ
  1. デプロイメントをコンテンツリポジトリーに追加します。

    $ curl --digest -L -D - http://HOST:PORT/management --header "Content-Type: application/json" -u USER:PASSWORD -d '{"operation" : "add", "address" : {"deployment" : "test-application.war"}, "content" : [{"url" : "file:/path/to/test-application.war"}],"json.pretty":1}'
  2. デプロイメントを指定のサーバーグループに追加します。

    $ curl --digest -L -D - http://HOST:PORT/management --header "Content-Type: application/json" -u USER:PASSWORD -d '{"operation" : "add", "address" : {"server-group" : "main-server-group","deployment":"test-application.war"},"json.pretty":1}'
  3. サーバーグループにアプリケーションをデプロイします。

    $ curl --digest -L -D - http://HOST:PORT/management --header "Content-Type: application/json" -u USER:PASSWORD -d '{"operation" : "deploy", "address" : {"server-group" : "main-server-group","deployment":"test-application.war"},"json.pretty":1}'
アプリケーションのアンデプロイ
  1. 割り当てられたサーバーグループすべてからデプロイメントを削除します。

    $ curl --digest -L -D - http://HOST:PORT/management --header "Content-Type: application/json" -u USER:PASSWORD -d '{"operation" : "remove", "address" : {"server-group" : "main-server-group","deployment":"test-application.war"},"json.pretty":1}'
  2. コンテンツリポジトリーからデプロイメントを削除します。

    $ curl --digest -L -D - http://HOST:PORT/management --header "Content-Type: application/json" -u USER:PASSWORD -d '{"operation" : "remove", "address" : {"deployment" : "test-application.war"}, "json.pretty":1}'