Coder Social home page Coder Social logo

training-microservices-v3's Introduction

Microservice Training

Prerequisites

$ minikube start # start local kubernetes
$ eval $(minikube docker-env) # connect docker to minikube machine
$ minikube addons enable ingress # we will need to use ingress resources
$ docker-compose up -d # start databases

Before you begin, stop all docker daemon processes on your local machine to avoid collision. We are going to use a VirtualBox virtual machine to run docker.

Running databases inside of the "cluster" is not part of the current training session. To emulate hosted database environments we created a docker-comopse script that runs a postgresql database on the minikube machine but outside of kubernetes.

Easy mode:

./scripts/up

If you encounter any problems: follow the guide below.

Navigate to http://localhost:5433 to view the database browser (pgweb). By default it will create a database for the one of the services. Navigate to the query tab and run the following query:

CREATE DATABASE "test-users-db";

User service

$ cd user
$ npm run build # build the image
$ kubectl create -f ./k8s/ # create all the necessary kubernetes resources
$ kubectl get pods # verify that they are running

Product service

$ cd product
$ npm run build # build the image
$ kubectl create -f ./k8s/ # create all the necessary kubernetes resources
$ kubectl get pods # verify that they are running

Migrate db

./scripts/migrate

Front-end

$ cd front-end
$ npm run docker-build

Be patient that can take 30 minutes even.

Gateway

$ cd gateway
$ npm run build # builds current image
$ kubectl create -f ./k8s/`

In case of image pull error, your docker environment is not pointed to kubernetes, so kubernetes cannot pull it from there. Try rebuilding the container from the previous step and the edit the kubernetes deployment with: kubectl edit gateway

Windows users notice

Docker for windows includes kubernetes, so instead of using minikube we can start using the kubernetes service provided by docker.

Ingress is not included by default, we have to include the following command: docker/for-win#1901

training-microservices-v3's People

Contributors

matehuszarik avatar peteyycz avatar shadowbeetle avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.