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

otp-runner deployment #316

Merged
merged 6 commits into from
Jul 5, 2020
Merged

otp-runner deployment #316

merged 6 commits into from
Jul 5, 2020

Conversation

evansiroky
Copy link
Contributor

Checklist

  • Appropriate branch selected (all PRs must first be merged to dev before they can be merged to master)
  • Any modified or new methods or classes have helpful JavaDoc and code is thoroughly commented
  • The description lists all applicable issues this PR seeks to resolve (fixes Refactor ec2 startup script (potentially into a new project into a scripting language) #289)
  • The description lists any configuration setting(s) that differ from the default settings
  • All tests and CI builds passing

Description

This PR changes ec2 deployments to use otp-runner instead of completely bash-inlined in java for ec2 startup scripts. Also, the logic to create bundles and upload them has been moved to otp-runner. This has a number of advantages:

  1. Since the bundles are now created on a separate machine, datatools-server won't crash if multiple large deployments are initiated at the same time.
  2. The asynchronous execution of commands from otp-runner should result in a shorter time before graph building starts
  3. otp-runner is able to easily write a full JSON status file and keep track of many other items that would be much more difficult to do with bash
  4. otp-runner is thoroughly tested, whereas the bash-in-java had zero testing.

In order to run this, the ec2 images need node.js and yarn installed.

@codecov-commenter
Copy link

codecov-commenter commented May 24, 2020

Codecov Report

Merging #316 into dev will decrease coverage by 0.10%.
The diff coverage is 0.00%.

Impacted file tree graph

@@             Coverage Diff              @@
##                dev     #316      +/-   ##
============================================
- Coverage     19.91%   19.80%   -0.11%     
- Complexity      410      412       +2     
============================================
  Files           151      153       +2     
  Lines          8331     8417      +86     
  Branches       1157     1165       +8     
============================================
+ Hits           1659     1667       +8     
- Misses         6523     6601      +78     
  Partials        149      149              
Flag Coverage Δ Complexity Δ
#unit_tests 19.80% <0.00%> (-0.11%) 412.00 <0.00> (+2.00) ⬇️
Impacted Files Coverage Δ Complexity Δ
...com/conveyal/datatools/manager/jobs/DeployJob.java 0.00% <0.00%> (ø) 0.00 <0.00> (ø)
...datatools/manager/jobs/MonitorServerStatusJob.java 0.00% <0.00%> (ø) 0.00 <0.00> (ø)
...eyal/datatools/manager/jobs/OtpRunnerManifest.java 0.00% <0.00%> (ø) 0.00 <0.00> (?)
...nveyal/datatools/manager/jobs/OtpRunnerStatus.java 0.00% <0.00%> (ø) 0.00 <0.00> (?)
.../conveyal/datatools/manager/models/Deployment.java 0.00% <0.00%> (ø) 0.00 <0.00> (ø)
...veyal/datatools/manager/persistence/FeedStore.java 27.20% <0.00%> (-0.22%) 13.00 <0.00> (ø)
...com/conveyal/datatools/manager/models/Project.java 23.33% <0.00%> (-6.67%) 3.00% <0.00%> (+1.00%) ⬇️
...ols/manager/controllers/api/ProjectController.java 11.44% <0.00%> (-0.97%) 3.00% <0.00%> (+1.00%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 3ac5c3d...9a2ef56. Read the comment docs.

Copy link
Contributor

@landonreed landonreed left a comment

Choose a reason for hiding this comment

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

Again, really good stuff. I'm really excited to move this code into the dev environment and give it a whirl. Just a few minor changes/comments.

// NOTE: user data output is logged to `/var/log/cloud-init-output.log` automatically with ec2 instances
// Add some items to the $PATH as the $PATH with user-data scripts differs from the ssh $PATH.
lines.add("export PATH=\"$PATH:/home/ubuntu/.yarn/bin\"");
lines.add("export PATH=\"$PATH:/home/ubuntu/.nvm/versions/node/v12.16.3/bin\"");
Copy link
Contributor

Choose a reason for hiding this comment

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

Should the node version be hard-coded like this?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

When adding it to the PATH variable, yes.

Copy link
Contributor

Choose a reason for hiding this comment

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

@evansiroky, I'm more so asking should we bump the node version out into its own variable (and then string formatting the export PATH line) just for visibility and easy access.

@landonreed landonreed assigned evansiroky and unassigned landonreed Jun 1, 2020
@evansiroky evansiroky assigned landonreed and unassigned evansiroky Jun 12, 2020
Copy link
Contributor

@landonreed landonreed left a comment

Choose a reason for hiding this comment

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

Thanks for the changes, @evansiroky. Just a couple of minor follow ups, but I think this is pretty much ready.

@landonreed landonreed assigned evansiroky and unassigned landonreed Jun 12, 2020
@evansiroky
Copy link
Contributor Author

@landonreed see latest commit. I hope it resolves your concerns.

@evansiroky evansiroky removed their assignment Jun 13, 2020
Copy link
Contributor

@binh-dam-ibigroup binh-dam-ibigroup left a comment

Choose a reason for hiding this comment

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

I am leaning towards extracting the manifest generation into its own method and rename the big
constructUserData method as a result.

@evansiroky
Copy link
Contributor Author

Let me know how strongly you feel about your recommendations to change things, @binh-dam-ibigroup. I think it might be fine to leave things as they are.

@evansiroky evansiroky merged commit b771ff9 into dev Jul 5, 2020
@evansiroky evansiroky deleted the otp-runner-deployment branch July 5, 2020 17:43
@landonreed
Copy link
Contributor

🎉 This PR is included in version 3.7.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants