Deploy on Heroku
Written by Miguel Michelson
Heroku is the easiest way to deploy Chaskiq there are two main modes on which you can deploy the application, the first way is using the Heroku button , this will not require any local installation and will handle all the heavy lifting for you.
The second way is cloning the repo and installing it though the Heroku client. let's dig into it.
This tutorial will have you deploying a Ruby app in minutes. Hang on for a few more minutes to learn how it all works, so you can make the most out of Heroku.The tutorial assumes that you have:
The Heroku CLI requires Git, the popular version control system. If you don’t already have Git installed, complete the following before proceeding:
First-time Git setup
In this step you’ll install the Heroku Command Line Interface (CLI). You use the CLI to manage and scale your applications, provision add-ons, view your application logs, and run your application locally.
To clone the sample application so that you have a local version of the code that you can then deploy to Heroku, execute the following commands in your local command shell or terminal:
$ git clone https://github.com/chaskiq/chaskiq.git $ cd chaskiq
You now have a functioning git repository that contains a simple application as well as a Gemfile file, which is used by Ruby’s dependency manager, bundler.
In this step you will deploy the app to Heroku. Create an app on Heroku, which prepares Heroku to receive your source code.
$ heroku create Creating app... done, ⬢ polar-inlet-4930 http://polar-inlet-4930.herokuapp.com/ | https://git.heroku.com/polar-inlet-4930.git Git remote heroku added
When you create an app, a git remote (called heroku) is also created and associated with your local git repository.Heroku generates a random name (in this case polar-inlet-4930) for your app, or you can pass a parameter to specify your own app name.Now deploy your code:
$ git push heroku master
Note that you will need setup some environment variables first in order to work properly, (this is not required if you install it through heroku button) please refer to the heroku env vars managment https://devcenter.heroku.com/articles/config-vars the required env vars:
Select...HOST=https://YOUR_HEROKU_APP_DOMAIN ASSET_HOST=https://YOUR_HEROKU_APP_DOMAIN WS=wss://YOUR_HEROKU_APP_DOMAIN/cable SES_ADDRESS= SES_USER_NAME= SES_PASSWORD= AWS_ACCESS_KEY_ID= AWS_SECRET_ACCESS_KEY= AWS_S3_BUCKET= AWS_S3_REGION= ADMIN_EMAILemail@example.com ADMIN_PASSWORD=123456 SNS_CONFIGURATION_SET=metrics
Important things are your HOST and WS vars and ADMIN_EMAIL and ADMIN_PASSWORD for initial admin generation and the AWS credentials
Now that you have successfully installed the app, run these commands:
heroku run rails db:migrate heroku run rails db:seed
The rails admin_generator task will create an admin user for you, you will need to have an ADMIN_EMAIL and ADMIN_PASSWORD on your .env try this credentials:
heroku run rails admin_generator
The application is now deployed and data migrated. Now visit the app at the URL generated by its app name. As a handy shortcut, you can open the website as follows:
$ heroku open