Last active
April 5, 2017 07:25
-
-
Save mcouthon/6c51aa6089b475d02a8b5ee3490352b2 to your computer and use it in GitHub Desktop.
A script to synchronize local code with code on a remote manager
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if [ $# -eq 0 ]; then | |
echo "Need to provide an IP for the script to work" | |
exit 1 | |
fi | |
IP=$1 | |
USER=${2:-centos} # Set default user to centos | |
KEY=${3:-"~/.ssh/id_rsa"} | |
REPOS_DIR=/Users/pavel/dev/repos | |
MGMTWORKER_DIR=/opt/mgmtworker/env/lib/python2.7/site-packages | |
MANAGER_DIR=/opt/manager/env/lib/python2.7/site-packages | |
ssh ${USER}@${IP} -i ${KEY} 'sudo chown -R ${USER}:${USER} /opt/mgmtworker/env/lib/python2.7/site-packages' | |
ssh ${USER}@${IP} -i ${KEY} 'sudo chown -R ${USER}:${USER} /opt/manager/env/lib/python2.7/site-packages' | |
ssh ${USER}@${IP} -i ${KEY} 'sudo chown -R ${USER}:${USER} /opt/manager/resources/cloudify' | |
ssh ${USER}@${IP} -i ${KEY} 'sudo /opt/mgmtworker/env/bin/pip install pydevd' | |
ssh ${USER}@${IP} -i ${KEY} 'sudo /opt/manager/env/bin/pip install pydevd' | |
# mgmtworker | |
rsync -avz ${REPOS_DIR}/cloudify-plugins-common/cloudify ${USER}@${IP}:${MGMTWORKER_DIR} --exclude '*.pyc' -e "ssh -i ${KEY}" | |
rsync -avz ${REPOS_DIR}/cloudify-agent/cloudify_agent ${USER}@${IP}:${MGMTWORKER_DIR} --exclude '*.pyc' -e "ssh -i ${KEY}" | |
rsync -avz ${REPOS_DIR}/cloudify-rest-client/cloudify_rest_client ${USER}@${IP}:${MGMTWORKER_DIR} --exclude '*.pyc' -e "ssh -i ${KEY}" | |
rsync -avz ${REPOS_DIR}/cloudify-manager/workflows/cloudify_system_workflows ${USER}@${IP}:${MGMTWORKER_DIR} --exclude '*.pyc' -e "ssh -i ${KEY}" | |
# manager | |
rsync -avz ${REPOS_DIR}/cloudify-agent/cloudify_agent ${USER}@${IP}:${MANAGER_DIR} --exclude '*.pyc' -e "ssh -i ${KEY}" | |
rsync -avz ${REPOS_DIR}/cloudify-rest-client/cloudify_rest_client ${USER}@${IP}:${MANAGER_DIR} --exclude '*.pyc' -e "ssh -i ${KEY}" | |
rsync -avz ${REPOS_DIR}/cloudify-premium/cloudify_premium ${USER}@${IP}:${MANAGER_DIR} --exclude '*.pyc' -e "ssh -i ${KEY}" | |
rsync -avz ${REPOS_DIR}/cloudify-manager/rest-service/manager_rest ${USER}@${IP}:${MANAGER_DIR} --exclude '*.pyc' -e "ssh -i ${KEY}" | |
rsync -avz ${REPOS_DIR}/cloudify-dsl-parser/dsl_parser ${USER}@${IP}:${MANAGER_DIR} --exclude '*.pyc' -e "ssh -i ${KEY}" | |
# resources | |
rsync -avz ${REPOS_DIR}/cloudify-manager/resources/rest-service/cloudify ${USER}@${IP}:/opt/manager/resources --exclude '*.pyc' -e "ssh -i ${KEY}" | |
ssh ${USER}@${IP} -i ${KEY} 'sudo systemctl restart cloudify-mgmtworker' | |
ssh ${USER}@${IP} -i ${KEY} 'sudo systemctl restart cloudify-restservice' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment