Hosting on Heroku
April 29th, 2021
Heroku is one of the many hosting web services out there. While there are plenty of hosting services out there, I choose to host on Heroku for a few reasons.
- First and most important to me so far, it has a free tier that has always fulfilled my needs to this point. Like any free tier, there are plenty of limitations, but I have yet to hit any of these. Should I run into one of the limitations, many are solved by upgrading to their Hobby plan, which is only seven dollars per month.
- Second, I have found Heroku to be extremely easy to use to do what I need it to do: hosting. As a developer, it is as simple as pushing code to Github. Now, this ease of use can result in some pretty big blunders should the user accidentally push bad code. That said, Heroku makes it easy to set up multiple environments and pipelines for staging and production environments. It also has an easy-to-use interface for setting up environment variables and connecting a domain name, the only other features I actually need to host a Papyr site (of course, even the domain name is optional).
- Third, if you are willing to explore and/or spend some money, Heroku offers all kinds of additional services such as website metrics, database hosting, SSL, maintenance mode, and lots more. They make it very easy to handle all of your devops operations from their site.
Setting up Heroku for a website
In order to use Heroku, you need an account. You can create an account by going to https://signup.heroku.com and entering your information. After confirming your email for your account and setting a password, click "Create New App" and enter the name of your app. Now you should have an environment set up and ready to host your website! At this point, click "Settings" and "Reveal Config Vars". This is where you will need to enter all of the environment variables for your website.
Deploying to Heroku
At this point, you simply need to push your Papyr CMS code to Heroku. The most common method for this is using Git. The two requirements in order to do this is to have both Git and the Heroku CLI installed. You can reference this page for installing Git and this one for installing and logging into the Heroku CLI. Next, you will need to set up your Heroku environment as a Git remote. From your repository directory, you can run
heroku git:remote -a your-app-name
to add "heroku" as a remote. Now, all that is left to do is run
git push heroku master
and your Papyr code will be built and pushed to your Heroku environment. At this point, if all of your environment variables are set, you should have a working website. All that is left is for you to go to yourwebsite.com/init to start setting everything up!