A hackathon web application with a comprehensive administrative backend, email infrastructure, attendee registration, and optional MLH integration.
Click on the following button to deploy the web application to Heroku:
Perform the following steps:
- Sign up for an account at Heroku and install the Heroku CLI if you have not already done so.
- Clone the repository and change your current working directory to the newly created
hackathon
directory:- SSH (use if you have configured an SSH key with GitHub):
$ git clone [email protected]:TomerAberbach/hackathon.git $ cd hackathon
- HTTPS:
$ git clone https://github.com/TomerAberbach/hackathon.git $ cd hackathon
- SSH (use if you have configured an SSH key with GitHub):
- Log in to Heroku through the Heroku CLI:
$ heroku login
- Create a Heroku application:
- SSH (use if you have configured an SSH key with Heroku):
$ heroku create --ssh-git
- HTTPS:
$ heroku create --ssh-git
- SSH (use if you have configured an SSH key with Heroku):
- Configure the application's buildpacks (Active Storage preview and Ruby):
$ heroku buildpacks:add -i 1 https://github.com/heroku/heroku-buildpack-activestorage-preview $ heroku buildpacks:add -i 2 heroku/ruby
- Configure the application's Heroku addons (SendGrid and Cloudinary):
The previous commands set the
$ heroku addons:create sendgrid $ heroku addons:create cloudinary
SENDGRID_USERNAME
,SENDGRID_PASSWORD
, andCLOUDINARY_URL
environment variables for you on Heroku. - Set the application's
ADMIN_EMAIL
andDOMAIN
. Refer to the Environment Variables section for a description of each environment variable:You may choose to set the$ heroku config:set [email protected] $ heroku config:set DOMAIN=yourdomain.com
DOMAIN
environment variable to Heroku's randomly generated hostname initially, and then update it upon securing and configuring a custom domain name with Heroku. - Run the following command and verify that each environment variable in the Environment Variables section is included in the output:
$ heroku config
- Determine the current Git branch using by running
git branch
and then deploy the application to Heroku:$ git push heroku current_branch_name:master
- Migrate and seed the application's database:
At this point the email address set in the
$ heroku run rails db:migrate db:seed
ADMIN_EMAIL
environment variable should have received an invitation email, but the link in the email will not work until the next step is completed. - Scale the application to use a single dyno, a lightweight Linux container:
$ heroku ps:scale web=1
You can now view the application home page by running heroku open
or navigating to its URL in a web browser. Additionally, the link in the invitation email sent to the email address set in the ADMIN_EMAIL
environment variable should now be used to create the super admin account. Lastly, the application dashboard is accessible at the /dashboard
path. For example, if your DOMAIN
environment variable is set to hacktcnj.com
, then the application dashboard can be found at hacktcnj.com/dashboard
.
In general, you can run any command on your Heroku dyno using heroku run <your-command>
. To start a remote interactive shell session on your heroku dyno run the following command (press Ctrl+C to stop viewing the logs):
$ heroku run bash
If you need to clear the application's database run the following command, which is irreversible:
$ heroku run DISABLE_DATABASE_ENVIRONMENT_CHECK=1 rails db:schema:load
You will probably want to reseed the database afterwards:
$ heroku run rails db:seed
If view your application's logs in realtime run the following command (press Ctrl+C to stop viewing the logs):
$ heroku logs --tail
Sign up for an account at SendGrid and set the SENDGRID_USERNAME
and SENDGRID_PASSWORD
environment variables. The website requires SendGrid to send emails.
Set the ADMIN_EMAIL
environment variable to an email address. The email address will receive a super admin account invitation email when the website's database is initially populated. The super admin can then invite additional admins if necessary.
Set the DOMAIN
environment variable to the domain name, without a protocol prefix or path suffix, that targets the website. For example, hacktcnj.com
is a valid value.
In the development and test environments, Active Storage, which is responsible for storing images and documents, is configured to use the local file system. However, in the production environment, Active Storage is configured to use Cloudinary, a cloud storage provider, because many website hosting providers provide an ephemeral file system, which cannot persist data. Sign up for an account at Cloudinary set the CLOUDINARY_URL
environment variable in the production environment.
- Install Ruby and Rails and PostgreSQL.
- Clone the repository and change your current working directory to the newly created
hackathon
directory:- SSH (use if you have configured an SSH key with GitHub):
$ git clone [email protected]:TomerAberbach/hackathon.git $ cd hackathon
- HTTPS:
$ git clone https://github.com/TomerAberbach/hackathon.git $ cd hackathon
- SSH (use if you have configured an SSH key with GitHub):
- Set the environment variables listed in the Environment Variables section by creating an
application.yml
file in theconfig
directory and setting the appropriate environment variable values like so:DO NOT CHECK THIS FILE INTO VERSION CONTROL.SENDGRID_USERNAME: "your SendGrid username" SENDGRID_Password: "your SendGrid password" ADMIN_EMAIL: "your email address" DOMAIN: "localhost:3000"
- Install the project dependencies:
If you encounter errors, try restarting PostgreSQL and installing additional updates.
$ bundle install
- Set up the database:
$ rails db:setup
- Run the application (visit at [localhost:3000]):
Modify code and refresh web pages to see the difference.
$ rails server
See CONTRIBUTING.md for contributing guidelines.
Copyright © 2019 Tomer Aberbach and Thomas Orth Released under the MIT license.