Looking for public data from Hack Club? See AirBridge or Hack Club Bank API
The backend powering https://hackclub.com. Illustrated above by @maxwofford.
Install rbenv
brew install rbenvInstall bundler
gem install bundler -v 1.17.3Run bundler
bundle installCopy .env.example to .env
cp .env.example .env
Create and migrate database
bundle exec rake db:drop db:create db:migrateRun the application
bin/rails sBrowse to localhost:3000
Copy .env file
cp .env.docker.example .env.dockerRun Docker
docker-compose build
docker-compose run web bundle install
#docker-compose run web yarn install --check-files
docker-compose run web bundle exec rails db:drop db:create db:migrate
docker-compose run --service-ports web bundle exec rails s -b 0.0.0.0 -p 3000- Create a new Slack app on Slack
- Create one (and only one) bot user and set "Always Show My Bot as Online" to "On"
- Click "Event Subscriptions" on the sidebar in the left and set the request URL to
HOSTNAME/v1/hackbot/webhooks/events, replacingHOSTNAMEwith your actual hostname. - Subscribe to the following bot events:
message.channels,message.im,message.groups,message.mpim - Click "Interactive Messages" on the left sidebar and set the request URL to
HOSTNAME/v1/hackbot/webhooks/interactive_messages, replacingHOSTNAMEwith your actual hostname. - Manually go through the Oauth flow and POST
codeto/v1/hackbot/auth
This application depends on a few jobs running periodically in the background. Set this up using cron or a similar scheduler on your deployment of the application -- we use Heroku's scheduler in production.
rails heroku_scheduler:queue_update_hackbot_slack_username_jobhourlyrails heroku_scheduler:queue_record_slack_stats_jobdailyrails heroku_scheduler:queue_activate_clubs_jobdailyrails heroku_scheduler:queue_collect_projects_shipped_jobdailyrails heroku_scheduler:queue_schedule_leader_check_ins_jobdailyrails heroku_scheduler:queue_handle_spam_club_applications_jobevery 10 minutesrails heroku_scheduler:queue_update_from_streak_jobhourlyrails heroku_scheduler:queue_close_check_ins_jobdaily
We use Heroku for managing our deployment of this project and that brings along some special caveats. Specifically, we rely on multiple buildpacks.
Here are the buildpacks that need to be configured (they must be in the given order):
https://github.com/heroku/heroku-buildpack-activestorage-preview
https://github.com/heroku/heroku-buildpack-apt
heroku/ruby
Refer to https://devcenter.heroku.com/articles/buildpacks for instructions on configuring buildpacks.
We use Skylight to profile the performance of our backend in production. To use it, you must set SKYLIGHT_AUTHENTICATION in the environment to the value that Skylight gives you.
