Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Comparing changes

Choose two branches to see what's changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
...
Checking mergeability… Don't worry, you can still create the pull request.
  • 6 commits
  • 5 files changed
  • 0 commit comments
  • 1 contributor
View
1  bin/deliver
@@ -24,6 +24,7 @@ __load_app_config
__default_app_config
__apply_runtime_configs
__load_strategy
+__remote_hosts
__check_config
View
6 bin/multi
@@ -1,11 +1,11 @@
#!/usr/bin/env bash
-HOSTS="nginx-1,nginx-2"
+HOSTS="timeseries@ruby-1-local,timeseries@ruby-2-local"
# http://www.gnu.org/software/parallel/man.html#example__running_the_same_command_on_remote_computers
echo "||| PARALLEL |||"
time parallel --tag --nonall -S $HOSTS 'df -h'
echo -e "\n\n... SEQUENTIAL ..."
-time ssh nginx-1 -T 'df -h'
-time ssh nginx-2 -T 'df -h'
+time ssh ruby-1-local -T 'df -h'
+time ssh ruby-2-local -T 'df -h'
View
2  libexec/app_config
@@ -36,4 +36,4 @@ fi
# From the time when deliver was single-server
#
-SERVERS="$SERVER $SERVERS"
+SERVERS=$(__parallel_friendly "$SERVER $SERVERS")
View
8 libexec/common
@@ -16,8 +16,8 @@ init_app_remotely() {
fi
"
- if [[ ! $git_remote =~ "$REMOTE:$DELIVER_TO" ]] || [[ ! $git_remote =~ $DELIVER_REMOTE ]]; then
- [[ $git_remote =~ $DELIVER_REMOTE ]] && git remote rm $DELIVER_REMOTE
- git remote add $DELIVER_REMOTE $REMOTE:$DELIVER_TO
- fi
+ #if [[ ! $git_remote =~ "$REMOTE:$DELIVER_TO" ]] || [[ ! $git_remote =~ $DELIVER_REMOTE ]]; then
+ #[[ $git_remote =~ $DELIVER_REMOTE ]] && git remote rm $DELIVER_REMOTE
+ #git remote add $DELIVER_REMOTE $REMOTE:$DELIVER_TO
+ #fi
}
View
33 libexec/core
@@ -8,26 +8,33 @@ __complain_if_interrupted() {
trap "exit 2" 1 2 3 13 15
}
+# Ensures args (in this case hosts) are in a format that parallel understands
+# e.g. " ruby-1 ruby-2" -> "ruby-1,ruby-2"
+#
+__parallel_friendly() {
+ echo $@ | tr ' ' ',' | sed 's/^,//' | sed 's/,$//'
+}
+
# If these values are specified at the runtime, hang onto them
# until we're ready to overwrite everything set from other sources
#
__capture_runtime_configs() {
RUNTIME_STRATEGY=$STRATEGY
- RUNTIME_SERVERS=$(echo "$SERVER $SERVERS" | tr ' ' ',')
+ RUNTIME_SERVERS=$(__parallel_friendly "$SERVER $SERVERS")
}
# If STRATEGY or SERVERS are specified at the time of invoking, overwrite
# anything that has been set from other sources
#
__apply_runtime_configs() {
- if [ ! -z "$RUNTIME_STRATEGY" ]
+ if [ -n "$RUNTIME_STRATEGY" ]
then
STRATEGY="$RUNTIME_STRATEGY"
fi
# The tr when joining $SERVER with $SERVERS
# Review this
- if [ ! "$RUNTIME_SERVERS" = ',' ]
+ if [ -n "${RUNTIME_SERVERS/ /}" ]
then
SERVERS="$RUNTIME_SERVERS"
fi
@@ -94,10 +101,19 @@ __load_strategy() {
fi
}
-__check_config() {
- # Ensure these are in the correct format
- SERVERS=$(echo $SERVERS | sed 's/^,//' | sed 's/,$//')
+# Appends app user to all hosts so that we can log in with this user
+# on specific remote tasks. Formats all servers in a format parallel can work with.
+#
+__remote_hosts() {
+ for server in $SERVERS
+ do
+ SERVERS_APP_USER="$SERVERS_APP_USER,$APP_USER@$server"
+ done
+ SERVERS=$(__parallel_friendly $SERVERS)
+ SERVERS_APP_USER=$(__parallel_friendly $SERVERS_APP_USER)
+}
+__check_config() {
if [ ! -z "$CHECK" ]
then
set -f # disables file globbing
@@ -209,6 +225,9 @@ __exec() {
__remote() {
if [ ! $MODE = "test" ]
then
- ssh $APP_USER@$SERVER $1
+ local _command=$1
+ local _hosts=${2:-"$SERVERS_APP_USER"}
+
+ parallel --tag --nonall -S $_hosts $_command
fi
}

No commit comments for this range

Something went wrong with that request. Please try again.