· 6 years ago · Nov 26, 2019, 01:56 PM
1## INSTALLATION ##
2
3* Install docker (https://docs.docker.com/v17.09/engine/installation/)
4
5* Install git (https://gist.github.com/derhuerst/1b15ff4652a867391f03)
6
7```bash
8Abrahams-MBP:abraham-mesa-challenge amesa$ git --version
9git version 2.20.1 (Apple Git-117)
10```
11
12Note: That is my macos current version, installing the last one should work.
13
14* Install npm (https://www.npmjs.com/get-npm)
15
16```bash
17Abrahams-MBP:abraham-mesa-challenge amesa$ node --version
18v12.5.0
19```
20
21Note: That is my current version, installing the last one should work.
22
23* Install node (https://nodejs.org/en/download/)
24
25```bash
26Abrahams-MBP:abraham-mesa-challenge amesa$ npm --version
276.9.0
28```
29
30Note: That is my current version, installing the last one should work.
31
32## SETUP ##
33
34* Clone the project (in the selected dir)
35
36```bash
37git clone git@gitlab.com:portoca/abraham-mesa-challenge.git
38```
39
40* Setup ssh key: https://docs.gitlab.com/ee/ssh/
41
42* Install dependencies (inside of the root folder)
43
44```bash
45npm install
46```
47
48Note: This will install the dependencies of the code just for this project.
49
50
51## RUN ##
52
53Run docker to make the API available in http://localhost:9090
54
55```bash
56docker run -p 9090:8080 -d portoca/interview
57```
58
59After the API is avaliable, just run the program (inside of the root folder)
60
61```bash
62node app.js 192.168.1.2 192.168.1.3
63```
64
65## WHAT I DID ##
66
67### Choosen language ###
68
69Javascript (node)
70
71* I have less learning curve in javascript cause I used to work with that language.
72* Javascript with ECMA6 allow us to structure the code with POO.
73
74#### Strong candidates ###
75
76* Bash (In my opinion this program will be less readable in bash)
77* Python (More learning curve to use it)
78
79## WHAT I ASSUMED ##
80
81* I created a starter infrastructure with 3 services, 1 lb and 3 monitor.
82* I created a monitor for each service cause the API receives the full link of the **monitor_path**.
83
84### Rolling Update Strategy ###
85
86#### Same IP ####
87
88* I unbinded one of the services from the load balancer (assuming that we have 3) with the same IP of the non-updated one.
89* Then I just create that service in our infrastructure
90* to save the new service with his monitor do the health check and after that bind the new service to the LB.
91
92#### Different IP ####
93
94* Just create the new service
95
96* Bind a monitor to that service
97
98* Do the health check
99
100* If "OK" bind to the load balancer
101
102* If "FAIL" we throw an error to stop program to "check what happnened with that service"