Skip to content

Commit

Permalink
Merge pull request #60 from dhirajsb/master
Browse files Browse the repository at this point in the history
Fixed OSFUSE-467,OSFUSE-468,OSFUSE-419,OSFUSE-260
  • Loading branch information
dhirajsb authored Jan 12, 2017
2 parents 3f27ac3 + a2ce45e commit 1f0d2b8
Show file tree
Hide file tree
Showing 14 changed files with 55 additions and 34 deletions.
15 changes: 7 additions & 8 deletions java/images/jboss/s2i/assemble
Original file line number Diff line number Diff line change
Expand Up @@ -170,15 +170,14 @@ elif [ -f "${S2I_SOURCE_DIR}/Dockerfile" ] && [ -d "${S2I_SOURCE_DIR}/maven" ];
echo "Copying binaries from ${binary_dir} to ${DEPLOYMENTS_DIR} ..."
copy_dir ${binary_dir} ${DEPLOYMENTS_DIR}
check_error "copying ${binary_dir} to ${DEPLOYMENTS_DIR}" $?
elif [ -d "${S2I_SOURCE_DIR}" ] && [ `ls -1 | grep "^.*.jar$" | wc -l` -eq 1 ]; then
# This is a streamed binary build.
echo "S2I streamed binary build detected"
binary_dir="${S2I_SOURCE_DIR}"
echo "Copying streamed binaries from ${binary_dir} to ${DEPLOYMENTS_DIR} ..."
copy_dir ${binary_dir} ${DEPLOYMENTS_DIR}
check_error "copying ${binary_dir} to ${DEPLOYMENTS_DIR}" $?
else
binary_dir="${ARTIFACT_DIR:-${S2I_SOURCE_DIR}/deployments}"
echo "S2I streamed binary build detected"
if [ -d "${S2I_SOURCE_DIR}/deployments" ]; then
default_binary_dir="${S2I_SOURCE_DIR}/deployments"
else
default_binary_dir="${S2I_SOURCE_DIR}"
fi
binary_dir="${ARTIFACT_DIR:-${default_binary_dir}}"
# Assuming that the source already contains compiled artefacts
echo "Copying binaries from ${binary_dir} to ${DEPLOYMENTS_DIR} ..."
copy_dir ${binary_dir} ${DEPLOYMENTS_DIR}
Expand Down
15 changes: 7 additions & 8 deletions java/images/rhel/s2i/assemble
Original file line number Diff line number Diff line change
Expand Up @@ -170,15 +170,14 @@ elif [ -f "${S2I_SOURCE_DIR}/Dockerfile" ] && [ -d "${S2I_SOURCE_DIR}/maven" ];
echo "Copying binaries from ${binary_dir} to ${DEPLOYMENTS_DIR} ..."
copy_dir ${binary_dir} ${DEPLOYMENTS_DIR}
check_error "copying ${binary_dir} to ${DEPLOYMENTS_DIR}" $?
elif [ -d "${S2I_SOURCE_DIR}" ] && [ `ls -1 | grep "^.*.jar$" | wc -l` -eq 1 ]; then
# This is a streamed binary build.
echo "S2I streamed binary build detected"
binary_dir="${S2I_SOURCE_DIR}"
echo "Copying streamed binaries from ${binary_dir} to ${DEPLOYMENTS_DIR} ..."
copy_dir ${binary_dir} ${DEPLOYMENTS_DIR}
check_error "copying ${binary_dir} to ${DEPLOYMENTS_DIR}" $?
else
binary_dir="${ARTIFACT_DIR:-${S2I_SOURCE_DIR}/deployments}"
echo "S2I streamed binary build detected"
if [ -d "${S2I_SOURCE_DIR}/deployments" ]; then
default_binary_dir="${S2I_SOURCE_DIR}/deployments"
else
default_binary_dir="${S2I_SOURCE_DIR}"
fi
binary_dir="${ARTIFACT_DIR:-${default_binary_dir}}"
# Assuming that the source already contains compiled artefacts
echo "Copying binaries from ${binary_dir} to ${DEPLOYMENTS_DIR} ..."
copy_dir ${binary_dir} ${DEPLOYMENTS_DIR}
Expand Down
15 changes: 7 additions & 8 deletions java/templates/s2i/assemble
Original file line number Diff line number Diff line change
Expand Up @@ -170,15 +170,14 @@ elif [ -f "${S2I_SOURCE_DIR}/Dockerfile" ] && [ -d "${S2I_SOURCE_DIR}/maven" ];
echo "Copying binaries from ${binary_dir} to ${DEPLOYMENTS_DIR} ..."
copy_dir ${binary_dir} ${DEPLOYMENTS_DIR}
check_error "copying ${binary_dir} to ${DEPLOYMENTS_DIR}" $?
elif [ -d "${S2I_SOURCE_DIR}" ] && [ `ls -1 | grep "^.*.jar$" | wc -l` -eq 1 ]; then
# This is a streamed binary build.
echo "S2I streamed binary build detected"
binary_dir="${S2I_SOURCE_DIR}"
echo "Copying streamed binaries from ${binary_dir} to ${DEPLOYMENTS_DIR} ..."
copy_dir ${binary_dir} ${DEPLOYMENTS_DIR}
check_error "copying ${binary_dir} to ${DEPLOYMENTS_DIR}" $?
else
binary_dir="${ARTIFACT_DIR:-${S2I_SOURCE_DIR}/deployments}"
echo "S2I streamed binary build detected"
if [ -d "${S2I_SOURCE_DIR}/deployments" ]; then
default_binary_dir="${S2I_SOURCE_DIR}/deployments"
else
default_binary_dir="${S2I_SOURCE_DIR}"
fi
binary_dir="${ARTIFACT_DIR:-${default_binary_dir}}"
# Assuming that the source already contains compiled artefacts
echo "Copying binaries from ${binary_dir} to ${DEPLOYMENTS_DIR} ..."
copy_dir ${binary_dir} ${DEPLOYMENTS_DIR}
Expand Down
3 changes: 3 additions & 0 deletions karaf/images/jboss/deploy-and-run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,9 @@ if [ -n "${KARAF_ASSEMBLY_DIR}" ] && [ -d "${KARAF_ASSEMBLY_DIR}" ]; then
# send log output to stdout
sed -i 's/^\(.*rootLogger.*\), *out *,/\1, stdout,/' ${DIR}/karaf/etc/org.ops4j.pax.logging.cfg

