-
Notifications
You must be signed in to change notification settings - Fork 0
Quick Notes
Martin H. Bramwell edited this page Mar 21, 2017
·
5 revisions
export SCRIPTPATH="${HOME}/tools/HabitatForMeteor/habitat/scripts";
export TARGET_SRVR="hab4metsrv";
export SETUP_USER="you";
export METEOR_SETTINGS_FILE="${HOME}/.ssh/hab_vault/settings.json";
export SOURCE_SECRETS_FILE="${HOME}/.ssh/hab_vault/secrets.sh";
export VIRTUAL_HOST_DOMAIN_NAME="moon.planet.sun";
export SOURCE_CERTS_DIR="/home/you/.ssh/hab_vault";
export YOUR_ORG="yourse1f-yourorg";
export YOUR_PKG="mmks";
${SCRIPTPATH}/PushInstallerScriptsToTarget.sh ${TARGET_SRVR} ${SETUP_USER} ${METEOR_SETTINGS_FILE} ${SOURCE_SECRETS_FILE}
${SCRIPTPATH}/PushSiteCertificateToTarget.sh ${TARGET_SRVR} ${SOURCE_SECRETS_FILE} ${SOURCE_CERTS_DIR} ${VIRTUAL_HOST_DOMAIN_NAME};
ssh hab@hab4metsrv ". ~/.bash_login && ~/HabitatPkgInstallerScripts/HabitatPackageRunner.sh ${VIRTUAL_HOST_DOMAIN_NAME} ${YOUR_ORG} ${YOUR_PKG} ${semver} ${timestamp}";
declare INCRON_TRIGGER="/etc/incron.d/fixNginxVar";
declare NGINX_DIR="/hab/svc/nginx";
declare NGINX_VAR_DIR="${NGINX_DIR}/var/";
declare NGINX_OWNERSHIP_FIXER="${NGINX_DIR}/hooks/postStartExec.sh";
#
sudo tee ${NGINX_OWNERSHIP_FIXER} <<EOHOOK >/dev/null
#!/usr/bin/env bash
logger "¬¬¬¬¬¬¬¬ ${INCRON_TRIGGER} ¬¬¬¬¬¬¬¬¬¬";
if [[ "$(stat -c '%U' ${NGINX_VAR_DIR})" = "hab" ]]; then exit 0; fi;
logger "++++ chown hab:hab ${NGINX_VAR_DIR} ++++++";
sleep 5;
chown hab:hab ${NGINX_VAR_DIR};
EOHOOK
sudo chown root:hab ${NGINX_OWNERSHIP_FIXER};
sudo chmod 660 ${NGINX_OWNERSHIP_FIXER};
sudo tee ${INCRON_TRIGGER} <<EOID >/dev/null
${NGINX_VAR_DIR} IN_ATTRIB ${NGINX_OWNERSHIP_FIXER}
EOID
sudo chown root:incron ${INCRON_TRIGGER};
sudo chmod 600 ${INCRON_TRIGGER};