Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix cli config command, cli log, jmx setting #4409

Merged
merged 10 commits into from Mar 18, 2017
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 8 additions & 0 deletions dockerfiles/base/scripts/base/commands/cmd_config.sh
Expand Up @@ -201,3 +201,11 @@ config_directory_is_empty() {
return 0
fi
}

skip_config() {
if [ "${CHE_SKIP_CONFIG}" = "true" ]; then
return 0
else
return 1
fi
}
8 changes: 4 additions & 4 deletions dockerfiles/base/scripts/base/library.sh
Expand Up @@ -276,7 +276,7 @@ stop_test_server() {

test1() {
HTTP_CODE=$(curl -I localhost:${AGENT_EXTERNAL_PORT}/alpine-release \
-s -o "${LOGS}" --connect-timeout 5 \
-s -o /dev/null --connect-timeout 5 \
--write-out '%{http_code}') || echo "28" >> "${LOGS}"

if check_http_code $HTTP_CODE; then
Expand All @@ -288,7 +288,7 @@ test1() {

test2() {
HTTP_CODE=$(curl -I ${AGENT_EXTERNAL_IP}:${AGENT_EXTERNAL_PORT}/alpine-release \
-s -o "${LOGS}" --connect-timeout 5 \
-s -o /dev/null --connect-timeout 5 \
--write-out '%{http_code}') || echo "28" >> "${LOGS}"

if check_http_code $HTTP_CODE; then
Expand All @@ -302,7 +302,7 @@ test3() {
HTTP_CODE=$(docker_run --entrypoint=curl \
$(eval "echo \${IMAGE_${CHE_PRODUCT_NAME}}") \
-I ${AGENT_EXTERNAL_IP}:${AGENT_EXTERNAL_PORT}/alpine-release \
-s -o "${LOGS}" \
-s -o /dev/null \
--write-out '%{http_code}')

if check_http_code $HTTP_CODE; then
Expand All @@ -316,7 +316,7 @@ test4() {
HTTP_CODE=$(docker_run --entrypoint=curl \
$(eval "echo \${IMAGE_${CHE_PRODUCT_NAME}}") \
-I ${AGENT_INTERNAL_IP}:${AGENT_INTERNAL_PORT}/alpine-release \
-s -o "${LOGS}" \
-s -o /dev/null \
--write-out '%{http_code}')

if check_http_code $HTTP_CODE; then
Expand Down
15 changes: 8 additions & 7 deletions dockerfiles/init/manifests/che.env
Expand Up @@ -78,23 +78,24 @@
# Since workspaces have their own runtimes, they have separate proxies that do not inherit
# from system proxies that you have configured for your Docker daemon.
#
# /etc/hosts
# This will add entries into the user's /etc/hosts file that is running within their
# workspace. You may need to configure this to give user's access to systems within
# your network or access to the Internet.
#CHE_MACHINE_EXTRA_HOSTS=NULL
# Extra Hosts for Workspaces
# Comma separated list of <HOST>:<IP> entries that will be added to the user's
# /etc/hosts file within their workspace runtimes. Configure this to give user
# access to systems within your network. This is set when DNS resolvers do not
# parse hostname entries properly.
#CHE_WORKSPACE_HOSTS=<HOST_1>:<IP_1>,<HOST_2>:<IP_2>

# Memory
# The recommended RAM size for new workspaces when created from the dashboard.
#CHE_MACHINE_DEFAULT_MEM_SIZE_MB=1024
#CHE_WORKSPACE_DEFAULT__MEMORY__MB=1024

# Memory Swap
# Adjust machine swap memory by multiplication current machnine memory on provided
# value. Default is 0 which means disabled swap, if set multiplier value equal to 0.5
# machine swap will be configured with size that equal to half of current machine memory.
# It should be rare that you would configure this. See Docker memory swap online
# for background.
#CHE_MACHINE_DOCKER_MEMORY_SWAP_MULTIPLIER=0
#CHE_DOCKER_SWAP=0

# Host Volume Mounts
# Semicolon separated list of volume mounts. Che will volume mount these host folders
Expand Down
22 changes: 4 additions & 18 deletions dockerfiles/init/manifests/che.pp
Expand Up @@ -2,7 +2,6 @@
##################################################################################################
$che_ip = getValue("CHE_HOST", "localhost")
$che_port = getValue("CHE_PORT", "8080")
$che_version = getValue("CHE_VERSION","nightly")
$che_instance = getValue("CHE_INSTANCE","/tmp/che")
$che_config = getValue("CHE_CONFIG","/path/to/che/che/puppet/sources")
$che_assembly = getValue("CHE_ASSEMBLY","/home/user/che")
Expand All @@ -13,21 +12,7 @@
$docker_ip = getValue("CHE_DOCKER_IP","172.17.0.1")
$docker_host = getValue("DOCKER_HOST","tcp://localhost:2375")
$che_user = getValue("CHE_USER","root")

###############################
# oAuth configurations
$google_client_id = getValue("CHE_GOOGLE_CLIENT_ID","your_google_client_id")
$google_secret = getValue("CHE_GOOGLE_SECRET","your_google_secret")
$github_client_id = getValue("CHE_GITHUB_CLIENT_ID","423531cf41d6c13e1b3b")
$github_secret = getValue("CHE_GITHUB_SECRET","e708bfc28c541a8f25feac4466c93611d9018a3d")
$bitbucket_client_id = getValue("CHE_BITBUCKET_CLIENT_ID","your_bitbucket_client_id")
$bitbucket_secret = getValue("CHE_BITBUCKET_SECRET","your_bitbucket_secret")
$wso2_client_id = getValue("CHE_WSO2_CLIENT_ID","your_wso2_client_id")
$wso2_secret = getValue("CHE_WSO2_SECRET","your_wso2_secret")
$projectlocker_client_id = getValue("CHE_PROJECTLOCKER_CLIENT_ID","your_projectlocker_client_id")
$projectlocker_secret = getValue("CHE_PROJECTLOCKER_SECRET","your_projectlocker_secret")
$microsoft_client_id = getValue("CHE_MICROSOFT_CLIENT_ID","your_microsoft_client_id")
$microsoft_secret = getValue("CHE_MICROSOFT_SECRET","your_microsoft_secret")
$che_server_xmx = getValue("CHE_SERVER_XMX","2048")

###############################
# Http proxy configuration
Expand All @@ -49,15 +34,16 @@

################################
# DNS resolver configuration
$dns_resolvers = getValue("CHE_DNS_RESOLVERS","")
$dns_resolvers = getValue("CHE_DNS_RESOLVERS","")

###############################
# Workspace configuration
#
$workspace_java_options = getValue("CHE_WORKSPACE_JAVA_OPTIONS", "-Xms256m -Xmx2048m -Djava.security.egd=file:/dev/./urandom")

$che_jmx_username = getValue("CHE_JMX_USERNAME", "admin")
$che_jmx_password = getValue("CHE_JMX_PASSWORD", "Che")
###############################
# Include base module
include base
}

27 changes: 20 additions & 7 deletions dockerfiles/init/modules/che/manifests/init.pp
@@ -1,17 +1,30 @@
class che {

# creating che.env
# creating che.env
file { "/opt/che/config/che.env":
ensure => "present",
content => template("che/che.env.erb"),
mode => "644",
}

if $che_dev_env == "on" {
file { "/opt/che/che.sh":
ensure => "present",
content => template("che/che.sh.erb"),
mode => "644",
}
}
file { "/opt/che/che.sh":
ensure => "present",
content => template("che/che.sh.erb"),
mode => "644",
}
}

# JMX
file { "/opt/che/config/jmxremote.access":
ensure => "present",
content => "$che_jmx_username readwrite",
mode => "644",
}

file { "/opt/che/config/jmxremote.password":
ensure => "present",
content => "$che_jmx_username $che_jmx_password",
mode => "644",
}
}
4 changes: 3 additions & 1 deletion dockerfiles/init/modules/che/templates/che.env.erb
Expand Up @@ -11,6 +11,8 @@ CHE_PORT=<%= scope.lookupvar('che::che_port') %>
#DOCKER_HOST=<%= scope.lookupvar('che::docker_host') %>
#DOCKER_MACHINE_HOST=<%= scope.lookupvar('che::docker_ip') %>

CATALINA_OPTS=-Dcom.sun.management.jmxremote=true -Djava.rmi.server.hostname=localhost -Dcom.sun.management.jmxremote.authenticate=true -Dcom.sun.management.jmxremote.password.file=/conf/jmxremote.password -Dcom.sun.management.jmxremote.access.file=/conf/jmxremote.access -Dcom.sun.management.jmxremote.ssl=false

<% if scope.lookupvar('che::che_env') != "production" -%>
CHE_DEBUG_SERVER=true
JPDA=jpda
Expand Down Expand Up @@ -60,7 +62,7 @@ JAVA_HTTPS_PROXY_PORT=-Dhttps.proxyPort=<%= @che_https_proxy.gsub(/^https?\:\/\/
<% if ! @che_no_proxy.empty? -%>
JAVA_NO_PROXY=-Dhttp.nonProxyHosts='<%= @che_no_proxy.gsub(/^https?\:\/\//, '').gsub(/^www./,'').split(",").uniq.join("|") %>|'
<% end -%>
JAVA_OPTS=-Xms512m -Djava.security.egd=file:/dev/./urandom -server -XX:+HeapDumpOnOutOfMemoryError -XX:+UseConcMarkSweepGC -XX:+CMSParallelRemarkEnabled -XX:+UseCMSInitiatingOccupancyOnly -XX:+ScavengeBeforeFullGC -XX:+CMSScavengeBeforeRemark <% if ! @che_http_proxy.empty? or ! @che_https_proxy.empty? -%>$JAVA_HTTP_PROXY_SET<% end -%> <% if ! @che_http_proxy.empty? -%>$JAVA_HTTP_PROXY_HOST $JAVA_HTTP_PROXY_PORT<% end -%> <% if ! @che_https_proxy.empty? -%>$JAVA_HTTPS_PROXY_HOST $JAVA_HTTPS_PROXY_PORT<% end -%><%- if ! @che_no_proxy.empty? -%> $JAVA_NO_PROXY<% end -%><% if @che_http_proxy.include? '@' -%> $JAVA_HTTP_USER_NAME $JAVA_HTTP_USER_PASSWORD<% end -%><% if @che_https_proxy.include? '@' -%> $JAVA_HTTPS_USER_NAME $JAVA_HTTPS_USER_PASSWORD<% end %>
JAVA_OPTS=-Xms512m -Xmx<%= @che_server_xmx %>m -Djava.security.egd=file:/dev/./urandom -server -XX:+HeapDumpOnOutOfMemoryError -XX:+UseConcMarkSweepGC -XX:+CMSParallelRemarkEnabled -XX:+UseCMSInitiatingOccupancyOnly -XX:+ScavengeBeforeFullGC -XX:+CMSScavengeBeforeRemark <% if ! @che_http_proxy.empty? or ! @che_https_proxy.empty? -%>$JAVA_HTTP_PROXY_SET<% end -%> <% if ! @che_http_proxy.empty? -%>$JAVA_HTTP_PROXY_HOST $JAVA_HTTP_PROXY_PORT<% end -%> <% if ! @che_https_proxy.empty? -%>$JAVA_HTTPS_PROXY_HOST $JAVA_HTTPS_PROXY_PORT<% end -%><%- if ! @che_no_proxy.empty? -%> $JAVA_NO_PROXY<% end -%><% if @che_http_proxy.include? '@' -%> $JAVA_HTTP_USER_NAME $JAVA_HTTP_USER_PASSWORD<% end -%><% if @che_https_proxy.include? '@' -%> $JAVA_HTTPS_USER_NAME $JAVA_HTTPS_USER_PASSWORD<% end %>

# java opts for ws agent
CHE_WORKSPACE_JAVA_OPTIONS=<%= scope.lookupvar('che::workspace_java_options') %> <% if ! @http_proxy_for_che_workspaces.empty? or ! @https_proxy_for_che_workspaces.empty? -%>-Dhttp.proxySet=true<% end -%><% if ! @http_proxy_for_che_workspaces.empty? -%><% if ! @http_proxy_for_che_workspaces.empty? and @http_proxy_for_che_workspaces.include? '@' -%> -Dhttp.proxyUser=<%= @http_proxy_for_che_workspaces.gsub(/^https?\:\/\//, '').gsub(/^www./,'').split('@')[0].split(':')[0] %> -Dhttp.proxyPassword=<%= @http_proxy_for_che_workspaces.gsub(/^https?\:\/\//, '').gsub(/^www./,'').split('@')[0].split(':')[1] %> -Dhttp.proxyHost=<%= @http_proxy_for_che_workspaces.gsub(/^https?\:\/\//, '').gsub(/^www./,'').split('@')[1].split(':')[0] %> -Dhttp.proxyPort=<%= @http_proxy_for_che_workspaces.gsub(/^https?\:\/\//, '').gsub(/^www./,'').split('@')[1].split(':')[1].gsub(/\/.*/,'') %><% else -%> -Dhttp.proxyHost=<%= @http_proxy_for_che_workspaces.gsub(/^https?\:\/\//, '').gsub(/^www./,'').split(':')[0] %> -Dhttp.proxyPort=<%= @http_proxy_for_che_workspaces.gsub(/^https?\:\/\//, '').gsub(/^www./,'').split(':')[1].gsub(/\/.*/,'') %><% end -%><% end -%><% if ! @https_proxy_for_che_workspaces.empty? -%><% if @https_proxy_for_che_workspaces.include? '@' -%> -Dhttps.proxyUser=<%= @https_proxy_for_che_workspaces.gsub(/^https?\:\/\//, '').gsub(/^www./,'').split('@')[0].split(':')[0] %> -Dhttps.proxyPassword=<%= @https_proxy_for_che_workspaces.gsub(/^https?\:\/\//, '').gsub(/^www./,'').split('@')[0].split(':')[1] %> -Dhttps.proxyHost=<%= @https_proxy_for_che_workspaces.gsub(/^https?\:\/\//, '').gsub(/^www./,'').split('@')[1].split(':')[0] %> -Dhttps.proxyPort=<%= @https_proxy_for_che_workspaces.gsub(/^https?\:\/\//, '').gsub(/^www./,'').split('@')[1].split(':')[1].gsub(/\/.*/,'') %><% else -%> -Dhttps.proxyHost=<%= @https_proxy_for_che_workspaces.gsub(/^https?\:\/\//, '').gsub(/^www./,'').split(':')[0] %> -Dhttps.proxyPort=<%= @https_proxy_for_che_workspaces.gsub(/^https?\:\/\//, '').gsub(/^www./,'').split(':')[1].gsub(/\/.*/,'') %><% end -%><% end -%><% if ! @che_no_proxy.empty? -%> -Dhttp.nonProxyHosts='<%= @no_proxy_for_che_workspaces.gsub(/^https?\:\/\//, '').gsub(/^www./,'').split(",").uniq.join("|") %>|'<% end -%>
Expand Up @@ -24,6 +24,8 @@ che:
- '/etc/passwd:/etc/passwd:ro'
<% end -%>
ports:
- '32001:32001'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what are these ports ? JMX ?
I would say they should be exposed only if a property is defined

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes jmx and it is always defined as we always generate jmx config

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes but should it be exposed only if --debug is enabled for example ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i don't think this is related to debug,in codenvy we have this always available. for example some monitoring tools require jmx connection and you may monitor app in production mode

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

well I would say that it should be turned off by default (or an option to turn it off) as you may not require JMX at all

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i've added possibility to enable/disable jmx (disabled by default)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wonderful

- '32101:32101'
- '<%= scope.lookupvar('che::che_port') -%>:<%= scope.lookupvar('che::che_port') -%>'
<% if scope.lookupvar('che::che_env') == 'development' -%>
- '<%= scope.lookupvar('che::che_debug_port') -%>:<%= scope.lookupvar('che::che_debug_port') -%>'
Expand Down