If you want to run Challonge Mgr on your computer, or do development on it, follow the instructions in this section. Instructions for installing it on Heroku are provided later on.
Clone the repo and set up gems and the initial database:
$ git clone https://github.com/acidhelm/challonge_mgr.git
$ cd challonge_mgr
$ bundle install --path vendor/bundle
$ bin/rails db:schema:load
If you don't want to set up a GitHub account, you can also download the source code and unzip it.
There are two configuration keys that you will need to set, but you'll only have
to do this once. In the challonge_mgr
directory, run:
$ ruby -e 'require "securerandom"; puts "ATTR_ENCRYPTED_KEY=#{SecureRandom.hex 16}"' >> .env
That creates an encryption key that only works on your computer. You should not copy that key to any other computer; generate a new key if you start using Challonge Mgr on another computer.
The other key is for the Slack API. If you don't plan on sending tournament updates to Slack, you can skip this step.
Open the .env
file in a text editor, and add this line:
SLACK_TOKEN=[the API token]
Use a key from Slackbot in the team's custom integrations page. The token is the string after "token=" in the URL.
Then run the Rails server:
$ bin/rails server
Challonge Mgr accounts are used to hold your Challonge login information. You will need your Challonge API key, which you can find in your account settings.
There is no UI for creating accounts, but you can make an account in the Rails console. Run the console:
$ bin/rails console
Then run this command to make an account:
> User.create user_name: "A user name",
api_key: "Your API key",
password: "A password"
The user name and password that you set here are used to log in to Challonge Mgr. They do not have to be the same as your Challonge user name and password.
If your user belongs to an organization that has a subdomain on challonge.com,
add a subdomain: "your-subdomain"
parameter to the create
call. This lets
you manage tournaments that are owned by other users in your organization.
You can change these settings later by clicking the Edit this user's settings link in your list of tournaments.
Challonge Mgr is ready to deploy to a Heroku app, so that the tournament info can be viewed by anyone. These instructions assume that you have created accounts on Heroku and GitHub. Challonge Mgr doesn't require any paid components, so you can use a free Heroku account.
To use command-line tools, you must install the Heroku CLI app. After you clone the repo, run:
$ heroku create <heroku app name>
For example, run this command:
$ heroku create my-challonge-mgr
to create my-challonge-mgr.herokuapp.com. Don't use this name, of
course; use a name that's related to your scene or organization. heroku create
also creates a git remote with the default name of "heroku". Then, push
the app to that remote:
$ git push heroku master
You'll see a bunch of output as the app is compiled and installed. Next,
create the environment variables ATTR_ENCRYPTED_KEY
and (if needed)
SLACK_TOKEN
. Instead of creating an .env
file, you add those variables
to your Heroku app's configuration:
$ key=`ruby -e 'require "securerandom"; puts SecureRandom.hex(16)'`
$ heroku config:set ATTR_ENCRYPTED_KEY=$key
$ heroku config:set SLACK_TOKEN=[the Slack token]
Next, set up the database:
$ heroku run rails db:migrate
Run the Rails console:
$ heroku console
and create a Challonge Mgr account as described earlier. You can then access Challonge Mgr at https://your-app-name.herokuapp.com.
On GitHub, fork the Challonge Mgr repo to make a copy of it in your GitHub account. On your Heroku dashboard, click New→Create new app, and give it a name. Click that app in the dashboard, then click Deploy. In the Deployment method section, click GitHub, then Connect to GitHub. That will show a popup window from GitHub asking you to allow Heroku to access your GitHub account. Click the Authorize button.
The Connect to GitHub page will now show your GitHub account and a search field. Enter the name of your forked repo and click Search. Click Connect next to your repo in the search results.
The page will have a new Manual deploy section at the bottom. Click Deploy branch to deploy the master branch to your Heroku app. Once the deployment is done, the page will say "Your app was successfully deployed." \o/
Click Settings, then in the top-right corner, click More→Run console. Type "bash", then click Run. Run the Ruby command to generate an encryption key as described earlier, and copy the key. Close the console.
Click Reveal config vars and create an ATTR_ENCRYPTED_KEY variable. Use the encryption key that you just created as the value for that variable. Create SLACK_TOKEN too if you want to send Slack notifications.
Click More→Run console again, and enter "rails db:migrate". When that finishes, click Run another command at the bottom of the window, and enter "console". Create a Challonge Mgr account as described earlier. You can then access Challonge Mgr at https://your-app-name.herokuapp.com.