# allow overriding defaults in setenv
sed -i 's/^\(JAVA_.*\)=\([^ ]*\)/\1=${\1:-\2}/' ${DIR}/karaf/bin/setenv

# Launch Karaf using S2I script
exec /usr/local/s2i/run
else
Expand Down
4 changes: 1 addition & 3 deletions karaf/images/jboss/java-default-options
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ max_memory() {
local max_mem="${CONTAINER_MAX_MEMORY}"
local ratio=${JAVA_MAX_MEM_RATIO:-50}
local mx=$(echo "${max_mem} ${ratio} 1048576" | awk '{printf "%d\n" , ($1*$2)/(100*$3) + 0.5}')
# echo "-Xmx${mx}m"
echo "${mx}m"
fi
}
Expand All @@ -67,15 +66,14 @@ cpu_core_tunning() {
fi
echo "-XX:ParallelGCThreads=${core_limit} " \
"-XX:ConcGCThreads=${core_limit} " \
"-XX:ParallelGCThreads=${core_limit} " \
"-Djava.util.concurrent.ForkJoinPool.common.parallelism=${core_limit}"
fi
}

## Echo options, trimming trailing and multiple spaces
#echo "$(max_memory) $(diagnostics) $(cpu_core_tunning)" | awk '$1=$1'
# Set Karaf options
mxmem=${max_memory}
mxmem=$(max_memory)
if [ "x$mxmem" != x ]; then
export JAVA_MAX_MEM=$mxmem
fi
Expand Down
3 changes: 3 additions & 0 deletions karaf/images/jboss/s2i/assemble
Original file line number Diff line number Diff line change
Expand Up @@ -182,4 +182,7 @@ fi
# send log output to stdout
sed -i 's/^\(.*rootLogger.*\), *out *,/\1, stdout,/' ${DEPLOYMENTS_DIR}/karaf/etc/org.ops4j.pax.logging.cfg

# allow overriding defaults in setenv
sed -i 's/^\(JAVA_.*\)=\([^ ]*\)/\1=${\1:-\2}/' ${DEPLOYMENTS_DIR}/karaf/bin/setenv

echo "...done!"
4 changes: 2 additions & 2 deletions karaf/images/rhel/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,8 @@ ADD README.md /usr/local/s2i/usage.txt

