Skip to main content

2 posts tagged with "heroku"

View All Tags

· 2 min read
Lejen

Thanks to Heroku, now I have my personal site :)

Too bad, heroku no longer offer free dyno..

If an app has a free web dyno, and that dyno receives no web traffic in a 30-minute period, it will sleep.

Every Heroku account is allocated a pool of free dyno hours, which can be used by Personal apps - apps that are not part of a Heroku Team or Enterprise Team.

If you want to know more about free dyno hours, visit official site here

Method - Cron-job

I am using a free tier account and I don't want my visitor to wait for dyno to re-launch everytime when they visit the site. This is the method I used for keeping my site alive.

  • Signup on https://cron-job.org/en/
  • Once the signup is completed, verify your email.
  • Once you log in successfully, click on the Cronjobs tab. And click on “Create cronjob”.

cron-job

  • Now you can fill in the details. Make sure you enter URL according to your GET method. If your GET method was for route “/home,” make sure your URL is https://your-app.herokuapp.com/home.

If you are not verifying Heroku app with your credit card, you might want to go for user-defined schedule.

  • When you reach the Schedule section, click on the option User-defined. Now make sure you select all the values in the columns Days of Month Days of Week, and Months.
  • In the Hours column, select all values except for any seven. I selected all values except for 0,1,2,3,4,5,6, which means my app will be asleep from 12 a.m. to 7 a.m. (no job at 6 a.m. means the app will be asleep at 6 a.m.). This step is essential as it satisfies the restriction for the free tier.
  • In the Minutes column, select only 0 and 30 because your app will only sleep every 30 minutes.

This is how your schedule settings will look in the end. Once everything looks fine, create your cron job.

The last picture is with the normal settings

User Defined Settings

cron-job-custom-schedule

Normal Settings

cron-job-details

Congratulations! You have successfully kept your Heroku app alive.

· 2 min read
Lejen

Ghost Error 500 - The currently active theme is missing.

Bump into this error when I am trying to setup custom theme for Ghost Blog. I am using Heroku to host this site. Just got to know that Heroku site do not have storage to store the custom theme uploaded via Ghost admin panel.

Did couple of search online, a lot suggested that you can clone heroku by git clone command

heroku git:clone -a myappname

But I get the error message about cloning an empty repository which I think it doesn't make any sense when the site is live at the moment

Continued my search and finally came into something useful which is using heroku slug to download source code

Solution

  1. Before that, proceed to install Heroku CLI following guide at their official site Heroku Dev Center

  2. Follow this site to get it heroku-slugs installed

  3. Login to Heroku account

    heroku login
  4. Heroku slug command to download your source code

    heroku slugs:download -a APP_NAME
  5. You will be getting the following folders:

  • app
  • slug.tar.gz

Command Line

  1. Make a new repository in GitHub and upload app folder to your repository

  2. Proceed to your heroku app dashboard, under Deploy Tab, Deployment method select GitHub and search for your newly created repository. You will end up something like below.

Heroku

  1. Done!
  2. You may also setup automatic deploys for every push to master branch