Skip to content

Commit

Permalink
Merge pull request #282 from calcium-machine/develop-catapult
Browse files Browse the repository at this point in the history
RSync files via private ip between DigitalOcean Droplets, use public …
  • Loading branch information
seth-reeser committed Sep 16, 2015
2 parents f57dc29 + cbb1624 commit 12640d4
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 9 deletions.
2 changes: 1 addition & 1 deletion VERSION.yml
Original file line number Diff line number Diff line change
@@ -1 +1 @@
version: 1.7.6
version: 1.7.7
2 changes: 0 additions & 2 deletions provisioners/redhat/modules/iptables.sh
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
redhat_ip="$(echo "${configuration}" | shyaml get-value environments.${1}.servers.redhat.ip)"
redhat_ip_private="$(echo "${configuration}" | shyaml get-value environments.${1}.servers.redhat.ip)"

# list adapters
ifconfig
# remove all rules
sudo iptables --flush
# we're not a router
Expand Down
20 changes: 14 additions & 6 deletions provisioners/redhat/modules/rsync.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
if [ "${1}" == "dev" ]; then
test_redhat_ip="$(echo "${configuration}" | shyaml get-value environments.test.servers.redhat.ip)"
production_redhat_ip="$(echo "${configuration}" | shyaml get-value environments.production.servers.redhat.ip)"
else
test_redhat_ip="$(echo "${configuration}" | shyaml get-value environments.test.servers.redhat.ip_private)"
production_redhat_ip="$(echo "${configuration}" | shyaml get-value environments.production.servers.redhat.ip_private)"
fi

echo "${configuration}" | shyaml get-values-0 websites.apache |
while IFS='' read -r -d '' key; do

Expand All @@ -11,30 +19,30 @@ while IFS='' read -r -d '' key; do
elif [ "${software}" = "drupal6" ]; then
if ([ "${software_workflow}" = "downstream" ] && [ "$1" != "production" ]); then
echo -e "\t * rysncing /var/www/repositories/apache/${domain}/${webroot}sites/default/files/ from production..."
sudo rsync --compress --delete --recursive --exclude="css/" --exclude="js/" -e "ssh -oStrictHostKeyChecking=no -i /catapult/secrets/id_rsa" root@$(echo "${configuration}" | shyaml get-value environments.production.servers.redhat.ip):/var/www/repositories/apache/${domain}/${webroot}sites/default/files/ /var/www/repositories/apache/${domain}/${webroot}sites/default/files/ 2>&1 | sed "s/^/\t\t/"
sudo rsync --compress --delete --recursive --exclude="css/" --exclude="js/" -e "ssh -oStrictHostKeyChecking=no -i /catapult/secrets/id_rsa" "root@${production_redhat_ip}:/var/www/repositories/apache/${domain}/${webroot}sites/default/files/" "/var/www/repositories/apache/${domain}/${webroot}sites/default/files/" 2>&1 | sed "s/^/\t\t/"
elif ([ "${software_workflow}" = "upstream" ] && [ "$1" != "test" ]); then
echo -e "\t * rysncing /var/www/repositories/apache/${domain}/${webroot}sites/default/files/ from test..."
sudo rsync --compress --delete --recursive --exclude="css/" --exclude="js/" -e "ssh -oStrictHostKeyChecking=no -i /catapult/secrets/id_rsa" root@$(echo "${configuration}" | shyaml get-value environments.test.servers.redhat.ip):/var/www/repositories/apache/${domain}/${webroot}sites/default/files/ /var/www/repositories/apache/${domain}/${webroot}sites/default/files/ 2>&1 | sed "s/^/\t\t/"
sudo rsync --compress --delete --recursive --exclude="css/" --exclude="js/" -e "ssh -oStrictHostKeyChecking=no -i /catapult/secrets/id_rsa" "root@${test_redhat_ip}:/var/www/repositories/apache/${domain}/${webroot}sites/default/files/" "/var/www/repositories/apache/${domain}/${webroot}sites/default/files/" 2>&1 | sed "s/^/\t\t/"
else
echo -e "\t * software_workflow is set to ${software_workflow} and this is ${1} - no rsync needed, skipping..."
fi
elif [ "${software}" = "drupal7" ]; then
if ([ "${software_workflow}" = "downstream" ] && [ "$1" != "production" ]); then
echo -e "\t * rysncing /var/www/repositories/apache/${domain}/${webroot}sites/default/files/ from production..."
sudo rsync --compress --delete --recursive --exclude="css/" --exclude="js/" -e "ssh -oStrictHostKeyChecking=no -i /catapult/secrets/id_rsa" root@$(echo "${configuration}" | shyaml get-value environments.production.servers.redhat.ip):/var/www/repositories/apache/${domain}/${webroot}sites/default/files/ /var/www/repositories/apache/${domain}/${webroot}sites/default/files/ 2>&1 | sed "s/^/\t\t/"
sudo rsync --compress --delete --recursive --exclude="css/" --exclude="js/" -e "ssh -oStrictHostKeyChecking=no -i /catapult/secrets/id_rsa" "root@${production_redhat_ip}:/var/www/repositories/apache/${domain}/${webroot}sites/default/files/" "/var/www/repositories/apache/${domain}/${webroot}sites/default/files/" 2>&1 | sed "s/^/\t\t/"
elif ([ "${software_workflow}" = "upstream" ] && [ "$1" != "test" ]); then
echo -e "\t * rysncing /var/www/repositories/apache/${domain}/${webroot}sites/default/files/ from test..."
sudo rsync --compress --delete --recursive --exclude="css/" --exclude="js/" -e "ssh -oStrictHostKeyChecking=no -i /catapult/secrets/id_rsa" root@$(echo "${configuration}" | shyaml get-value environments.test.servers.redhat.ip):/var/www/repositories/apache/${domain}/${webroot}sites/default/files/ /var/www/repositories/apache/${domain}/${webroot}sites/default/files/ 2>&1 | sed "s/^/\t\t/"
sudo rsync --compress --delete --recursive --exclude="css/" --exclude="js/" -e "ssh -oStrictHostKeyChecking=no -i /catapult/secrets/id_rsa" "root@${test_redhat_ip}:/var/www/repositories/apache/${domain}/${webroot}sites/default/files/" "/var/www/repositories/apache/${domain}/${webroot}sites/default/files/" 2>&1 | sed "s/^/\t\t/"
else
echo -e "\t * software_workflow is set to ${software_workflow} and this is ${1} - no rsync needed, skipping..."
fi
elif [ "${software}" = "wordpress" ]; then
if ([ "${software_workflow}" = "downstream" ] && [ "$1" != "production" ]); then
echo -e "\t * rysncing /var/www/repositories/apache/${domain}/${webroot}wp-content/uploads/ from production..."
sudo rsync --compress --delete --recursive -e "ssh -oStrictHostKeyChecking=no -i /catapult/secrets/id_rsa" root@$(echo "${configuration}" | shyaml get-value environments.production.servers.redhat.ip):/var/www/repositories/apache/${domain}/${webroot}wp-content/uploads/ /var/www/repositories/apache/${domain}/${webroot}wp-content/uploads/ 2>&1 | sed "s/^/\t\t/"
sudo rsync --compress --delete --recursive -e "ssh -oStrictHostKeyChecking=no -i /catapult/secrets/id_rsa" "root@${production_redhat_ip}:/var/www/repositories/apache/${domain}/${webroot}wp-content/uploads/" "/var/www/repositories/apache/${domain}/${webroot}wp-content/uploads/" 2>&1 | sed "s/^/\t\t/"
elif ([ "${software_workflow}" = "upstream" ] && [ "$1" != "test" ]); then
echo -e "\t * rysncing /var/www/repositories/apache/${domain}/${webroot}wp-content/uploads/ from test..."
sudo rsync --compress --delete --recursive -e "ssh -oStrictHostKeyChecking=no -i /catapult/secrets/id_rsa" root@$(echo "${configuration}" | shyaml get-value environments.test.servers.redhat.ip):/var/www/repositories/apache/${domain}/${webroot}wp-content/uploads/ /var/www/repositories/apache/${domain}/${webroot}wp-content/uploads/ 2>&1 | sed "s/^/\t\t/"
sudo rsync --compress --delete --recursive -e "ssh -oStrictHostKeyChecking=no -i /catapult/secrets/id_rsa" "root@${test_redhat_ip}:/var/www/repositories/apache/${domain}/${webroot}wp-content/uploads/" "/var/www/repositories/apache/${domain}/${webroot}wp-content/uploads/" 2>&1 | sed "s/^/\t\t/"
else
echo -e "\t * software_workflow is set to ${software_workflow} and this is ${1} - no rsync needed, skipping..."
fi
Expand Down
2 changes: 2 additions & 0 deletions provisioners/redhat/provision.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ cat /proc/cpuinfo | grep 'model name' | cut -d: -f2 | awk 'NR==1' | tr -d " "
echo -e "$(top -bn 1 | awk '{print $9}' | tail -n +8 | awk '{s+=$1} END {print s}')% utilization"
echo -e "\nHDD"
df -h
echo -e "\nNET"
ifconfig
echo -e "\nRAM"
free -h

Expand Down

0 comments on commit 12640d4

Please sign in to comment.