Skip to content

Latest commit

 

History

History
62 lines (50 loc) · 1.46 KB

00-heroku.md

File metadata and controls

62 lines (50 loc) · 1.46 KB

Heroku Experience

Let's start with a Hello World application deployed on Heroku to see the experience we're trying to build.

Create a new folder with two files.

Content of package.json

{
    "name": "hello-world",
    "version": "1.0.0",
    "description": "Kubecon NA demo",
    "author": "First Last <[email protected]>",
    "main": "server.js",
    "scripts": {
      "start": "node server.js"
    }
}

Content of server.js

const http = require('http');
const port = process.env.PORT || 8080

const requestListener = function (req, res) {
  res.writeHead(200);
  res.end('Hello World!');
}

const server = http.createServer(requestListener);
server.listen(port);

Initialize a git repo in the folder.

git init
git add .
git commit -s -m "initial commit"

Go to https://heroku.com and create a new application. Let's name it kubecon-na-2022. It should give you a command to add a git remote and push your code.

heroku git:remote -a kubecon-na-2022
git push heroku main

You should see your server up and running when you visit your URL!

https://kubecon-na-2022.herokuapp.com/

If you want to add cloud infrastructure like a bucket, you need to add an addon and use the given environment variable in your application. However, you don't get to have it in your cloud account so how you can configure it is quite limited.

Heroku addons

Let's see how we can build it in cloud native way!