-
Notifications
You must be signed in to change notification settings - Fork 27
Documentation
In this page we attempt to explain all of the little implementation and configuration details in HackTheArch. If you see something missing, let us know and we'll get it updated.
As a general note, all of the API Keys are set in environment variables which can be set locally or through your cloud provider.
You have a couple of options for utilizing the image storage feature for problems.
- You can link a problem directly in the image text using the html
<img>
tag - You can use the built-in image uploader which can be configured as follows:
- (Default setup) You can use Carrier-Wave and Google Cloud Storage which can be configured in
config/initializers/carrier_wave.rb
. It's currently set to use the following environment variables for access:- GOOGLE_BUCKET (This is the name of your bucket)
- GOOGLE_ACCESS_KEY
- GOOGLE_SECRET_KEY
- You can use an alternate uploader or store files locally by modifying the
app/uploaders/picture_uploader.rb
file.
- (Default setup) You can use Carrier-Wave and Google Cloud Storage which can be configured in
HackTheArch implements Stripe for your convenience in collecting payment for a competition. The config file is at:config/initializers/stripe.rb
, and the API keys are assigned to:
- STRIPE_PUBLISHABLE_KEY
- STRIPE_SECRET_KEY
If enabled, the amount to be charged is in USD in one cent increments (500 = $5.00). We have also included two coupon codes for offering discounts set at 50% and 100% off. Leave the codes blank to disable them.
It is highly suggested that this application runs over a secure connection and by default will (when deployed to Heroku). The web server config can be found in config/puma.rb
.
HackTheArch is configured by default to log outbound e-mail messages (instead of sending them) unless running in a Heroku environment with the 'SendGrid' add-on active. If SendGrid is active, then e-mails will be sent normally. E-mail messages can be modified by modifying the files in the app/mailers
directory. To use an alternate mailer, the config is found in: config/environments/production.rb
. The environment variables for SendGrid are:
- SENDGRID_USERNAME
- SENDGRID_PASSWORD
We have included a script: OfflineSetup/start_local
, to deploy this application locally. If all of the environment variables in the script are set and the path to your SSL certs are updated, running the script will start the puma web server in production mode and accept connections. HackTheArch has been tested over a remote database connection but it is recommended your database be collocated (or at least local) as we have not done any optimization for a remote database.
If session hijacking is a concern, it is recommended that the admin account is disabled after setup. To do this, simply delete the admin user or unset the boolean variable called admin on the admin user. This can be done through a Ruby console: User.find_by(username: admin).update_attribute(:admin, false)
, or through a SQL console: UPDATE users SET admin=f where admin=t;
. If the admin account is removed or disabled, problems and hints can be added/removed/modified using the same method. For this reason, we recommend protecting access to your Ruby and SQL console with certificates or very long secure passwords.
HackTheArch by default uses Gravatar for profile pictures. This functionality is handled in /app/helpers/users_helper.rb
and uses this link http://gravatar.com/emails to allow users to modify theirs.