Skip to content

Setup locally on Linux and MacOS

Thang Chung edited this page Aug 29, 2018 · 2 revisions

Up and Running locally with "Docker for Desktop", development only

  1. Make sure we have Docker for Desktop running with Kubernetes option enabled. We need to install kubectl, helm and istioctl on the build machine as well.

  2. Clone the current source code to your local machine

git clone https://github.com/vietnam-devs/coolstore-microservices.git

  1. Then cd into coolstore-microservices folder (just cloned)
> ./deploys/scripts/build-all-images.sh

It should run and package all docker images, type docker images to check it.

  1. Download and install istio-1.0.0 to your local machine, and unzip it into somewhere, then initialize it with following commands
> cd <istio-1.0.0 path>
> kubectl create -f install/kubernetes/helm/helm-service-account.yaml
> kubectl create -f install/kubernetes/helm/istio/templates/crds.yaml
> helm init --service-account tiller --upgrade

Waiting until it downloads and runs on your machine.

  1. Get istio-ingressgateway IP address
> kubectl get services istio-ingressgateway -n istio-system -o=jsonpath={.spec.clusterIP}
> 10.96.34.68 <== let assume that we get the IP 
  1. Create values.dev.local.yaml file in deploys/charts/coolstore, and put content as following
gateway:
  ip: 10.96.34.68
  1. Apply istioctl command to coolstore chart
> helm template deploys/charts/coolstore -f deploys/charts/coolstore/values.dev.yaml -f deploys/charts/coolstore/values.dev.local.yaml > deploys/k8s/dev-all-in-one.yaml
> kubectl create -f <(istioctl kube-inject -f deploys/k8s/dev-all-in-one.yaml)
  1. Add hosts file with following content (/etc/hosts)
127.0.0.1   api.coolstore.local
127.0.0.1   id.coolstore.local
127.0.0.1   coolstore.local

Waiting for the container provision completed

> curl -I http://coolstore.local # Website
> curl -I http://api.coolstore.local # API Gateway
> curl -I http://id.coolstore.local # Identity Provider

🐝 Hola! We get it works on the local machine.

  1. Clean up coolstore chart as
> kubectl delete -f deployment/k8s/dev-all-in-one.yaml
> helm delete istio --purge