我目前使用的流浪通過chef_solo菜譜安裝GlassFish服務器JSON屬性語法/使用。一切正常安裝,我可以訪問服務器,但它需要我啓用secure_admin從我的主機遠程訪問服務器。流浪 -
的問題在於,我似乎無法找到,或瞭解流浪適當修改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」內看到,打開的語句被描述爲這樣。含義編輯域的最小內存,我將不得不類型:
"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
我似乎無法找出其中的secure_admin屬性是假設我vagrantfile內放置在chef.json塊。我已經嘗試將它置於不同的位置,例如在glassfish級別下,在配置下的域級別下。
我真的不知道我究竟想放,或在哪裏。
我一直在使用這個變量:
"secure_admin" => {
"domain_name" => "domain1"
"action" => :enable
}
或類似這樣的,如果它是在域1,但上面的配置:
"secure_admin" => {
"action" => :enable
}
大多數時候它並沒有給任何反饋改變或錯誤,有時如果它放在某些地方,它會失敗,因爲它試圖把它作爲一個單獨的域來讀取,但除此之外不是那麼多。
我目前用來修改屬性的語法不正確嗎?我對這個東西很滿意,所以我不知道。對不起,這個帖子非常長。
啊,我以爲我在代碼中遇到過這種情況。我不確定我是否曾嘗試過,但我會回到這裏。謝謝! – Jessman123
設置(「remote_access」=> true)正常工作!謝謝! – Jessman123