Skip to content

Commit

Permalink
Add Memcached caching setup and environment variable
Browse files Browse the repository at this point in the history
  • Loading branch information
battlecow committed Dec 11, 2018
1 parent 22208ba commit 01bdf7f
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ MASTER_NODE_NAME -- Enable clustering, when set this container will be the maste
POD_NAME -- Enable Kubernetes clustering via downward API
POD_IP -- Enable Kubernetes clustering via downward API
MEMCACHED_HOST -- Enable Memcached caching, assumes port 11211 by default
```

## Data Persistence
Expand Down
22 changes: 22 additions & 0 deletions configuration.sh
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,20 @@ setup_java_opts() {
echo_time "\n\nJAVA_OPTS: $JAVA_OPTS \n\n"
}

create_cache_properties(){
echo_time "Setting up the cache.properties to be memcached"
cat <<-EOF > /usr/local/tomcat/webapps/ROOT/WEB-INF/classes/dal/cache.properties
cache.type=memcached
EOF
}

create_memcached_properties(){
echo_time "Setting up the memcached.properties"
cat <<-EOF > /usr/local/tomcat/webapps/ROOT/WEB-INF/classes/dal/memcached.properties
memcached.endpoints[0]=$MEMCACHED_HOST
EOF
}

##########################################################
# Arguments:
# Cluster master node name / ip
Expand Down Expand Up @@ -142,6 +156,14 @@ if [ ! -z "$MASTER_NODE_NAME" ]; then
create_cluster_properties $MASTER_NODE_NAME
fi

# Check for MEMCACHED_HOST environment variable to setup Memcached
if [ ! -z "$MEMCACHED_HOST" ]; then
echo_time "Memcached host is set, setup memcached settings"
create_cache_properties

create_memcached_properties
fi

setup_stdout_logging

setup_linux_logging_paths
Expand Down

0 comments on commit 01bdf7f

Please sign in to comment.