Re: [Webistrano] Webistrano + Git + Ec2

96 views
Skip to first unread message

Jonathan Matthews

unread,
Jul 28, 2012, 2:43:21 PM7/28/12
to webis...@googlegroups.com
On 27 July 2012 23:02, Jeremy Rottman <rott...@gmail.com> wrote:
> I am working on a getting webistrano to work with git and deploy to an ec2
> server.
>
> The issue that I am having is since ssh_options can only have 1 key
> specified, I decided to just write a key to the servers on setup. However
> this is proving more difficult that previously expected.
>
> This is my current test method that I am working with. The issue that I am
> seeing is that then deploy_key is being written to a single line. Now I have
> tried adding '\n' at each line break but when the file is written out it
> adds a \ before each line break.

I do hope that private key isn't valuable ... :-)

Remember that 'run "echo blah > file"' is a bash command, and you need
to tell echo to respect escaped characters with "-e".
I suspect if you try enough combinations of inline newlines and flags
for echo, you'll find the solution.

You might be better off trying to shell out and create a file from a
variable's contents inside "irb" on your workstation, so you can
iterate through all the different permutations quickly without having
to do a web/cap run each time.

HTH,
Jonathan
--
Jonathan Matthews
Oxford, London, UK
http://www.jpluscplusm.com/contact.html

Jeremy Rottman

unread,
Jul 30, 2012, 7:24:12 PM7/30/12
to webis...@googlegroups.com
That key is a throw away key I was just testing with. 

I did in fact find a solution, it is a mild hack but does work.

This is the solution that I came up with:

    File.open("/home/#{user}/.ssh/id_rsa", "rb").each_line{ |line|
      run "echo #{line} >> ~/.ssh/id_rsa"
    }

Since all servers share the same github deployment key this solution does work.
Reply all
Reply to author
Forward
0 new messages