Deployment
In this step we will:
Set up an account on Heroku
Download Heroku command line tools
Create a new application
Deploy the application
See the app go live on the internet
It is time to deploy the app to a server.
We will be using Heroku a Platform as a Service provider that offers free accounts for developers. The main advantage with using Heroku is that it's extremely easy to start and get your application code deployed. You don't need to deal with the infrastructure or setting up the server environment. It really just works.
The first thing you need to do is to head over to http://heroku.com and set up a new account. Make sure that you remember your username and password, as you will need them in a short while.
Next, head over to toolbelt.heroku.com/ and download the Heroku Toolbelt, a command line interface tool (CLI) for creating and managing Heroku apps.
Once installed, you can use the heroku command from your command shell. Log in using the email address and password you used when creating your Heroku account (this authentication is required to allow both the heroku and git commands to operate):
The next step is to create a Heroku application:
The dotenv
gem can couse some problems for us when we deploy to Heroku. We need to make some small changes to the way we require that gem and only load it if we are in development
and test
environment.
And also to the CertificateGenerator
module:
A new remote has been added to your git repository. Check it using this command:
Make sure that your latest changes are committed (and preferably pushed up to GitHub):
Okay, now is the time to do an actual deploy:
That's it, the application is now deployed.
If your tests has been passing up until now, the deployment should not be a problem. You should get a message that the deployment was successful.
Before we visit the URL, we still need to do one more step. Since we are using environmental/config variables to fetch our AWS credentials, we need to set them.
You can do it on the Heroku dashboards web interface, or you can set them using the CLI (and we are programmers after all, right? We go with the second option):
And check these settings with the heroku config
command:
Of you want to remove a variable (if you misspell or for some other reason), you can do it using this command:
So, now you are all set. Head over to your browser window and type in https://my-certs.herokuapp.com
or, if you want to be extra cool, just type:
Last updated