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

Slack Welcomebot on AWS Lambda #1017

Merged
merged 7 commits into from
May 1, 2018
Merged

Slack Welcomebot on AWS Lambda #1017

merged 7 commits into from
May 1, 2018

Conversation

mbeacom
Copy link
Contributor

@mbeacom mbeacom commented Apr 30, 2018

Description

The goal of this PR is to offload the functionality of slack_welcomebot.py management command to avoid high CPU utilization (95%) on the production servers by offloading the welcomebot to AWS Lambda and use the Slack Events API versus the RTM API.

Checklist
  • linter status: 100% pass
  • changes don't break existing behavior
  • commit message follows commit guidelines
Affected core subsystem(s)

welcomebot, slack

Testing

Tested on private slack community and AWS account.

Refers/Fixes

Refs: #874, #1012

@mbeacom mbeacom self-assigned this Apr 30, 2018
@mbeacom mbeacom requested a review from owocki April 30, 2018 06:02
@codecov
Copy link

codecov bot commented Apr 30, 2018

Codecov Report

Merging #1017 into master will decrease coverage by 0.32%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1017      +/-   ##
==========================================
- Coverage   31.95%   31.63%   -0.33%     
==========================================
  Files         106      105       -1     
  Lines        7244     7464     +220     
  Branches      942     1003      +61     
==========================================
+ Hits         2315     2361      +46     
- Misses       4821     4992     +171     
- Partials      108      111       +3
Impacted Files Coverage Δ
app/app/urls.py 91.42% <0%> (-2.52%) ⬇️
app/dataviz/d3_views.py 11.33% <0%> (-0.15%) ⬇️
app/dashboard/views.py 16.66% <0%> (+1.15%) ⬆️

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 72ff24d...260ef18. Read the comment docs.

@mbeacom mbeacom requested review from owocki and removed request for owocki April 30, 2018 16:50
@mbeacom
Copy link
Contributor Author

mbeacom commented Apr 30, 2018

Additionally, this PR will allow us to monitor the lambda and ensure it's running versus not knowing if the slack_welcomebot management command fails on the prod server.

@owocki
Copy link
Contributor

owocki commented Apr 30, 2018

did not test, but mostly LGTM

two things

  1. welcomebot dir is misspelled as welcombot
  2. can you delete the management command i created and its crontab entry ?

after that, feel free to ship and pls test in prod once this is live!

@mbeacom
Copy link
Contributor Author

mbeacom commented Apr 30, 2018

@owocki I don't have access to manage our bots. Any way I can get access to modify the scope of the welcomebot?

@owocki
Copy link
Contributor

owocki commented Apr 30, 2018

@mbeacom theres no 'scope' to manage. its just a legacy token issued via https://api.slack.com/custom-integrations/legacy-tokens

you can get the token by checking out the server repo

@mbeacom
Copy link
Contributor Author

mbeacom commented May 1, 2018

@owocki The event driven bot needs a verification token and a bot token. I will need you or @coderberry to provide a verification token for the specified bot and ensure it's subscribed to team_join events per the events api documentation or authorize the app I already setup.

https://github.com/slackapi/python-slack-events-api#--app-setup

@mbeacom
Copy link
Contributor Author

mbeacom commented May 1, 2018

@mbeacom mbeacom merged commit 1a62e7d into master May 1, 2018
@mbeacom mbeacom deleted the mark-welcomebot-lambda branch May 1, 2018 15:24
@mbeacom
Copy link
Contributor Author

mbeacom commented May 1, 2018

screenshot 2018-05-01 11 37 39

CuriousLearner added a commit to CuriousLearner/web that referenced this pull request May 1, 2018
…946-296

* 'fix-946-296' of github.com:CuriousLearner/web:
  Slack Welcomebot on AWS Lambda (gitcoinco#1017)
  default to 'any' being checked
  Add user tracking to rollbar js config
  fixes gitcoinco#1040 (gitcoinco#1043)
  2 days at a time
  max time
  gives staff the ability to remove users from a bounty (gitcoinco#1042)
  one more try
  slower
  new d3 viz
  show nodes over time on graph
CuriousLearner added a commit to CuriousLearner/web that referenced this pull request May 3, 2018
* 'master' of https://github.com/gitcoinco/web: (46 commits)
  Fix gitcoinco#1063 - Fix work submitted formatting for gitcoinbot comments
  Fix logging dt
  Disable pin since we only use runserver locally
  Add autoreload on .env save and limit provisioning
  send a list of old bounties at the footer of the new bounty email too
  only show open bounties in new bounty email
  only send feedback emails on mainnet
  https://rollbar.com/gitcoin/gitcoin/items/642/
  copy
  submit message was formatted funny
  fix for TypeError: unsupported operand type(s) for +: 'BountyQuerySet' and 'BountyQuerySet'
  logs abandoned work and prevents users from starting new work bc of it (gitcoinco#1039)
  Slack Welcomebot on AWS Lambda (gitcoinco#1017)
  default to 'any' being checked
  Add user tracking to rollbar js config
  fixes gitcoinco#1040 (gitcoinco#1043)
  2 days at a time
  max time
  gives staff the ability to remove users from a bounty (gitcoinco#1042)
  one more try
  ...
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