Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

add the forward-agent configuration directive #10

Merged
merged 1 commit into from

2 participants

@bronson

I find agent forwarding easier to maintain and use than deploy keys.

Had a hard time wording the Readme blurb... feel free to edit the heck out of it. :)

@tj tj merged commit 273cdca into visionmedia:master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Apr 27, 2012
  1. @bronson
This page is out of date. Refresh to see the latest.
Showing with 32 additions and 22 deletions.
  1. +16 −8 Readme.md
  2. +16 −14 bin/deploy
View
24 Readme.md
@@ -53,7 +53,7 @@
### key (optional)
Path to identity file used by `ssh -i`.
-
+
key /path/to/some.pem
### ref (optional)
@@ -63,33 +63,41 @@
utilize the most recent tag by default, however this is useful
for a staging environment, as shown below where __HEAD__ is updated
and set to the develop branch.
-
+
ref origin/develop
### user
User for deployment.
-
+
user deployer
### host
Server hostname.
-
+
host 50.17.255.50
### repo
GIT repository to clone.
-
+
repo git@github.com:visionmedia/express.git
### path
Deployment path.
-
+
path /var/www/myapp.com
+### forward-agent
+
+ Webhosts normally use read-only deploy keys to access private git repositories.
+ If you'd rather use the credentials of the person invoking the deploy
+ command, put `forward-agent yes` in the relevant config sections.
+ Now the deploy script will invoke `ssh -A` when deploying and there's
+ no need to keep SSH keys on your servers.
+
### Hooks
All hooks are arbitrary commands, executed relative to `path/current`,
@@ -112,7 +120,7 @@
test ./something
-## License
+## License
(The MIT License)
@@ -135,4 +143,4 @@ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
-SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
View
30 bin/deploy
@@ -98,17 +98,25 @@ version() {
}
#
+# Return the ssh command to run.
+#
+
+ssh_command() {
+ local url="`config_get user`@`config_get host`"
+ local key="`config_get key`"
+ local forward_agent="`config_get forward-agent`"
+
+ test -n "$forward_agent" && local agent="-A"
+ test -n "$key" && local identity="-i $key"
+ echo "ssh $agent $identity $url"
+}
+
+#
# Run the given remote <cmd>.
#
run() {
- local url="`config_get user`@`config_get host`"
- local key=`config_get key`
- if test -n "$key"; then
- local shell="ssh -i $key $url"
- else
- local shell="ssh $url"
- fi
+ local shell="`ssh_command`"
echo $shell "\"$@\"" >> $LOG
$shell $@
}
@@ -118,13 +126,7 @@ run() {
#
console() {
- local url="`config_get user`@`config_get host`"
- local key=`config_get key`
- if test -n "$key"; then
- local shell="ssh -i $key $url"
- else
- local shell="ssh $url"
- fi
+ local shell="`ssh_command`"
echo $shell
exec $shell
}
Something went wrong with that request. Please try again.