# Copy deploy-and-run.sh for standalone images
# Necessary to permit running with a randomised UID
COPY deploy-and-run.sh container-limits java-default-options /deployments/
RUN chmod a+x /deployments/deploy-and-run.sh /deployments/container-limits /deployments/java-default-options \
COPY deploy-and-run.sh container-limits debug-options java-default-options /deployments/
RUN chmod a+x /deployments/deploy-and-run.sh /deployments/container-limits /deployments/debug-options /deployments/java-default-options \
&& chmod a+x /usr/local/s2i/* \
&& chmod -R "g+rwX" /deployments \
&& chown -R jboss:root /deployments
Expand Down
3 changes: 3 additions & 0 deletions karaf/images/rhel/deploy-and-run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,9 @@ if [ -n "${KARAF_ASSEMBLY_DIR}" ] && [ -d "${KARAF_ASSEMBLY_DIR}" ]; then
# send log output to stdout
sed -i 's/^\(.*rootLogger.*\), *out *,/\1, stdout,/' ${DIR}/karaf/etc/org.ops4j.pax.logging.cfg

# allow overriding defaults in setenv
sed -i 's/^\(JAVA_.*\)=\([^ ]*\)/\1=${\1:-\2}/' ${DIR}/karaf/bin/setenv

# Launch Karaf using S2I script
exec /usr/local/s2i/run
else
Expand Down
5 changes: 2 additions & 3 deletions karaf/images/rhel/java-default-options
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ max_memory() {
local max_mem="${CONTAINER_MAX_MEMORY}"
local ratio=${JAVA_MAX_MEM_RATIO:-50}
local mx=$(echo "${max_mem} ${ratio} 1048576" | awk '{printf "%d\n" , ($1*$2)/(100*$3) + 0.5}')
echo "-Xmx${mx}m"
echo "${mx}m"
fi
}

Expand All @@ -66,15 +66,14 @@ cpu_core_tunning() {
fi
echo "-XX:ParallelGCThreads=${core_limit} " \
"-XX:ConcGCThreads=${core_limit} " \
"-XX:ParallelGCThreads=${core_limit} " \
"-Djava.util.concurrent.ForkJoinPool.common.parallelism=${core_limit}"
fi
}

## Echo options, trimming trailing and multiple spaces
#echo "$(max_memory) $(diagnostics) $(cpu_core_tunning)" | awk '$1=$1'
# Set Karaf options
mxmem=${max_memory}
mxmem=$(max_memory)
if [ "x$mxmem" != x ]; then
export JAVA_MAX_MEM=$mxmem
fi
Expand Down
3 changes: 3 additions & 0 deletions karaf/images/rhel/s2i/assemble
Original file line number Diff line number Diff line change
Expand Up @@ -182,4 +182,7 @@ fi
# send log output to stdout
sed -i 's/^\(.*rootLogger.*\), *out *,/\1, stdout,/' ${DEPLOYMENTS_DIR}/karaf/etc/org.ops4j.pax.logging.cfg

# allow overriding defaults in setenv
sed -i 's/^\(JAVA_.*\)=\([^ ]*\)/\1=${\1:-\2}/' ${DEPLOYMENTS_DIR}/karaf/bin/setenv

echo "...done!"
4 changes: 2 additions & 2 deletions karaf/templates/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,8 @@ ADD README.md /usr/local/s2i/usage.txt

# Copy deploy-and-run.sh for standalone images
# Necessary to permit running with a randomised UID
COPY deploy-and-run.sh container-limits java-default-options /deployments/
RUN chmod a+x /deployments/deploy-and-run.sh /deployments/container-limits /deployments/java-default-options \
COPY deploy-and-run.sh container-limits debug-options java-default-options /deployments/
RUN chmod a+x /deployments/deploy-and-run.sh /deployments/container-limits /deployments/debug-options /deployments/java-default-options \
&& chmod a+x /usr/local/s2i/* \
&& chmod -R "g+rwX" /deployments \
&& chown -R jboss:root /deployments
Expand Down
3 changes: 3 additions & 0 deletions karaf/templates/deploy-and-run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,9 @@ if [ -n "${KARAF_ASSEMBLY_DIR}" ] && [ -d "${KARAF_ASSEMBLY_DIR}" ]; then
# send log output to stdout
sed -i 's/^\(.*rootLogger.*\), *out *,/\1, stdout,/' ${DIR}/karaf/etc/org.ops4j.pax.logging.cfg

# allow overriding defaults in setenv
sed -i 's/^\(JAVA_.*\)=\([^ ]*\)/\1=${\1:-\2}/' ${DIR}/karaf/bin/setenv

# Launch Karaf using S2I script
exec /usr/local/s2i/run
else
Expand Down
3 changes: 3 additions & 0 deletions karaf/templates/s2i/assemble
Original file line number Diff line number Diff line change
Expand Up @@ -182,4 +182,7 @@ fi
# send log output to stdout
sed -i 's/^\(.*rootLogger.*\), *out *,/\1, stdout,/' ${DEPLOYMENTS_DIR}/karaf/etc/org.ops4j.pax.logging.cfg

# allow overriding defaults in setenv
sed -i 's/^\(JAVA_.*\)=\([^ ]*\)/\1=${\1:-\2}/' ${DEPLOYMENTS_DIR}/karaf/bin/setenv

echo "...done!"
9 changes: 9 additions & 0 deletions karaf/templates/s2i/run
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,15 @@ if [ -f "${DEPLOYMENTS_DIR}/java-default-options" ]; then
source "${DEPLOYMENTS_DIR}/java-default-options"
fi

# set debug option
if [ -f "${DEPLOYMENTS_DIR}/debug-options" ]; then
debug_opts=$($DEPLOYMENTS_DIR/debug-options)
if [ "x${debug_opts}" != x ]; then
export JAVA_DEBUG_OPTS=$($DEPLOYMENTS_DIR/debug-options)
export KARAF_DEBUG="true"
fi
fi

# Output from assemble script
echo "Executing ${DEPLOYMENTS_DIR}/karaf/bin/karaf server ..."
export DEPLOYMENTS_DIR
Expand Down

0 comments on commit 1f0d2b8

Please sign in to comment.