kellykermode / HelloWorldNodeJs

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Hello World NodeJS

This is a basic Hello World example application written in NodeJS.

If desired, load the dependencies and test locally

Install the dependencies

npm install

Start the server

npm start

Test by visiting http://localhost:8080

If it's working, shut down the server (ctrl-c)

Build the container and deploy it to Google's Container Registry

Use Cloud Build to build the Docker image and push to GCR. This command assumes you are in Cloud Shell for a Google Cloud Project.

sh buildContainer.sh

At the end of the script output, Cloud Build will display the path to the newly generated container. It should look like: "gcr.io/some-project-name/hello-world:1.0". Copy the path.

Running in GKE

If you'd like to deploy to GKE, there's a k8sapp.yaml containing configurations to create a Deployment, and build a LoadBalancer for it. You will need to edit the file before applying to set the proper path to the container in GCR. The container path was generated by the buildContainer.sh script, and if you followed instructions, it's currently copied into your buffer. Once the image bath has been updated, apply the file:

kubectl apply -f k8sapp.yaml

Load testing

If you'd like to apply load to your hello world application, see the loadgenerator sub-folder.

About


Languages

Language:Shell 37.0%Language:Dockerfile 29.8%Language:Python 24.1%Language:JavaScript 9.2%