cityindex-attic / logsearch-purge-bot

Purges data from LogSearch
Apache License 2.0
0 stars 1 forks source link

Open SSH tunnel to LogSearch when running from CF #3

Closed mrdavidlaing closed 11 years ago

mrdavidlaing commented 11 years ago

In addition to starting logsearch-purge-bot.exe, a SSH tunnel should be started to give the bot container a network path into the logsearch cluster.

the SSH tunnel command will be something like:

ssh -L 127.0.0.1:9200: elasticsearch.srv-int.logsearch.cityindextest5.co.uk:9200 ubuntu@logsearch.cityindextest5.co.uk

elasticSearchUrl will then need to be set to 127.0.0.1:9200, which will route over the tunnel to elasticsearch.srv-int.logsearch.cityindextest5.co.uk:9200

mrdavidlaing commented 11 years ago

Dependant on Procfile functionality being added to cloudfoundry-community/.net-buildpack

mrdavidlaing commented 11 years ago

@dpb587 What is the correct SSH command to setup a tunnel to elasticsearch.srv-int.logsearch.cityindextest5.co.uk:9200 ?

I'm currently using:

ssh -v -N -L 127.0.0.1:9200:elasticsearch.srv-int.logsearch.cityindextest5.co.uk:9200 ubuntu@redis.logsearch.cityindextest5.co.uk -i logsearch-ppe-shipper.pem -o UserKnownHostsFile=known_hosts.txt

But am unsure about the ubuntu@redis.logsearch.cityindextest5.co.uk part

dpb587 commented 11 years ago

You've listed the correct SSH command. I pasted into a terminal and it seems to be working fine, are you experiencing problems?

mrdavidlaing commented 11 years ago

Yes - my SSH connection from the remote CF instance keeps timing out.

Is SSH to redis.logsearch.cityindextest5.co.uk port 22 open to the world?

dpb587 commented 11 years ago

Hmm, you're correct. I've manually updated the security group (and confirmed from a remote host) and fixed the original cause.

mrdavidlaing commented 11 years ago

Aha! That fixes it. Thx

mrdavidlaing commented 11 years ago

Note to self: Procfile should be similar to:

myweb: mono bin/myapp-web.exe -port $PORT
worker: mono bin/myapp-worker.exe
tunnel: chmod 0600 logsearch-ppe-shipper.pem && ssh -v -N -L 127.0.0.1:9200:elasticsearch.srv-int.logsearch.cityindextest5.co.uk:9200 ubuntu@redis.logsearch.cityindextest5.co.uk -i logsearch-ppe-shipper.pem  -o UserKnownHostsFile=known_hosts.txt
mrdavidlaing commented 11 years ago

@bitpusher - Please could you give this a code review before merging into master.

A running instance is at:

CF instance: https://api.run.pivotal.io
organization: cityindex-labs
space: development:
apps: ogsearch-purge-bot
bitpusher commented 11 years ago

@mrdavidlaing what addon are you using for mdproj? vs vanilla doesn't like it.

mrdavidlaing commented 11 years ago

@bitpusher Hmm - it must be something native to MonoDevelop / Xamarin Studio - its the "blank" project type

Strictly speaking, all we need is some way of copying src/logsearch-ppe-ssh_tunnel/start_ssh_tunnel.rb to the _bin folder during project compile.

Can you think of a more ".NET" way of doing that?

bitpusher commented 11 years ago

@mrdavidlaing add the file to the purgebot project as content and then mark it as copy always in property box.

mrdavidlaing commented 11 years ago

@bitpusher - I've integrated the script to start SSH into the PurgeBot project as suggested.

If you're happy with this, then please merge this PR

bitpusher commented 11 years ago

will do tonight. greasy hands right now. getting the race bikes street legal so i can go blow off some steam. don't worry, i will keep it under 260kpm. ;)

mrdavidlaing commented 11 years ago

:bike:++

mrdavidlaing commented 11 years ago

@bitpusher - Normally I would wait for you to merge this as the project owner, but I'm going to do it in your absence