Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EC2 scraper instance #137

Merged
merged 41 commits into from
Aug 4, 2016
Merged

EC2 scraper instance #137

merged 41 commits into from
Aug 4, 2016

Conversation

divergentdave
Copy link
Collaborator

This is part of #66. Haven't tested it yet, but it should hit all the high parts!

"Network interfaces and an instance-level security groups may not be
specified on the same request"
Can't use instance storage on tiny instance types, plus I should
probably use 16.04 LTS over 14.04 LTS at this point.
namespace :aws do
region = 'us-east-1'
availability_zone = 'us-east-1b'
key_name = 'erickey'
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@_@

Copy link
Collaborator Author

@divergentdave divergentdave Jul 6, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

¯_(ツ)_/¯ I copied it from the ASG

@konklone
Copy link
Owner

konklone commented Jul 6, 2016

I'm cool with this, and so glad you're making progress on it. My one wish (and it's not a blocker) is to avoid relying on system Python, Ruby, and Node, rather than user-space language managers that stay current with their communities.

Thank you for tackling this, and let me know how I can support the work.

@divergentdave
Copy link
Collaborator Author

Thanks for the guide, I'll take a look once I get this working.

@divergentdave
Copy link
Collaborator Author

FWIW I ran into this issue: aws/aws-sdk-ruby#859, going to add a hardcoded delay to smooth over the race condition.

@divergentdave
Copy link
Collaborator Author

I got most of the configuration working, next up tomorrow is figuring out authorization for the AWS managed elasticsearch.

    Loading JSON from disk...
    Loading text from disk...
    Indexing into Elasticsearch...
    Er what!!
    Error: Authorization Exception
{"Message":"User: anonymous is not authorized to perform: es:ESHttpGet on resource: oversight"}

@divergentdave
Copy link
Collaborator Author

This is coming along pretty well so far, most things on the scraper instance are in working order. My next plan is to make a private S3 bucket with a script in it to add secrets to the configuration file, (Slack, dashboard, etc.) and then grab and invoke the script during setup.

@divergentdave
Copy link
Collaborator Author

Also, I'm going to do further research on AWS ES authentication libraries. I'm not happy with the one I have in there now, as it requires extra callbacks everywhere.

@divergentdave divergentdave changed the title [WIP] EC2 scraper instance EC2 scraper instance Jul 8, 2016
@divergentdave
Copy link
Collaborator Author

divergentdave commented Jul 9, 2016

I've been taking a look at rbenv/pyenv/nvm, and while all the instructions are for adding these tools to .bashrc, that doesn't apply to non-interactive scripts such as the user-data script or the crontab. We already use the below snippet for rbenv, @konklone do you have corresponding snippets for nvm and pyenv? Any other advice for handling this?

export PATH=$HOME/.rbenv/shims:$HOME/.rbenv/bin:$PATH
eval "$(rbenv init -)"

@divergentdave
Copy link
Collaborator Author

I think I have rbenv/pyenv/nvm working now, waiting for the cron job to run to confirm.

@divergentdave
Copy link
Collaborator Author

Alright, this works now! Ready for review, and I'll follow up with the web server elsewhere.

@konklone
Copy link
Owner

I'll work on reviewing this this weekend. Thank you for doing all of this!

Conflicts:
	npm-shrinkwrap.json
	package.json

sudo -u ubuntu git clone https://github.com/sstephenson/rbenv.git /home/ubuntu/.rbenv
sudo -u ubuntu git clone https://github.com/sstephenson/ruby-build.git /home/ubuntu/.rbenv/plugins/ruby-build
echo 'export PATH=$HOME/.rbenv/bin:$PATH' | sudo -u ubuntu tee -a /home/ubuntu/.bashrc
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These commands use sudo, but the ones above don't. If this is running as root, then it won't matter, but just flagging in case the inconsistency is important.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, the user-data script does run as root

@konklone
Copy link
Owner

konklone commented Aug 4, 2016

Ugh, I'm clearly not prioritizing review here, and don't see a path to reviewing the actual deployment over the next two weeks. I've 👀'd the code, and it looks fine, and I think I just need to 👍 you rolling this out to see how it works in practice. Are you up for that?

Thank you so much for doing all this great (and very necessary) configuration management work.

@divergentdave
Copy link
Collaborator Author

Sure, sounds good. I left the scraper instance running, and it appears to be chugging along just fine.

@divergentdave divergentdave merged commit fb5dc03 into master Aug 4, 2016
@divergentdave divergentdave deleted the ec2-scraper branch August 4, 2016 02:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants