Skip to content

Commit

Permalink
update README, minor style changes
Browse files Browse the repository at this point in the history
  • Loading branch information
JasonEverling committed Feb 14, 2024
1 parent 95191cb commit 7e4b0c7
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 26 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#### Docker Ocie Image
Base image we use for our containers, Ocie itself is just a helper utility.
Default shell for Ubuntu is /bin/dash, this image sets /bin/sh to /bin/bash
Base image we use for our containers, Ocie itself is just an overlay utility.
Default shell, symlink for /bin/sh, in Ubuntu is /bin/dash, this image chages the symlink to /bin/bash

Note: no support provided, released on github for automated builds and registry publishing :D

Expand Down
21 changes: 10 additions & 11 deletions src/usr/lib/ocie/include/config/apache
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,7 @@ function add_cors()

function reset_config()
{
SITE_TEMPLATE=/etc/apache2/sites-available;

local site_template=/etc/apache2/sites-available;
if [[ -f "${APACHE_MODS}/rewrite.conf" ]];then
mv -f "${APACHE_MODS}/rewrite.conf" "${APACHE_MODS}/rewrite.conf.previous";
fi;
Expand All @@ -45,11 +44,11 @@ function reset_config()
fi;
if [[ -f "${APACHE_SITES}/000-default.conf" ]];then
mv -f "${APACHE_SITES}/000-default.conf" "${APACHE_SITES}/000-default.conf.previous";
cp -f "${SITE_TEMPLATE}/000-default.conf.dist" "${APACHE_SITES}/000-default.conf";
cp -f "${site_template}/000-default.conf.dist" "${APACHE_SITES}/000-default.conf";
fi;
if [[ -f "${APACHE_SITES}/default-ssl.conf" ]];then
mv -f "${APACHE_SITES}/default-ssl.conf" "${APACHE_SITES}/default-ssl.conf.previous";
cp -f "${SITE_TEMPLATE}/default-ssl.conf.dist" "${APACHE_SITES}/default-ssl.conf";
cp -f "${site_template}/default-ssl.conf.dist" "${APACHE_SITES}/default-ssl.conf";
fi;
}

Expand All @@ -69,23 +68,23 @@ else
echo "Ocie: Config: Rewriting all requests to: [ https ]";
add_default;
fi;
if [[ ! "${REWRITE_INDEX}" == "" ]];then
if [[ ! -z "${REWRITE_INDEX}" ]];then
echo "Ocie: Config: Rewriting all requests to: [ ${REWRITE_INDEX} ]";
add_framework;
fi;
if [[ "${REWRITE_CORS}" == 1 ]];then
echo "Ocie: Config: Adding CORS config for JSON to enabled site";
add_cors;
fi;
if [[ ! "${REWRITE_EXT}" == "" ]];then
if [[ ! "${REWRITE_INDEX}" = "" ]];then
if [[ ! -z "${REWRITE_EXT}" ]];then
if [[ ! -z "${REWRITE_INDEX}" ]];then
echo "Ocie: Config: Cannot configure both [ REWRITE_INDEX ] and [ REWRITE_EXT ], using [ REWRITE_INDEX ], value ${REWRITE_INDEX}";
else
echo "Ocie: Config: Rewriting all requests with the following extensions: [ ${REWRITE_EXT} ]";
add_extension;
fi;
fi;
if [[ ! "${REWRITE_EXCLUDE}" == "" ]];then
if [[ ! -z "${REWRITE_EXCLUDE}" ]];then
echo "Ocie: Config: Ecluding the following pattern from rewrite: [ ${REWRITE_EXCLUDE} ]";
add_exclude;
fi;
Expand All @@ -94,10 +93,10 @@ fi;
# Test config and print results
# Tomcat sources this script, only print if apache
if [[ ! "${APP_TYPE}" == "tomcat" ]];then
HTTPD_CFG=$(ociectl --test);
if [[ ! -z "${HTTPD_CFG}" ]];then
local httpd_cfg=$(ociectl --test);
if [[ ! -z "${httpd_cfg}" ]];then
echo "Ocie: Config: Test FAILED, reverting changes";
echo "Ocie: Config: Result: ${HTTPD_CFG}";
echo "Ocie: Config: Result: ${httpd_cfg}";
reset_config;
exit 1;
fi;
Expand Down
18 changes: 9 additions & 9 deletions src/usr/lib/ocie/include/config/tomcat
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
. ${OCIE_LIB}/include/config/apache;

