Custom Templates
CoffeeCP allows you to create custom installation templates.
Custom templates can be used to deploy CoffeeCP custom modules and configurations.
Important: if you create your own installation template, it must adhere to the CoffeeCP Directory Structure.
An example template is included below.
#!/bin/bash -e
# CoffeeCP
# Cited, Inc. 2017
# Usage Implies Acceptance of Terms
# https://coffeecp.com/terms-of-service.html
#----------------------------
# Set CoffeeCP Path
#----------------------------
COFFEECP_DIR='/usr/coffeecp'
#----------------------------
# Download the Base Files
#----------------------------
function get_coffeecp(){
mkdir -p ${COFFEECP_DIR}
pushd ${COFFEECP_DIR}
wget -P/tmp https://yourdomain.com/path/coffeecp.zip
unzip /tmp/coffeecp.zip
rm -f /tmp/coffeecp.zip
popd
}
#----------------------------
# Install the Mods
#----------------------------
function install_mods(){
PL_DIR='/usr/local/cpanel/base/frontend/paper_lantern'
for t in master manage version jdk mapping static; do
if [ ! -d "${PL_DIR}/coffeecp_${t}" ]; then
cp -rf "${COFFEECP_DIR}/coffeecp_${t}" "${PL_DIR}/coffeecp_${t}"
fi
done
pushd ${PL_DIR}
tar cfj coffeecp_master.tar.bz2 coffeecp_master
/usr/local/cpanel/scripts/install_plugin "${PL_DIR}/coffeecp_master.tar.bz2"
popd
}
#----------------------------
# Set Path for EA3 or EA4
#----------------------------
......
#----------------------------
# Set up crons
#----------------------------
......
#----------------------------
# Mark Completed if So
#----------------------------
.....
#----------------------------
# Copy NGASI Path to CoffeeCP
#----------------------------
....
#----------------------------
# Create Migration JSON
#----------------------------
....
#----------------------------
# Create Java Home for new install
#----------------------------
function is_clean(){
mkdir /usr/java
}
#----------------------------
# Copy NGASI app zip files
#----------------------------
....
#----------------------------
# NGASI or No NGASI
#----------------------------
if [ -d '/usr/ngasi' ]; then
for user in $(ls /home); do
if [ ! -d /home/${user}/appservers/ ]; then
continue;
fi
CATALINA_HOME=$(find /home/${user}/appservers/ -type d -name 'apache-tomcat-*' 2>/dev/null | sort -r | head -n1)
build_installed_json ${user}
done
else
if [ -d '/etc/apache2/conf.d' ]; then
mkdir -p /etc/apache2/conf.d/userdata/std
else
mkdir -p /usr/local/apache/conf/userdata/std
fi
is_clean
fi