MyWebsite Bootstrap

How to deploy Jekyll site to Heroku?

13 Feb 2022 - Gengar

In this article, I will introduce how to deploy Jekyll site to Heroku.
I assume your Jekyll site is ready. Here are few steps to follow:
  1. Create a Heroku account

  2. Install the Heroku CLI

  3. Go to command prompt, log in to your Heroku account and follow the prompts to create a new SSH public key

    $ heroku login

  4. Create a new Heroku app with unique name

    $ heroku create myuniqueappname

    or let Heroku choose for you

    $ heroku create

  5. Add a file named “Procfile” in your Jekyll project root folder with the following content:

    web: jekyll serve -P $PORT --no-watch --host 0.0.0.0

    Heroku will run this command on your dyno

    -P $PORT: your server will be run on $PORT which is determined by Heroku

    --no-watch: don’t watch source folder for changes and re-builds

    --host 0.0.0.0: run your server on Heroku’s localhost

  6. Initialize a git repository in your project directory

    $ cd my-project/ $ git init $ heroku git:remote -a my-project

  7. Deploy your application

    $ git add . $ git commit -am "make it better" $ git push heroku master

  8. That’s it, use “heroku open” to go to your site and enjoy it.
Tags: #Heroku #Jekyll