# Tomcat specific
APP_PROXIES="$(echo ${VADC_IP_ADDRESS// /|} | sed 's/\./\\./g' | sed 's|\/|\\/|g')";
local app_proxies="$(echo ${VADC_IP_ADDRESS// /|} | sed 's/\./\\./g' | sed 's|\/|\\/|g')";
if [[ -f "${OCIE_HOME}/conf/ocie-tomcat.init" ]];then
reset_config;
fi;
Expand All @@ -13,15 +13,15 @@ function apache_mod_jk()
cp "${APACHE_MODS}/jk.conf.dist" "${APACHE_MODS}/jk.conf" >/dev/null 2>&1;
cp "${APACHE_MODS}/jk.load.dist" "${APACHE_MODS}/jk.load" >/dev/null 2>&1;
}

function tomcat_set_env()
{
echo "export JAVA_OPTS=\"${JAVA_OPTS} ${APP_PARAMS}\"" > ${CATALINA_HOME}/bin/setenv.sh
echo "export VADC_IP_REG=\"${APP_PROXIES}\"" >> ${CATALINA_HOME}/bin/setenv.sh
echo "export VADC_IP_REG=\"${app_proxies}\"" >> ${CATALINA_HOME}/bin/setenv.sh
chown ${APP_OWNER}:${APP_GROUP} "${CATALINA_HOME}/bin/setenv.sh";
chmod a+x "${CATALINA_HOME}/bin/setenv.sh";
}

function tomcat_server_cfg()
{
if [[ -f "${CATALINA_HOME}/conf/server.xml" ]];then
Expand All @@ -31,23 +31,23 @@ function tomcat_server_cfg()
cp "${CATALINA_HOME}/conf/server.xml.dist" "${CATALINA_HOME}/conf/server.xml" >/dev/null 2>&1;
fi;
}

# Set environment
tomcat_set_env;
# Enable libapache2-mod-jk
apache_mod_jk;

# Ensure config is valid
CATALINA_CFG=$(ociectl --test);
if [[ ! -z "${CATALINA_CFG}" ]];then
local catalina_cfg=$(ociectl --test);
if [[ ! -z "${catalina_cfg}" ]];then
echo "Ocie Config: Tomcat config test FAILED, reverting changes";
echo "Ocie Config: Result: ${CATALINA_CFG}";
echo "Ocie Config: Result: ${catalina_cfg}";
reset_config;
exit 1;
fi;

# Set ready
echo "Ocie Config: Tomcat Config Test PASSED, using updated configuration";
echo "Ocie Config: Tomcat RemoteIpValve configured with [internalProxies: ${APP_PROXIES}, remoteIpHeader: ${VADC_IP_HEADER}]";
echo "Ocie Config: Tomcat RemoteIpValve configured with [internalProxies: ${app_proxies}, remoteIpHeader: ${VADC_IP_HEADER}]";
echo "Ocie Config: Configured JAVA_OPTS with ${APP_PARAMS}";
echo "#Tomcat Initialized" > ${OCIE_HOME}/conf/ocie-tomcat.init;
8 changes: 4 additions & 4 deletions src/usr/lib/ocie/include/utils
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,13 @@ function print_msg()
# Get sha1 OR sha256 signature of directory/file, default: sha1
function get_signature()
{
object="$1";
option="${2,,}";
local object="$1";
local option="${2,,}";
if [[ -z "${option}" ]];then
option='sha1';
local option='sha1';
fi;
if [[ ! "${option}" == "sha1" ]] && [[ ! "${option}" == "sha256" ]];then
option='sha1';
local option='sha1';
fi;
if [[ -d "${object}" ]];then
echo "$(find ${object} -type f -print0 | xargs -0 sha1sum | sort | sha1sum | cut -f1 -d' ')";
Expand Down

0 comments on commit 7e4b0c7

Please sign in to comment.