もの好きな組み合わせですが、
IBM WebSphere Liberty Profile (WLP) を Solaris 上で動かしてみます。
WLP のインストール
入手は こちら より。
展開して、jar を実行するだけです。
今回は /opt/IBM/wlp/
に配置しました。
server1 の作成
公式マニュアル も参考に。
手動での起動/終了確認
$ /opt/IBM/wlp/bin/server start server1
$ /opt/IBM/wlp/bin/server stop server1
アプリケーションの配置
今回は gitbucket を配置してみます。
サーバの dropins ディレクトリに放り込むだけ、自動的に認識されます。
今回は /opt/IBM/wlp/usr/servers/server1/dropins/
ブラウザから http://localhost:9080/gitbucket/ でアクセスできます。
localhost 以外からのアクセス
WLP のデフォルトでは、localhost 以外からのアクセスが制限されています。
解除するには server.xml に httpEndpoint の host を編集する必要があります。
これがないと、127.0.0.1 からしかアクセスできません。
<httpEndpoint id="defaultHttpEndpoint"
host="*"
httpPort="9080"
httpsPort="9443" />
Note: host="*" means "listen on all adapters". By default, the server is listening only on address 127.0.0.1/localhost. You can also use the host property to specify a single IP address, and then the system listens only on the specified adapter.
Specifying Liberty profile bootstrap properties
Solaris での自動起動終了 設定
サービス化するために SMF のマニフェスト (Gist) を書きます。
Gist のサンプルは defaultServer
を指定してあるので、各自のサーバ (ここでは server1
) に変更してください。
<?xml version="1.0"?>
<!DOCTYPE service_bundle SYSTEM "/usr/share/lib/xml/dtd/service_bundle.dtd.1">
<!--
wlp.xml : WebSphere Liberty Profile service manifest, NAKAJIMA Takaaki
Installation
1. Install WebSphere Liberty Profile
See also https://developer.ibm.com/wasdev/websphere-liberty/
2. Put this manigest in standard location (e.g. /var/svc/manifest/site/wlp.xml)
3. Run 'svcadm restart manifest-import'
4. Run 'svcadm enable svc:/application/web/wlp'
See also https://blogs.oracle.com/SolarisSMF/entry/changes_to_svccfg_import_and
-->
<service_bundle type='manifest' name='wlp'>
<service name='application/web/wlp' type='service' version='1'>
<single_instance />
<exec_method
type='method'
name='start'
exec='/opt/IBM/wlp/bin/server start server1'
timeout_seconds='30' />
<exec_method
type='method'
name='stop'
exec='/opt/IBM/wlp/bin/server stop server1'
timeout_seconds='30' />
<instance name='default' enabled='false' />
<stability value='Unstable' />
<template>
<common_name>
<loctext xml:lang='C'>IBM WebSphere Liberty Profile</loctext>
</common_name>
<documentation>
<doc_link name='WAS Liberty' uri='https://developer.ibm.com/wasdev/websphere-liberty/' />
</documentation>
</template>
</service>
</service_bundle>
これを /var/svc/manifest/site/wlp.xml
として保存します。
標準の場所 (standard location) に置いてあれば、
以下のコマンドで読み込んでくれます。
$ sudo /usr/sbin/svcadm restart manifest-import
See also Changes to svccfg import and delete
サービスの有効化
$ sudo svcadm enable /application/web/wlp
svcs コマンドで起動状態を確認。
$ svcs -lp wlp
fmri svc:/application/web/wlp:default
name IBM WebSphere Liberty Profile
enabled true
state online
next_state none
state_time 2015年10月31日 08時06分27秒
logfile /var/svc/log/application-web-wlp:default.log
restarter svc:/system/svc/restarter:default
contract_id 17750
manifest /var/svc/manifest/site/wlp.xml
process 22475 java -javaagent:/opt/IBM/wlp/bin/tools/ws-javaagent.jar -Djava.awt.headless=tru
以上、Solaris SMF の使い方と
WLP を使ったアプリケーションサーバの構築でした。