現在、Vagrant を使用して、chef_solo クックブック経由でグラスフィッシュ サーバーをインストールしています。すべてが正しくインストールされ、サーバーにアクセスできますが、ホスト マシンからリモートでサーバーにアクセスするには、secure_admin を有効にする必要があります。
問題は、Vagrant が secure_admin の属性を適切に変更して有効にするための JSON 構文を見つけられない、または理解できないように見えることです。
私はこのクックブックを使用しています: https://github.com/realityforge/chef-glassfish
手順では、このような属性を変更して次のようなコードを入力する方法について説明しています。
# Create a basic domain that logs to a central graylog server
glassfish_domain "my_domain" do
port 80
admin_port 8103
extra_libraries ['https://github.com/downloads/realityforge/gelf4j/gelf4j-0.9-all.jar']
logging_properties {
"handlers" => "java.util.logging.ConsoleHandler, gelf4j.logging.GelfHandler",
".level" => "INFO",
"java.util.logging.ConsoleHandler.level" => "INFO",
"gelf4j.logging.GelfHandler.level" => "ALL",
"gelf4j.logging.GelfHandler.host" => 'graylog.example.org',
"gelf4j.logging.GelfHandler.defaultFields" => '{"environment": "' + node.chef_environment + '", "facility": "MyDomain"}'
}
end
ただし、ポートやドメイン名などの機能を変更したい場合は、これらの属性を次の構文で編集する必要があります (vagrantfile には既にあります)。
chef.json = {
"glassfish" => {
"base_dir" => "/usr/local/glassfish",
"domains_dir" => "/usr/local/glassfish/glassfish/domains",
"domains" => {
"domain1" => {
"config" => {
"domain_name" => "domain1",
"admin_port" => 4848,
"username" => "root",
"password" => "admin",
}
}
}
}
}
このコードは、このクックブックのレシピ「attribute_driven_domain」内でわかるように、open ステートメントがそのように記述されているため、私には理にかなっています。ドメインの最小メモリを編集する意味は、次のように入力します。
"glassfish" => {
"domains" => {
"domain1" => {
"config" => {
"min_memory" => 512
}
}
}
}
この ^ は、次のものに対応します。
['glassfish']
['domains']
['config']
['min_memory']
....レシピのこのセクションにあります:
gf_sort(node['glassfish']['domains']).each_pair do |domain_key, definition|
domain_key = domain_key.to_s
Chef::Log.info "Defining GlassFish Domain #{domain_key}"
admin_port = definition['config']['admin_port']
username = definition['config']['username']
secure = definition['config']['secure']
password_file = username ? "#{node['glassfish']['domains_dir']}/#{domain_key}_admin_passwd" : nil
system_username = definition['config']['system_user']
system_group = definition['config']['system_group']
if (definition['config']['port'] && definition['config']['port'] < 1024) || (admin_port && admin_port < 1024)
include_recipe 'authbind'
end
glassfish_domain domain_key do
min_memory definition['config']['min_memory'] if definition['config']['min_memory']
max_memory definition['config']['max_memory'] if definition['config']['max_memory']
max_perm_size definition['config']['max_perm_size'] if definition['config']['max_perm_size']
max_stack_size definition['config']['max_stack_size'] if definition['config']['max_stack_size']
port definition['config']['port'] if definition['config']['port']
ただし、安全な管理者を定義する部分では、chef.json ブロック内のどこに配置する必要があるかを示す明確な場所がわかりません。このセクションにあります:
glassfish_secure_admin "#{domain_key}: secure_admin" do
domain_name domain_key
admin_port admin_port if admin_port
username username if username
password_file password_file if password_file
secure secure if secure
system_user system_username if system_username
system_group system_group if system_group
action ('true' == definition['config']['remote_access'].to_s) ? :enable : :disable
end
私のvagrantfile内のchef.jsonブロックにsecure_admin属性を配置する場所がわからないようです。グラスフィッシュレベルの下、ドメインレベルの下、構成の下など、さまざまな場所に配置しようとしました。
正確に何をどこに置くべきか、本当にわかりません。
私はこれの変種を使用しています:
"secure_admin" => {
"domain_name" => "domain1"
"action" => :enable
}
または、domain1 の下にあるが config の上にある場合は、次のようになります。
"secure_admin" => {
"action" => :enable
}
ほとんどの場合、変更やエラーのフィードバックはありません。特定の場所に置かれた場合、別のドメインとして読み取ろうとするために失敗することがありますが、それ以外はあまりありません。
属性を変更するために現在使用している構文は正しくありませんか? 私はこのことについてかなり新鮮なので、よくわかりません。恐ろしく長い投稿で申し訳ありません。