Skip to content

Sample API implementation for fictional NodeTours tour operator company

License

Notifications You must be signed in to change notification settings

krishnajc/nodetours

 
 

Repository files navigation

NodeTours

License: MIT Contributors GitHub issues open Build Status

Sample API implementation for fictional NodeTours tour operator company.

Docker deployment

Build an image:

% cd /nodetours
% docker build -t nodetours:2.0 -f deploy/docker/Dockerfile .

Change directory and start the stack using docker compose:

% cd deploy/docker/
% docker-compose -p nodetours up -d

You should see the following output and NodeTours will be up:

Creating network "nodetours_nodetours-network" with driver "bridge"
Creating nodetours-db ... done
Creating nodetours-app ... done

Kubernetes deployment

Make sure you have a docker image created for the deployment (see docker instructions above). Deploy the app and service to kubernetes cluster:

% cd /nodetours
% kubectl apply -f deploy/kubernetes

Check the port through which APIs can be accessed:

% kubectl get services nodetours-db
NAME          TYPE      CLUSTER-IP  EXTERNAL-IP PORT(S)         AGE
nodetours-db  NodePort  {your-IP}   <none>      7777:$port/TCP  1m

or

% kubectl get --namespace default -o jsonpath="{.spec.ports[0].nodePort}" services nodetours
$port

$port is the kubernetes ingress port through which NodeTours APIs are reachable.

Kubernetes deployment (single pod)

If you prefer deploying the app in a single pod (instead of two, which the obove instructions result with), deploy it this way:

% cd /nodetours
% kubectl apply -f deploy/kubernetes/single

Kubernetes deployment using helm

Make sure you have a docker image created for the deployment (see docker instructions above). Deploy the app and service to kubernetes cluster:

% cd /nodetours
% helm install {name} deploy/kubernetes/helm

where {name} is the name you want to give your instance of NodeTours.

Check the port through which APIs can be accessed:

% kubectl get services nodetours
NAME      TYPE      CLUSTER-IP  EXTERNAL-IP PORT(S)         AGE
nodetours NodePort  {your-IP}   <none>      7777:$port/TCP  1m

or

% kubectl get --namespace default -o jsonpath="{.spec.ports[0].nodePort}" services nodetours
$port

$port is the kubernetes ingress port through which NodeTours APIs are reachable.

Kubernetes deployment using helm (single pod)

If you prefer deploying the app in a single pod (instead of two, which the obove instructions result with), deploy it this way:

% cd /nodetours
% helm install {name} deploy/kubernetes/helm/single

Native deployment

To run NodeTours directly on your machine you need a working node.js / npm environment and git. You will also need a running instance of mongo DB.

Get the source code

% cd {your workspce}
% git clone https://github.com/przemekulik/nodetours.git

Build the app

% cd nodetours
% npm run-script build

Run it

% npm run-script run {DB hostname} {DB port}

where {DB hostname} and {DB port} are the hostname and port number of your mongo database.

About

Sample API implementation for fictional NodeTours tour operator company

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 89.0%
  • Smarty 10.5%
  • Dockerfile 0.5%