WildFly 8.1.0.Finalのインストールからアプリケーションのデプロイまで
環境
- MacBookAir
- MacOSX 10.9.3
インストール
ダウンロードしてきて展開するだけ
$ curl -LO http://download.jboss.org/wildfly/8.1.0.Final/wildfly-8.1.0.Final.tar.gz $ tar xvfz wildfly-8.1.0.Final.tar.gz
起動
standalone.shを実行するだけ
$ cd wildfly-8.1.0.Final/bin $ ./standalone.sh ...(略)... 01:37:43,003 INFO [org.wildfly.extension.undertow] (MSC service thread 1-6) JBAS017519: Undertow HTTP listener default listening on /127.0.0.1:8080 01:37:43,463 INFO [org.jboss.as.connector.subsystems.datasources] (MSC service thread 1-4) JBAS010400: Bound data source [java:jboss/datasources/ExampleDS] 01:37:43,558 INFO [org.jboss.as.server.deployment.scanner] (MSC service thread 1-4) JBAS015012: Started FileSystemDeploymentService for directory /Users/tabira/local/app/wildfly-8.1.0.Final/standalone/deployments 01:37:44,038 INFO [org.jboss.ws.common.management] (MSC service thread 1-6) JBWS022052: Starting JBoss Web Services - Stack CXF Server 4.2.4.Final 01:37:44,132 INFO [org.jboss.as] (Controller Boot Thread) JBAS015961: Http management interface listening on http://127.0.0.1:9990/management 01:37:44,133 INFO [org.jboss.as] (Controller Boot Thread) JBAS015951: Admin console listening on http://127.0.0.1:9990 01:37:44,134 INFO [org.jboss.as] (Controller Boot Thread) JBAS015874: WildFly 8.1.0.Final "Kenny" started in 5951ms - Started 184 of 233 services (81 services are lazy, passive or on-demand)
http://localhost:8080/ にアクセスして「Welcome to WildFly 8. Your WildFly 8 is running.」と出たらOK
設定
今回は、アクセスログの有効化を行ってみる
管理コンソールにつなぐ
$ ./jboss-cli.sh You are disconnected at the moment. Type 'connect' to connect to the server or 'help' for the list of supported commands. [disconnected /] connect
--connect
or -c
オプションを付けて起動すると、つないだ状態でプロンプトを出してくれる
アクセスログの有効化設定
[standalone@localhost:9990 /] /subsystem=undertow/server=default-server/host=default-host/setting=access-log:add {"outcome" => "success"}
アクセスログに関する設定確認
[standalone@localhost:9990 /] /subsystem=undertow/server=default-server/host=default-host/setting=access-log:read-resource { "outcome" => "success", "result" => { "directory" => expression "${jboss.server.log.dir}", "pattern" => "common", "prefix" => "access_log", "rotate" => true, "suffix" => ".log", "worker" => "default" } }
設定の再読み込み
[standalone@localhost:9990 /] :reload { "outcome" => "success", "result" => undefined }
サンプルアプリケーション
wildfly-sample-app
というプロジェクトを作成
$ mvn archetype:generate -DgroupId=com.mythosil -DartifactId=wildfly-sample-app -DarchetypeArtifactId=maven-archetype-webapp -DinteractiveMode=false $ cd wildfly-sample-app $ vim src/main/webapp/index.jsp <html> <head> <title>Hello, Wildfly!</title> </head> <body> <h1>It Works!!</h1> </body> </html> $ mvn package
デプロイ
$ ./jboss-cli.sh -c [standalone@localhost:9990 /] deploy wildfly-sample-app.war [standalone@localhost:9990 /] deployment-info NAME RUNTIME-NAME PERSISTENT ENABLED STATUS wildfly-sample-app.war wildfly-sample-app.war true true OK
http://localhost:8080/wildfly-sample-app/ にアクセスすると「It Works!!」と表示される
アンデプロイ
[standalone@localhost:9990 /] undeploy wildfly-sample-app.war
終了
Ctrl+Cでも終了できるが、せっかくなのでCLIツールを使ってみる
$ ./jboss-cli.sh -c --command=:shutdown {"outcome" => "success"}