├── .gitignore ├── 04_Making_Real_Projects_with_Docker ├── Readme.md └── simpleweb │ ├── Dockerfile │ ├── index.js │ └── package.json ├── 05_Docker_Compose_with_Multiple_Local_Containers ├── Readme.md └── visits │ ├── Dockerfile │ ├── docker-compose.yaml │ ├── index.js │ └── package.json ├── 06_Creating_a_Production_Grade_Workflow ├── Readme.md └── frontend │ ├── .gitignore │ ├── Dockerfile │ ├── Dockerfile.dev │ ├── README.md │ ├── docker-compose.yml │ ├── package-lock.json │ ├── package.json │ ├── public │ ├── favicon.ico │ ├── index.html │ └── manifest.json │ └── src │ ├── App.css │ ├── App.js │ ├── App.test.js │ ├── index.css │ ├── index.js │ ├── logo.svg │ └── serviceWorker.js ├── 07_Continuous_Integration_and_Deployment_with_AWS ├── Readme.md └── frontend │ ├── .gitignore │ ├── .travis.yml │ ├── Dockerfile │ ├── Dockerfile.dev │ ├── README.md │ ├── docker-compose.yml │ ├── package-lock.json │ ├── package.json │ ├── public │ ├── favicon.ico │ ├── index.html │ └── manifest.json │ └── src │ ├── App.css │ ├── App.js │ ├── App.test.js │ ├── index.css │ ├── index.js │ ├── logo.svg │ └── serviceWorker.js ├── 08_Building_a_Multi_Container_Application └── Readme.md ├── 09_Dockerizing_Multiple_Services ├── client │ ├── .gitignore │ ├── Dockerfile.dev │ ├── package-lock.json │ ├── package.json │ ├── public │ │ ├── favicon.ico │ │ ├── index.html │ │ └── manifest.json │ └── src │ │ ├── App.css │ │ ├── App.js │ │ ├── App.test.js │ │ ├── Fib.js │ │ ├── OtherPage.js │ │ ├── index.css │ │ ├── index.js │ │ ├── logo.svg │ │ └── registerServiceWorker.js ├── docker-compose.yml ├── nginx │ ├── Dockerfile.dev │ └── default.conf ├── server │ ├── Dockerfile.dev │ ├── index.js │ ├── keys.js │ └── package.json └── worker │ ├── Dockerfile.dev │ ├── index.js │ ├── keys.js │ └── package.json ├── 10_A_Continuous_Integration_Workflow_for_Multiple_Images ├── .travis.yml ├── client │ ├── .gitignore │ ├── Dockerfile │ ├── Dockerfile.dev │ ├── nginx │ │ └── default.conf │ ├── package-lock.json │ ├── package.json │ ├── public │ │ ├── favicon.ico │ │ ├── index.html │ │ └── manifest.json │ └── src │ │ ├── App.css │ │ ├── App.js │ │ ├── App.test.js │ │ ├── Fib.js │ │ ├── OtherPage.js │ │ ├── index.css │ │ ├── index.js │ │ ├── logo.svg │ │ └── registerServiceWorker.js ├── docker-compose.yml ├── nginx │ ├── Dockerfile │ ├── Dockerfile.dev │ └── default.conf ├── server │ ├── Dockerfile │ ├── Dockerfile.dev │ ├── index.js │ ├── keys.js │ └── package.json └── worker │ ├── Dockerfile │ ├── Dockerfile.dev │ ├── index.js │ ├── keys.js │ └── package.json ├── 11_Multi_Container_Deployments_to_AWS ├── .travis.yml ├── Dcokerrun.aws.json ├── client │ ├── .gitignore │ ├── Dockerfile │ ├── Dockerfile.dev │ ├── nginx │ │ └── default.conf │ ├── package-lock.json │ ├── package.json │ ├── public │ │ ├── favicon.ico │ │ ├── index.html │ │ └── manifest.json │ └── src │ │ ├── App.css │ │ ├── App.js │ │ ├── App.test.js │ │ ├── Fib.js │ │ ├── OtherPage.js │ │ ├── index.css │ │ ├── index.js │ │ ├── logo.svg │ │ └── registerServiceWorker.js ├── docker-compose.yml ├── nginx │ ├── Dockerfile │ ├── Dockerfile.dev │ └── default.conf ├── server │ ├── Dockerfile │ ├── Dockerfile.dev │ ├── index.js │ ├── keys.js │ └── package.json └── worker │ ├── Dockerfile │ ├── Dockerfile.dev │ ├── index.js │ ├── keys.js │ └── package.json ├── 12_Onwards_to_Kubernetes ├── client-node-pod.yaml └── client-pod.yaml ├── 13_Maintaining_Sets_of_Containers_with_Deployments ├── client-deployment.yaml └── client-node-pod.yaml ├── 14_A_Multi_Container_App_with_Kubernetes ├── client-cluster-ip-service.yaml ├── client-deployment.yaml ├── database-persistent-volume-claim.yaml ├── postgres-cluster-ip-service.yaml ├── postgres-deployment.yaml ├── redis-cluster-ip-service.yaml ├── redis-deployment.yaml ├── server-cluster-ip-service.yaml ├── server-deployment.yaml └── worker-deploymant.yaml ├── 15_Handling_Traffic_with_Ingress_Controllers └── ingress-service.yaml ├── 16_Kubernetes_Production_Deployment ├── .travis.yml ├── README.md └── deploy.sh ├── 17_HTTPS_Setup_with_Kubernetes ├── README.md ├── certificate.yaml ├── ingress-service.yaml └── issuer.yaml ├── README.md └── img ├── pic-09-01.png ├── pic-09-02.png ├── pic-09-03.png ├── pic-09-04.png ├── pic-09-05.png ├── pic-09-06.png ├── pic-09-07.png ├── pic-10-01.png ├── pic-10-02.png ├── pic-10-03.png ├── pic-10-04.png ├── pic-11-01.png ├── pic-11-02.png ├── pic-14-01.png ├── pic-14-02.png ├── pic-14-03.png ├── pic-14-04.png ├── pic-14-05.png ├── pic-14-06.png ├── pic-14-07.png ├── pic-14-08.png ├── pic-14-09.png ├── pic-14-10.png ├── pic-15-01.png ├── pic-15-02.png ├── pic-15-03.png ├── pic-15-04.png ├── pic-15-05.png ├── pic-16-01.png ├── pic-16-02.png ├── pic-16-03.png ├── pic-16-04.png ├── pic-16-05.png ├── pic-16-06.png ├── pic-16-07.png ├── pic-16-08.png ├── pic-16-09.png ├── pic-16-10.png ├── pic-16-11.png ├── pic-16-12.png ├── pic-16-13.png ├── pic-16-14.png ├── pic-16-15.png ├── pic-16-16.png ├── pic-16-17.png ├── pic-16-18.png ├── pic-16-19.png ├── pic-16-20.png ├── pic-16-21.png ├── pic-16-22.png ├── pic-16-23.png ├── pic-16-24.png ├── pic-16-25.png ├── pic-16-26.png ├── pic-16-27.png ├── pic-16-28.png ├── pic-16-29.png ├── pic-16-30.png ├── pic-16-31.png ├── pic-16-32.png ├── pic-16-33.png ├── pic-16-34.png ├── pic-16-35.png ├── pic-16-36.png ├── pic-16-37.png ├── pic-16-38.png ├── pic-16-39.png ├── pic-16-40.png ├── pic-16-41.png ├── pic-16-42.png ├── pic-16-43.png ├── pic-17-01.png ├── pic-17-02.png ├── pic-17-03.png ├── pic-17-04.png ├── pic-17-05.png ├── pic-17-06.png ├── pic-17-07.png ├── pic-17-08.png ├── pic-17-09.png ├── pic-17-10.png ├── pic-17-11.png ├── pic-17-12.png └── pic-17-13.png /.gitignore: -------------------------------------------------------------------------------- 1 | *.~ 2 | */dist 3 | */.cache 4 | 5 | # Logs 6 | logs 7 | *.log 8 | npm-debug.log* 9 | yarn-debug.log* 10 | yarn-error.log* 11 | 12 | # Runtime data 13 | pids 14 | *.pid 15 | *.seed 16 | *.pid.lock 17 | 18 | # Directory for instrumented libs generated by jscoverage/JSCover 19 | lib-cov 20 | 21 | # Coverage directory used by tools like istanbul 22 | coverage 23 | 24 | # nyc test coverage 25 | .nyc_output 26 | 27 | # Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) 28 | .grunt 29 | 30 | # Bower dependency directory (https://bower.io/) 31 | bower_components 32 | 33 | # node-waf configuration 34 | .lock-wscript 35 | 36 | # Compiled binary addons (https://nodejs.org/api/addons.html) 37 | build/Release 38 | 39 | # Dependency directories 40 | node_modules/ 41 | jspm_packages/ 42 | 43 | # TypeScript v1 declaration files 44 | typings/ 45 | 46 | # Optional npm cache directory 47 | .npm 48 | 49 | # Optional eslint cache 50 | .eslintcache 51 | 52 | # Optional REPL history 53 | .node_repl_history 54 | 55 | # Output of 'npm pack' 56 | *.tgz 57 | 58 | # Yarn Integrity file 59 | .yarn-integrity 60 | 61 | # dotenv environment variables file 62 | .env 63 | 64 | # next.js build output 65 | .next -------------------------------------------------------------------------------- /04_Making_Real_Projects_with_Docker/Readme.md: -------------------------------------------------------------------------------- 1 | $ cd simpleweb/ 2 | $ docker build -t marley/simpleweb . 3 | $ docker run -p 8080:8080 marley/simpleweb 4 | -------------------------------------------------------------------------------- /04_Making_Real_Projects_with_Docker/simpleweb/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM node:alpine 2 | 3 | WORKDIR /app 4 | 5 | COPY ./package.json ./ 6 | RUN npm install 7 | COPY ./ ./ 8 | 9 | CMD ["npm", "start"] -------------------------------------------------------------------------------- /04_Making_Real_Projects_with_Docker/simpleweb/index.js: -------------------------------------------------------------------------------- 1 | const express = require("express"); 2 | 3 | const app = express(); 4 | 5 | app.get("/", (req, res) => { 6 | res.send("Hi there"); 7 | }); 8 | 9 | app.listen(8080, () => { 10 | console.log("Listening on port 8080"); 11 | }); 12 | -------------------------------------------------------------------------------- /04_Making_Real_Projects_with_Docker/simpleweb/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "dependencies": { 3 | "express": "*" 4 | }, 5 | "scripts": { 6 | "start": "node index.js" 7 | } 8 | } -------------------------------------------------------------------------------- /05_Docker_Compose_with_Multiple_Local_Containers/Readme.md: -------------------------------------------------------------------------------- 1 | $ cd visits/ 2 | $ docker-compose up --build 3 | -------------------------------------------------------------------------------- /05_Docker_Compose_with_Multiple_Local_Containers/visits/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM node:alpine 2 | 3 | WORKDIR /app 4 | 5 | COPY ./package.json ./ 6 | RUN npm install 7 | COPY ./ ./ 8 | 9 | CMD ["npm", "start"] -------------------------------------------------------------------------------- /05_Docker_Compose_with_Multiple_Local_Containers/visits/docker-compose.yaml: -------------------------------------------------------------------------------- 1 | version: "3" 2 | services: 3 | redis-server: 4 | image: "redis" 5 | node-app: 6 | restart: always 7 | build: . 8 | ports: 9 | - "8081:8081" 10 | -------------------------------------------------------------------------------- /05_Docker_Compose_with_Multiple_Local_Containers/visits/index.js: -------------------------------------------------------------------------------- 1 | const express = require("express"); 2 | const redis = require("redis"); 3 | 4 | const app = express(); 5 | const client = redis.createClient({ 6 | host: "redis-server", 7 | port: 6379 8 | }); 9 | client.set("visits", 0); 10 | 11 | app.get("/", (req, res) => { 12 | client.get("visits", (err, visits) => { 13 | res.send("Number of visits is " + visits); 14 | client.set("visits", parseInt(visits) + 1); 15 | }); 16 | }); 17 | 18 | app.listen(8081, () => { 19 | console.log("Listening on port 8081"); 20 | }); 21 | -------------------------------------------------------------------------------- /05_Docker_Compose_with_Multiple_Local_Containers/visits/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "dependencies": { 3 | "express": "*", 4 | "redis": "2.8.0" 5 | }, 6 | "scripts": { 7 | "start": "node index.js" 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /06_Creating_a_Production_Grade_Workflow/Readme.md: -------------------------------------------------------------------------------- 1 | $ npx create-react-app frontend 2 | $ cd frontend 3 | 4 |
5 | 6 | $ docker build -f Dockerfile.dev . 7 | $ docker run -p 3000:3000 -v /app/node_modules -v $(pwd):/app 5a9f799f3564 8 | 9 |
10 | 11 | $ docker-compose up --build 12 | 13 |
14 | 15 | **Final:** 16 | 17 | $ docker build . 18 | $ docker run -p 8080:80 176a084c3114 19 | -------------------------------------------------------------------------------- /06_Creating_a_Production_Grade_Workflow/frontend/.gitignore: -------------------------------------------------------------------------------- 1 | # See https://help.github.com/articles/ignoring-files/ for more about ignoring files. 2 | 3 | # dependencies 4 | /node_modules 5 | /.pnp 6 | .pnp.js 7 | 8 | # testing 9 | /coverage 10 | 11 | # production 12 | /build 13 | 14 | # misc 15 | .DS_Store 16 | .env.local 17 | .env.development.local 18 | .env.test.local 19 | .env.production.local 20 | 21 | npm-debug.log* 22 | yarn-debug.log* 23 | yarn-error.log* 24 | -------------------------------------------------------------------------------- /06_Creating_a_Production_Grade_Workflow/frontend/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM node:alpine as builder 2 | 3 | WORKDIR /app 4 | 5 | COPY package.json . 6 | RUN npm install 7 | 8 | COPY . . 9 | 10 | RUN npm run build 11 | 12 | FROM nginx 13 | COPY --from=builder /app/build /usr/share/nginx/html -------------------------------------------------------------------------------- /06_Creating_a_Production_Grade_Workflow/frontend/Dockerfile.dev: -------------------------------------------------------------------------------- 1 | FROM node:alpine 2 | 3 | WORKDIR /app 4 | 5 | COPY package.json . 6 | RUN npm install 7 | 8 | COPY . . 9 | 10 | CMD ["npm", "run", "start"] -------------------------------------------------------------------------------- /06_Creating_a_Production_Grade_Workflow/frontend/README.md: -------------------------------------------------------------------------------- 1 | This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app). 2 | 3 | ## Available Scripts 4 | 5 | In the project directory, you can run: 6 | 7 | ### `npm start` 8 | 9 | Runs the app in the development mode.
10 | Open [http://localhost:3000](http://localhost:3000) to view it in the browser. 11 | 12 | The page will reload if you make edits.
13 | You will also see any lint errors in the console. 14 | 15 | ### `npm test` 16 | 17 | Launches the test runner in the interactive watch mode.
18 | See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information. 19 | 20 | ### `npm run build` 21 | 22 | Builds the app for production to the `build` folder.
23 | It correctly bundles React in production mode and optimizes the build for the best performance. 24 | 25 | The build is minified and the filenames include the hashes.
26 | Your app is ready to be deployed! 27 | 28 | See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information. 29 | 30 | ### `npm run eject` 31 | 32 | **Note: this is a one-way operation. Once you `eject`, you can’t go back!** 33 | 34 | If you aren’t satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project. 35 | 36 | Instead, it will copy all the configuration files and the transitive dependencies (Webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point you’re on your own. 37 | 38 | You don’t have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldn’t feel obligated to use this feature. However we understand that this tool wouldn’t be useful if you couldn’t customize it when you are ready for it. 39 | 40 | ## Learn More 41 | 42 | You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started). 43 | 44 | To learn React, check out the [React documentation](https://reactjs.org/). 45 | 46 | ### Code Splitting 47 | 48 | This section has moved here: https://facebook.github.io/create-react-app/docs/code-splitting 49 | 50 | ### Analyzing the Bundle Size 51 | 52 | This section has moved here: https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size 53 | 54 | ### Making a Progressive Web App 55 | 56 | This section has moved here: https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app 57 | 58 | ### Advanced Configuration 59 | 60 | This section has moved here: https://facebook.github.io/create-react-app/docs/advanced-configuration 61 | 62 | ### Deployment 63 | 64 | This section has moved here: https://facebook.github.io/create-react-app/docs/deployment 65 | 66 | ### `npm run build` fails to minify 67 | 68 | This section has moved here: https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify 69 | -------------------------------------------------------------------------------- /06_Creating_a_Production_Grade_Workflow/frontend/docker-compose.yml: -------------------------------------------------------------------------------- 1 | version: "3" 2 | services: 3 | web: 4 | build: 5 | context: . 6 | dockerfile: Dockerfile.dev 7 | ports: 8 | - "3000:3000" 9 | volumes: 10 | - /app/node_modules 11 | - .:/app 12 | tests: 13 | build: 14 | context: . 15 | dockerfile: Dockerfile.dev 16 | volumes: 17 | - /app/node_modules 18 | - .:/app 19 | command: ["npm", "run", "test"] 20 | -------------------------------------------------------------------------------- /06_Creating_a_Production_Grade_Workflow/frontend/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "frontend", 3 | "version": "0.1.0", 4 | "private": true, 5 | "dependencies": { 6 | "react": "^16.8.6", 7 | "react-dom": "^16.8.6", 8 | "react-scripts": "2.1.8" 9 | }, 10 | "scripts": { 11 | "start": "react-scripts start", 12 | "build": "react-scripts build", 13 | "test": "react-scripts test", 14 | "eject": "react-scripts eject" 15 | }, 16 | "eslintConfig": { 17 | "extends": "react-app" 18 | }, 19 | "browserslist": [ 20 | ">0.2%", 21 | "not dead", 22 | "not ie <= 11", 23 | "not op_mini all" 24 | ] 25 | } 26 | -------------------------------------------------------------------------------- /06_Creating_a_Production_Grade_Workflow/frontend/public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/webmakaka/Docker-and-Kubernetes-The-Complete-Guide/488b431085038ebf03f07a78aec15723fa6783c3/06_Creating_a_Production_Grade_Workflow/frontend/public/favicon.ico -------------------------------------------------------------------------------- /06_Creating_a_Production_Grade_Workflow/frontend/public/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 10 | 11 | 15 | 16 | 25 | React App 26 | 27 | 28 | 29 |
30 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /06_Creating_a_Production_Grade_Workflow/frontend/public/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "short_name": "React App", 3 | "name": "Create React App Sample", 4 | "icons": [ 5 | { 6 | "src": "favicon.ico", 7 | "sizes": "64x64 32x32 24x24 16x16", 8 | "type": "image/x-icon" 9 | } 10 | ], 11 | "start_url": ".", 12 | "display": "standalone", 13 | "theme_color": "#000000", 14 | "background_color": "#ffffff" 15 | } 16 | -------------------------------------------------------------------------------- /06_Creating_a_Production_Grade_Workflow/frontend/src/App.css: -------------------------------------------------------------------------------- 1 | .App { 2 | text-align: center; 3 | } 4 | 5 | .App-logo { 6 | animation: App-logo-spin infinite 20s linear; 7 | height: 40vmin; 8 | pointer-events: none; 9 | } 10 | 11 | .App-header { 12 | background-color: #282c34; 13 | min-height: 100vh; 14 | display: flex; 15 | flex-direction: column; 16 | align-items: center; 17 | justify-content: center; 18 | font-size: calc(10px + 2vmin); 19 | color: white; 20 | } 21 | 22 | .App-link { 23 | color: #61dafb; 24 | } 25 | 26 | @keyframes App-logo-spin { 27 | from { 28 | transform: rotate(0deg); 29 | } 30 | to { 31 | transform: rotate(360deg); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /06_Creating_a_Production_Grade_Workflow/frontend/src/App.js: -------------------------------------------------------------------------------- 1 | import React, { Component } from "react"; 2 | import logo from "./logo.svg"; 3 | import "./App.css"; 4 | 5 | class App extends Component { 6 | render() { 7 | return ( 8 |
9 |
10 | logo 11 |

12 | Edit src/App.js and save to reload. 13 |

14 | 20 | Learn React 21 | 22 |
23 |
24 | ); 25 | } 26 | } 27 | 28 | export default App; 29 | -------------------------------------------------------------------------------- /06_Creating_a_Production_Grade_Workflow/frontend/src/App.test.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import ReactDOM from 'react-dom'; 3 | import App from './App'; 4 | 5 | it('renders without crashing', () => { 6 | const div = document.createElement('div'); 7 | ReactDOM.render(, div); 8 | ReactDOM.unmountComponentAtNode(div); 9 | }); 10 | -------------------------------------------------------------------------------- /06_Creating_a_Production_Grade_Workflow/frontend/src/index.css: -------------------------------------------------------------------------------- 1 | body { 2 | margin: 0; 3 | padding: 0; 4 | font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen", 5 | "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue", 6 | sans-serif; 7 | -webkit-font-smoothing: antialiased; 8 | -moz-osx-font-smoothing: grayscale; 9 | } 10 | 11 | code { 12 | font-family: source-code-pro, Menlo, Monaco, Consolas, "Courier New", 13 | monospace; 14 | } 15 | -------------------------------------------------------------------------------- /06_Creating_a_Production_Grade_Workflow/frontend/src/index.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import ReactDOM from 'react-dom'; 3 | import './index.css'; 4 | import App from './App'; 5 | import * as serviceWorker from './serviceWorker'; 6 | 7 | ReactDOM.render(, document.getElementById('root')); 8 | 9 | // If you want your app to work offline and load faster, you can change 10 | // unregister() to register() below. Note this comes with some pitfalls. 11 | // Learn more about service workers: https://bit.ly/CRA-PWA 12 | serviceWorker.unregister(); 13 | -------------------------------------------------------------------------------- /06_Creating_a_Production_Grade_Workflow/frontend/src/logo.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /06_Creating_a_Production_Grade_Workflow/frontend/src/serviceWorker.js: -------------------------------------------------------------------------------- 1 | // This optional code is used to register a service worker. 2 | // register() is not called by default. 3 | 4 | // This lets the app load faster on subsequent visits in production, and gives 5 | // it offline capabilities. However, it also means that developers (and users) 6 | // will only see deployed updates on subsequent visits to a page, after all the 7 | // existing tabs open on the page have been closed, since previously cached 8 | // resources are updated in the background. 9 | 10 | // To learn more about the benefits of this model and instructions on how to 11 | // opt-in, read https://bit.ly/CRA-PWA 12 | 13 | const isLocalhost = Boolean( 14 | window.location.hostname === 'localhost' || 15 | // [::1] is the IPv6 localhost address. 16 | window.location.hostname === '[::1]' || 17 | // 127.0.0.1/8 is considered localhost for IPv4. 18 | window.location.hostname.match( 19 | /^127(?:\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}$/ 20 | ) 21 | ); 22 | 23 | export function register(config) { 24 | if (process.env.NODE_ENV === 'production' && 'serviceWorker' in navigator) { 25 | // The URL constructor is available in all browsers that support SW. 26 | const publicUrl = new URL(process.env.PUBLIC_URL, window.location.href); 27 | if (publicUrl.origin !== window.location.origin) { 28 | // Our service worker won't work if PUBLIC_URL is on a different origin 29 | // from what our page is served on. This might happen if a CDN is used to 30 | // serve assets; see https://github.com/facebook/create-react-app/issues/2374 31 | return; 32 | } 33 | 34 | window.addEventListener('load', () => { 35 | const swUrl = `${process.env.PUBLIC_URL}/service-worker.js`; 36 | 37 | if (isLocalhost) { 38 | // This is running on localhost. Let's check if a service worker still exists or not. 39 | checkValidServiceWorker(swUrl, config); 40 | 41 | // Add some additional logging to localhost, pointing developers to the 42 | // service worker/PWA documentation. 43 | navigator.serviceWorker.ready.then(() => { 44 | console.log( 45 | 'This web app is being served cache-first by a service ' + 46 | 'worker. To learn more, visit https://bit.ly/CRA-PWA' 47 | ); 48 | }); 49 | } else { 50 | // Is not localhost. Just register service worker 51 | registerValidSW(swUrl, config); 52 | } 53 | }); 54 | } 55 | } 56 | 57 | function registerValidSW(swUrl, config) { 58 | navigator.serviceWorker 59 | .register(swUrl) 60 | .then(registration => { 61 | registration.onupdatefound = () => { 62 | const installingWorker = registration.installing; 63 | if (installingWorker == null) { 64 | return; 65 | } 66 | installingWorker.onstatechange = () => { 67 | if (installingWorker.state === 'installed') { 68 | if (navigator.serviceWorker.controller) { 69 | // At this point, the updated precached content has been fetched, 70 | // but the previous service worker will still serve the older 71 | // content until all client tabs are closed. 72 | console.log( 73 | 'New content is available and will be used when all ' + 74 | 'tabs for this page are closed. See https://bit.ly/CRA-PWA.' 75 | ); 76 | 77 | // Execute callback 78 | if (config && config.onUpdate) { 79 | config.onUpdate(registration); 80 | } 81 | } else { 82 | // At this point, everything has been precached. 83 | // It's the perfect time to display a 84 | // "Content is cached for offline use." message. 85 | console.log('Content is cached for offline use.'); 86 | 87 | // Execute callback 88 | if (config && config.onSuccess) { 89 | config.onSuccess(registration); 90 | } 91 | } 92 | } 93 | }; 94 | }; 95 | }) 96 | .catch(error => { 97 | console.error('Error during service worker registration:', error); 98 | }); 99 | } 100 | 101 | function checkValidServiceWorker(swUrl, config) { 102 | // Check if the service worker can be found. If it can't reload the page. 103 | fetch(swUrl) 104 | .then(response => { 105 | // Ensure service worker exists, and that we really are getting a JS file. 106 | const contentType = response.headers.get('content-type'); 107 | if ( 108 | response.status === 404 || 109 | (contentType != null && contentType.indexOf('javascript') === -1) 110 | ) { 111 | // No service worker found. Probably a different app. Reload the page. 112 | navigator.serviceWorker.ready.then(registration => { 113 | registration.unregister().then(() => { 114 | window.location.reload(); 115 | }); 116 | }); 117 | } else { 118 | // Service worker found. Proceed as normal. 119 | registerValidSW(swUrl, config); 120 | } 121 | }) 122 | .catch(() => { 123 | console.log( 124 | 'No internet connection found. App is running in offline mode.' 125 | ); 126 | }); 127 | } 128 | 129 | export function unregister() { 130 | if ('serviceWorker' in navigator) { 131 | navigator.serviceWorker.ready.then(registration => { 132 | registration.unregister(); 133 | }); 134 | } 135 | } 136 | -------------------------------------------------------------------------------- /07_Continuous_Integration_and_Deployment_with_AWS/Readme.md: -------------------------------------------------------------------------------- 1 | **.travis.yml** 2 | 3 |
4 | 5 | **AWS** 6 | 7 | Add New User: docker-react-travice-ci 8 | 9 |
10 | 11 | **Travis Settigs:** 12 | 13 | Environment Variables 14 | 15 | AWS_ACCESS_KEY 16 | AWS_SECRET_KEY 17 | -------------------------------------------------------------------------------- /07_Continuous_Integration_and_Deployment_with_AWS/frontend/.gitignore: -------------------------------------------------------------------------------- 1 | # See https://help.github.com/articles/ignoring-files/ for more about ignoring files. 2 | 3 | # dependencies 4 | /node_modules 5 | /.pnp 6 | .pnp.js 7 | 8 | # testing 9 | /coverage 10 | 11 | # production 12 | /build 13 | 14 | # misc 15 | .DS_Store 16 | .env.local 17 | .env.development.local 18 | .env.test.local 19 | .env.production.local 20 | 21 | npm-debug.log* 22 | yarn-debug.log* 23 | yarn-error.log* 24 | -------------------------------------------------------------------------------- /07_Continuous_Integration_and_Deployment_with_AWS/frontend/.travis.yml: -------------------------------------------------------------------------------- 1 | sudo: required 2 | services: 3 | - docker 4 | 5 | before_install: 6 | - docker build -t marley/docker-react -f Dockerfile.dev . 7 | 8 | script: 9 | - docker run marley/docker-react npm run test -- --coverage 10 | 11 | deploy: 12 | provider: elasticbeanstalk 13 | region: "us-west-2" 14 | app: "docker-app" 15 | env: "Dcoker-env" 16 | bucket_name: "elasticbeanstalk-us-west-2-3064766" 17 | bucket_path: "docker-app" 18 | on: 19 | branch: master 20 | access_key_id: $AWS_ACCESS_KEY 21 | secret_access_key: 22 | secure: "$AWS_SECRET_KEY" 23 | -------------------------------------------------------------------------------- /07_Continuous_Integration_and_Deployment_with_AWS/frontend/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM node:alpine as builder 2 | 3 | WORKDIR /app 4 | 5 | COPY package.json . 6 | RUN npm install 7 | 8 | COPY . . 9 | 10 | RUN npm run build 11 | 12 | FROM nginx 13 | EXPOSE 80 14 | COPY --from=builder /app/build /usr/share/nginx/html -------------------------------------------------------------------------------- /07_Continuous_Integration_and_Deployment_with_AWS/frontend/Dockerfile.dev: -------------------------------------------------------------------------------- 1 | FROM node:alpine 2 | 3 | WORKDIR /app 4 | 5 | COPY package.json . 6 | RUN npm install 7 | 8 | COPY . . 9 | 10 | CMD ["npm", "run", "start"] -------------------------------------------------------------------------------- /07_Continuous_Integration_and_Deployment_with_AWS/frontend/README.md: -------------------------------------------------------------------------------- 1 | This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app). 2 | 3 | ## Available Scripts 4 | 5 | In the project directory, you can run: 6 | 7 | ### `npm start` 8 | 9 | Runs the app in the development mode.
10 | Open [http://localhost:3000](http://localhost:3000) to view it in the browser. 11 | 12 | The page will reload if you make edits.
13 | You will also see any lint errors in the console. 14 | 15 | ### `npm test` 16 | 17 | Launches the test runner in the interactive watch mode.
18 | See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information. 19 | 20 | ### `npm run build` 21 | 22 | Builds the app for production to the `build` folder.
23 | It correctly bundles React in production mode and optimizes the build for the best performance. 24 | 25 | The build is minified and the filenames include the hashes.
26 | Your app is ready to be deployed! 27 | 28 | See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information. 29 | 30 | ### `npm run eject` 31 | 32 | **Note: this is a one-way operation. Once you `eject`, you can’t go back!** 33 | 34 | If you aren’t satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project. 35 | 36 | Instead, it will copy all the configuration files and the transitive dependencies (Webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point you’re on your own. 37 | 38 | You don’t have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldn’t feel obligated to use this feature. However we understand that this tool wouldn’t be useful if you couldn’t customize it when you are ready for it. 39 | 40 | ## Learn More 41 | 42 | You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started). 43 | 44 | To learn React, check out the [React documentation](https://reactjs.org/). 45 | 46 | ### Code Splitting 47 | 48 | This section has moved here: https://facebook.github.io/create-react-app/docs/code-splitting 49 | 50 | ### Analyzing the Bundle Size 51 | 52 | This section has moved here: https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size 53 | 54 | ### Making a Progressive Web App 55 | 56 | This section has moved here: https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app 57 | 58 | ### Advanced Configuration 59 | 60 | This section has moved here: https://facebook.github.io/create-react-app/docs/advanced-configuration 61 | 62 | ### Deployment 63 | 64 | This section has moved here: https://facebook.github.io/create-react-app/docs/deployment 65 | 66 | ### `npm run build` fails to minify 67 | 68 | This section has moved here: https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify 69 | -------------------------------------------------------------------------------- /07_Continuous_Integration_and_Deployment_with_AWS/frontend/docker-compose.yml: -------------------------------------------------------------------------------- 1 | version: "3" 2 | services: 3 | web: 4 | build: 5 | context: . 6 | dockerfile: Dockerfile.dev 7 | ports: 8 | - "3000:3000" 9 | volumes: 10 | - /app/node_modules 11 | - .:/app 12 | tests: 13 | build: 14 | context: . 15 | dockerfile: Dockerfile.dev 16 | volumes: 17 | - /app/node_modules 18 | - .:/app 19 | command: ["npm", "run", "test"] 20 | -------------------------------------------------------------------------------- /07_Continuous_Integration_and_Deployment_with_AWS/frontend/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "frontend", 3 | "version": "0.1.0", 4 | "private": true, 5 | "dependencies": { 6 | "react": "^16.8.6", 7 | "react-dom": "^16.8.6", 8 | "react-scripts": "2.1.8" 9 | }, 10 | "scripts": { 11 | "start": "react-scripts start", 12 | "build": "react-scripts build", 13 | "test": "react-scripts test", 14 | "eject": "react-scripts eject" 15 | }, 16 | "eslintConfig": { 17 | "extends": "react-app" 18 | }, 19 | "browserslist": [ 20 | ">0.2%", 21 | "not dead", 22 | "not ie <= 11", 23 | "not op_mini all" 24 | ] 25 | } 26 | -------------------------------------------------------------------------------- /07_Continuous_Integration_and_Deployment_with_AWS/frontend/public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/webmakaka/Docker-and-Kubernetes-The-Complete-Guide/488b431085038ebf03f07a78aec15723fa6783c3/07_Continuous_Integration_and_Deployment_with_AWS/frontend/public/favicon.ico -------------------------------------------------------------------------------- /07_Continuous_Integration_and_Deployment_with_AWS/frontend/public/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 10 | 11 | 15 | 16 | 25 | React App 26 | 27 | 28 | 29 |
30 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /07_Continuous_Integration_and_Deployment_with_AWS/frontend/public/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "short_name": "React App", 3 | "name": "Create React App Sample", 4 | "icons": [ 5 | { 6 | "src": "favicon.ico", 7 | "sizes": "64x64 32x32 24x24 16x16", 8 | "type": "image/x-icon" 9 | } 10 | ], 11 | "start_url": ".", 12 | "display": "standalone", 13 | "theme_color": "#000000", 14 | "background_color": "#ffffff" 15 | } 16 | -------------------------------------------------------------------------------- /07_Continuous_Integration_and_Deployment_with_AWS/frontend/src/App.css: -------------------------------------------------------------------------------- 1 | .App { 2 | text-align: center; 3 | } 4 | 5 | .App-logo { 6 | animation: App-logo-spin infinite 20s linear; 7 | height: 40vmin; 8 | pointer-events: none; 9 | } 10 | 11 | .App-header { 12 | background-color: #282c34; 13 | min-height: 100vh; 14 | display: flex; 15 | flex-direction: column; 16 | align-items: center; 17 | justify-content: center; 18 | font-size: calc(10px + 2vmin); 19 | color: white; 20 | } 21 | 22 | .App-link { 23 | color: #61dafb; 24 | } 25 | 26 | @keyframes App-logo-spin { 27 | from { 28 | transform: rotate(0deg); 29 | } 30 | to { 31 | transform: rotate(360deg); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /07_Continuous_Integration_and_Deployment_with_AWS/frontend/src/App.js: -------------------------------------------------------------------------------- 1 | import React, { Component } from "react"; 2 | import logo from "./logo.svg"; 3 | import "./App.css"; 4 | 5 | class App extends Component { 6 | render() { 7 | return ( 8 |
9 |
10 | logo 11 |

12 | Edit src/App.js and save to reload. 13 |

14 | 20 | Learn React 21 | 22 |
23 |
24 | ); 25 | } 26 | } 27 | 28 | export default App; 29 | -------------------------------------------------------------------------------- /07_Continuous_Integration_and_Deployment_with_AWS/frontend/src/App.test.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import ReactDOM from 'react-dom'; 3 | import App from './App'; 4 | 5 | it('renders without crashing', () => { 6 | const div = document.createElement('div'); 7 | ReactDOM.render(, div); 8 | ReactDOM.unmountComponentAtNode(div); 9 | }); 10 | -------------------------------------------------------------------------------- /07_Continuous_Integration_and_Deployment_with_AWS/frontend/src/index.css: -------------------------------------------------------------------------------- 1 | body { 2 | margin: 0; 3 | padding: 0; 4 | font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen", 5 | "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue", 6 | sans-serif; 7 | -webkit-font-smoothing: antialiased; 8 | -moz-osx-font-smoothing: grayscale; 9 | } 10 | 11 | code { 12 | font-family: source-code-pro, Menlo, Monaco, Consolas, "Courier New", 13 | monospace; 14 | } 15 | -------------------------------------------------------------------------------- /07_Continuous_Integration_and_Deployment_with_AWS/frontend/src/index.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import ReactDOM from 'react-dom'; 3 | import './index.css'; 4 | import App from './App'; 5 | import * as serviceWorker from './serviceWorker'; 6 | 7 | ReactDOM.render(, document.getElementById('root')); 8 | 9 | // If you want your app to work offline and load faster, you can change 10 | // unregister() to register() below. Note this comes with some pitfalls. 11 | // Learn more about service workers: https://bit.ly/CRA-PWA 12 | serviceWorker.unregister(); 13 | -------------------------------------------------------------------------------- /07_Continuous_Integration_and_Deployment_with_AWS/frontend/src/logo.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /07_Continuous_Integration_and_Deployment_with_AWS/frontend/src/serviceWorker.js: -------------------------------------------------------------------------------- 1 | // This optional code is used to register a service worker. 2 | // register() is not called by default. 3 | 4 | // This lets the app load faster on subsequent visits in production, and gives 5 | // it offline capabilities. However, it also means that developers (and users) 6 | // will only see deployed updates on subsequent visits to a page, after all the 7 | // existing tabs open on the page have been closed, since previously cached 8 | // resources are updated in the background. 9 | 10 | // To learn more about the benefits of this model and instructions on how to 11 | // opt-in, read https://bit.ly/CRA-PWA 12 | 13 | const isLocalhost = Boolean( 14 | window.location.hostname === 'localhost' || 15 | // [::1] is the IPv6 localhost address. 16 | window.location.hostname === '[::1]' || 17 | // 127.0.0.1/8 is considered localhost for IPv4. 18 | window.location.hostname.match( 19 | /^127(?:\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}$/ 20 | ) 21 | ); 22 | 23 | export function register(config) { 24 | if (process.env.NODE_ENV === 'production' && 'serviceWorker' in navigator) { 25 | // The URL constructor is available in all browsers that support SW. 26 | const publicUrl = new URL(process.env.PUBLIC_URL, window.location.href); 27 | if (publicUrl.origin !== window.location.origin) { 28 | // Our service worker won't work if PUBLIC_URL is on a different origin 29 | // from what our page is served on. This might happen if a CDN is used to 30 | // serve assets; see https://github.com/facebook/create-react-app/issues/2374 31 | return; 32 | } 33 | 34 | window.addEventListener('load', () => { 35 | const swUrl = `${process.env.PUBLIC_URL}/service-worker.js`; 36 | 37 | if (isLocalhost) { 38 | // This is running on localhost. Let's check if a service worker still exists or not. 39 | checkValidServiceWorker(swUrl, config); 40 | 41 | // Add some additional logging to localhost, pointing developers to the 42 | // service worker/PWA documentation. 43 | navigator.serviceWorker.ready.then(() => { 44 | console.log( 45 | 'This web app is being served cache-first by a service ' + 46 | 'worker. To learn more, visit https://bit.ly/CRA-PWA' 47 | ); 48 | }); 49 | } else { 50 | // Is not localhost. Just register service worker 51 | registerValidSW(swUrl, config); 52 | } 53 | }); 54 | } 55 | } 56 | 57 | function registerValidSW(swUrl, config) { 58 | navigator.serviceWorker 59 | .register(swUrl) 60 | .then(registration => { 61 | registration.onupdatefound = () => { 62 | const installingWorker = registration.installing; 63 | if (installingWorker == null) { 64 | return; 65 | } 66 | installingWorker.onstatechange = () => { 67 | if (installingWorker.state === 'installed') { 68 | if (navigator.serviceWorker.controller) { 69 | // At this point, the updated precached content has been fetched, 70 | // but the previous service worker will still serve the older 71 | // content until all client tabs are closed. 72 | console.log( 73 | 'New content is available and will be used when all ' + 74 | 'tabs for this page are closed. See https://bit.ly/CRA-PWA.' 75 | ); 76 | 77 | // Execute callback 78 | if (config && config.onUpdate) { 79 | config.onUpdate(registration); 80 | } 81 | } else { 82 | // At this point, everything has been precached. 83 | // It's the perfect time to display a 84 | // "Content is cached for offline use." message. 85 | console.log('Content is cached for offline use.'); 86 | 87 | // Execute callback 88 | if (config && config.onSuccess) { 89 | config.onSuccess(registration); 90 | } 91 | } 92 | } 93 | }; 94 | }; 95 | }) 96 | .catch(error => { 97 | console.error('Error during service worker registration:', error); 98 | }); 99 | } 100 | 101 | function checkValidServiceWorker(swUrl, config) { 102 | // Check if the service worker can be found. If it can't reload the page. 103 | fetch(swUrl) 104 | .then(response => { 105 | // Ensure service worker exists, and that we really are getting a JS file. 106 | const contentType = response.headers.get('content-type'); 107 | if ( 108 | response.status === 404 || 109 | (contentType != null && contentType.indexOf('javascript') === -1) 110 | ) { 111 | // No service worker found. Probably a different app. Reload the page. 112 | navigator.serviceWorker.ready.then(registration => { 113 | registration.unregister().then(() => { 114 | window.location.reload(); 115 | }); 116 | }); 117 | } else { 118 | // Service worker found. Proceed as normal. 119 | registerValidSW(swUrl, config); 120 | } 121 | }) 122 | .catch(() => { 123 | console.log( 124 | 'No internet connection found. App is running in offline mode.' 125 | ); 126 | }); 127 | } 128 | 129 | export function unregister() { 130 | if ('serviceWorker' in navigator) { 131 | navigator.serviceWorker.ready.then(registration => { 132 | registration.unregister(); 133 | }); 134 | } 135 | } 136 | -------------------------------------------------------------------------------- /08_Building_a_Multi_Container_Application/Readme.md: -------------------------------------------------------------------------------- 1 | $ npx create-react-app client 2 | -------------------------------------------------------------------------------- /09_Dockerizing_Multiple_Services/client/.gitignore: -------------------------------------------------------------------------------- 1 | # See https://help.github.com/ignore-files/ for more about ignoring files. 2 | 3 | # dependencies 4 | /node_modules 5 | 6 | # testing 7 | /coverage 8 | 9 | # production 10 | /build 11 | 12 | # misc 13 | .DS_Store 14 | .env.local 15 | .env.development.local 16 | .env.test.local 17 | .env.production.local 18 | 19 | npm-debug.log* 20 | yarn-debug.log* 21 | yarn-error.log* 22 | -------------------------------------------------------------------------------- /09_Dockerizing_Multiple_Services/client/Dockerfile.dev: -------------------------------------------------------------------------------- 1 | FROM node:alpine 2 | WORKDIR /app 3 | COPY ./package.json ./ 4 | RUN npm install 5 | COPY . . 6 | CMD ["npm", "run", "start"] -------------------------------------------------------------------------------- /09_Dockerizing_Multiple_Services/client/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "client", 3 | "version": "0.1.0", 4 | "private": true, 5 | "dependencies": { 6 | "react": "^16.4.2", 7 | "react-dom": "^16.4.2", 8 | "react-scripts": "1.1.4", 9 | "react-router-dom": "4.3.1", 10 | "axios": "0.18.0" 11 | }, 12 | "scripts": { 13 | "start": "react-scripts start", 14 | "build": "react-scripts build", 15 | "test": "react-scripts test --env=jsdom", 16 | "eject": "react-scripts eject" 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /09_Dockerizing_Multiple_Services/client/public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/webmakaka/Docker-and-Kubernetes-The-Complete-Guide/488b431085038ebf03f07a78aec15723fa6783c3/09_Dockerizing_Multiple_Services/client/public/favicon.ico -------------------------------------------------------------------------------- /09_Dockerizing_Multiple_Services/client/public/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 11 | 12 | 13 | 22 | React App 23 | 24 | 25 | 28 |
29 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /09_Dockerizing_Multiple_Services/client/public/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "short_name": "React App", 3 | "name": "Create React App Sample", 4 | "icons": [ 5 | { 6 | "src": "favicon.ico", 7 | "sizes": "64x64 32x32 24x24 16x16", 8 | "type": "image/x-icon" 9 | } 10 | ], 11 | "start_url": "./index.html", 12 | "display": "standalone", 13 | "theme_color": "#000000", 14 | "background_color": "#ffffff" 15 | } 16 | -------------------------------------------------------------------------------- /09_Dockerizing_Multiple_Services/client/src/App.css: -------------------------------------------------------------------------------- 1 | .App { 2 | text-align: center; 3 | } 4 | 5 | .App-logo { 6 | animation: App-logo-spin infinite 20s linear; 7 | height: 80px; 8 | } 9 | 10 | .App-header { 11 | background-color: #222; 12 | height: 150px; 13 | padding: 20px; 14 | color: white; 15 | } 16 | 17 | .App-title { 18 | font-size: 1.5em; 19 | } 20 | 21 | .App-intro { 22 | font-size: large; 23 | } 24 | 25 | @keyframes App-logo-spin { 26 | from { transform: rotate(0deg); } 27 | to { transform: rotate(360deg); } 28 | } 29 | -------------------------------------------------------------------------------- /09_Dockerizing_Multiple_Services/client/src/App.js: -------------------------------------------------------------------------------- 1 | import React, { Component } from 'react'; 2 | import logo from './logo.svg'; 3 | import './App.css'; 4 | import { BrowserRouter as Router, Route, Link } from 'react-router-dom'; 5 | import OtherPage from './OtherPage'; 6 | import Fib from './Fib'; 7 | 8 | class App extends Component { 9 | render() { 10 | return ( 11 | 12 |
13 |
14 | logo 15 |

Welcome to React

16 | Home 17 | Other Page 18 |
19 |
20 | 21 | 22 |
23 |
24 |
25 | ); 26 | } 27 | } 28 | 29 | export default App; 30 | -------------------------------------------------------------------------------- /09_Dockerizing_Multiple_Services/client/src/App.test.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import ReactDOM from 'react-dom'; 3 | import App from './App'; 4 | 5 | it('renders without crashing', () => { 6 | const div = document.createElement('div'); 7 | ReactDOM.render(, div); 8 | ReactDOM.unmountComponentAtNode(div); 9 | }); 10 | -------------------------------------------------------------------------------- /09_Dockerizing_Multiple_Services/client/src/Fib.js: -------------------------------------------------------------------------------- 1 | import React, { Component } from 'react'; 2 | import axios from 'axios'; 3 | 4 | class Fib extends Component { 5 | state = { 6 | seenIndexes: [], 7 | values: {}, 8 | index: '' 9 | }; 10 | 11 | componentDidMount() { 12 | this.fetchValues(); 13 | this.fetchIndexes(); 14 | } 15 | 16 | async fetchValues() { 17 | const values = await axios.get('/api/values/current'); 18 | this.setState({ values: values.data }); 19 | } 20 | 21 | async fetchIndexes() { 22 | const seenIndexes = await axios.get('/api/values/all'); 23 | this.setState({ 24 | seenIndexes: seenIndexes.data 25 | }); 26 | } 27 | 28 | handleSubmit = async event => { 29 | event.preventDefault(); 30 | 31 | await axios.post('/api/values', { 32 | index: this.state.index 33 | }); 34 | this.setState({ index: '' }); 35 | }; 36 | 37 | renderSeenIndexes() { 38 | return this.state.seenIndexes.map(({ number }) => number).join(', '); 39 | } 40 | 41 | renderValues() { 42 | const entries = []; 43 | 44 | for (let key in this.state.values) { 45 | entries.push( 46 |
47 | For index {key} I calculated {this.state.values[key]} 48 |
49 | ); 50 | } 51 | 52 | return entries; 53 | } 54 | 55 | render() { 56 | return ( 57 |
58 |
59 | 60 | this.setState({ index: event.target.value })} 63 | /> 64 | 65 |
66 | 67 |

Indexes I have seen:

68 | {this.renderSeenIndexes()} 69 | 70 |

Calculated Values:

71 | {this.renderValues()} 72 |
73 | ); 74 | } 75 | } 76 | 77 | export default Fib; 78 | -------------------------------------------------------------------------------- /09_Dockerizing_Multiple_Services/client/src/OtherPage.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { Link } from 'react-router-dom'; 3 | 4 | export default () => { 5 | return ( 6 |
7 | Im some other page 8 | Go back to home page! 9 |
10 | ); 11 | }; 12 | -------------------------------------------------------------------------------- /09_Dockerizing_Multiple_Services/client/src/index.css: -------------------------------------------------------------------------------- 1 | body { 2 | margin: 0; 3 | padding: 0; 4 | font-family: sans-serif; 5 | } 6 | -------------------------------------------------------------------------------- /09_Dockerizing_Multiple_Services/client/src/index.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import ReactDOM from 'react-dom'; 3 | import './index.css'; 4 | import App from './App'; 5 | import registerServiceWorker from './registerServiceWorker'; 6 | 7 | ReactDOM.render(, document.getElementById('root')); 8 | registerServiceWorker(); 9 | -------------------------------------------------------------------------------- /09_Dockerizing_Multiple_Services/client/src/logo.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /09_Dockerizing_Multiple_Services/client/src/registerServiceWorker.js: -------------------------------------------------------------------------------- 1 | // In production, we register a service worker to serve assets from local cache. 2 | 3 | // This lets the app load faster on subsequent visits in production, and gives 4 | // it offline capabilities. However, it also means that developers (and users) 5 | // will only see deployed updates on the "N+1" visit to a page, since previously 6 | // cached resources are updated in the background. 7 | 8 | // To learn more about the benefits of this model, read https://goo.gl/KwvDNy. 9 | // This link also includes instructions on opting out of this behavior. 10 | 11 | const isLocalhost = Boolean( 12 | window.location.hostname === 'localhost' || 13 | // [::1] is the IPv6 localhost address. 14 | window.location.hostname === '[::1]' || 15 | // 127.0.0.1/8 is considered localhost for IPv4. 16 | window.location.hostname.match( 17 | /^127(?:\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}$/ 18 | ) 19 | ); 20 | 21 | export default function register() { 22 | if (process.env.NODE_ENV === 'production' && 'serviceWorker' in navigator) { 23 | // The URL constructor is available in all browsers that support SW. 24 | const publicUrl = new URL(process.env.PUBLIC_URL, window.location); 25 | if (publicUrl.origin !== window.location.origin) { 26 | // Our service worker won't work if PUBLIC_URL is on a different origin 27 | // from what our page is served on. This might happen if a CDN is used to 28 | // serve assets; see https://github.com/facebookincubator/create-react-app/issues/2374 29 | return; 30 | } 31 | 32 | window.addEventListener('load', () => { 33 | const swUrl = `${process.env.PUBLIC_URL}/service-worker.js`; 34 | 35 | if (isLocalhost) { 36 | // This is running on localhost. Lets check if a service worker still exists or not. 37 | checkValidServiceWorker(swUrl); 38 | 39 | // Add some additional logging to localhost, pointing developers to the 40 | // service worker/PWA documentation. 41 | navigator.serviceWorker.ready.then(() => { 42 | console.log( 43 | 'This web app is being served cache-first by a service ' + 44 | 'worker. To learn more, visit https://goo.gl/SC7cgQ' 45 | ); 46 | }); 47 | } else { 48 | // Is not local host. Just register service worker 49 | registerValidSW(swUrl); 50 | } 51 | }); 52 | } 53 | } 54 | 55 | function registerValidSW(swUrl) { 56 | navigator.serviceWorker 57 | .register(swUrl) 58 | .then(registration => { 59 | registration.onupdatefound = () => { 60 | const installingWorker = registration.installing; 61 | installingWorker.onstatechange = () => { 62 | if (installingWorker.state === 'installed') { 63 | if (navigator.serviceWorker.controller) { 64 | // At this point, the old content will have been purged and 65 | // the fresh content will have been added to the cache. 66 | // It's the perfect time to display a "New content is 67 | // available; please refresh." message in your web app. 68 | console.log('New content is available; please refresh.'); 69 | } else { 70 | // At this point, everything has been precached. 71 | // It's the perfect time to display a 72 | // "Content is cached for offline use." message. 73 | console.log('Content is cached for offline use.'); 74 | } 75 | } 76 | }; 77 | }; 78 | }) 79 | .catch(error => { 80 | console.error('Error during service worker registration:', error); 81 | }); 82 | } 83 | 84 | function checkValidServiceWorker(swUrl) { 85 | // Check if the service worker can be found. If it can't reload the page. 86 | fetch(swUrl) 87 | .then(response => { 88 | // Ensure service worker exists, and that we really are getting a JS file. 89 | if ( 90 | response.status === 404 || 91 | response.headers.get('content-type').indexOf('javascript') === -1 92 | ) { 93 | // No service worker found. Probably a different app. Reload the page. 94 | navigator.serviceWorker.ready.then(registration => { 95 | registration.unregister().then(() => { 96 | window.location.reload(); 97 | }); 98 | }); 99 | } else { 100 | // Service worker found. Proceed as normal. 101 | registerValidSW(swUrl); 102 | } 103 | }) 104 | .catch(() => { 105 | console.log( 106 | 'No internet connection found. App is running in offline mode.' 107 | ); 108 | }); 109 | } 110 | 111 | export function unregister() { 112 | if ('serviceWorker' in navigator) { 113 | navigator.serviceWorker.ready.then(registration => { 114 | registration.unregister(); 115 | }); 116 | } 117 | } 118 | -------------------------------------------------------------------------------- /09_Dockerizing_Multiple_Services/docker-compose.yml: -------------------------------------------------------------------------------- 1 | version: "3" 2 | services: 3 | postgres: 4 | image: "postgres:latest" 5 | redis: 6 | image: "redis:latest" 7 | nginx: 8 | restart: always 9 | build: 10 | dockerfile: Dockerfile.dev 11 | context: ./nginx 12 | ports: 13 | - "8080:80" 14 | api: 15 | build: 16 | dockerfile: Dockerfile.dev 17 | context: ./server 18 | volumes: 19 | - /app/node_modules 20 | - ./server:/app 21 | environment: 22 | - REDIS_HOST=redis 23 | - REDIS_PORT=6379 24 | - PGUSER=postgres 25 | - PGHOST=postgres 26 | - PGDATABASE=postgres 27 | - PGPASSWORD=postgres_password 28 | - PGPORT=5432 29 | client: 30 | build: 31 | dockerfile: Dockerfile.dev 32 | context: ./client 33 | volumes: 34 | - /app/node_modules 35 | - ./client:/app 36 | worker: 37 | environment: 38 | - REDIS_HOST=redis 39 | - REDIS_PORT=6379 40 | build: 41 | dockerfile: Dockerfile.dev 42 | context: ./worker 43 | volumes: 44 | - /app/node_modules 45 | - ./worker:/app 46 | -------------------------------------------------------------------------------- /09_Dockerizing_Multiple_Services/nginx/Dockerfile.dev: -------------------------------------------------------------------------------- 1 | FROM nginx 2 | COPY ./default.conf /etc/nginx/conf.d/default.conf 3 | -------------------------------------------------------------------------------- /09_Dockerizing_Multiple_Services/nginx/default.conf: -------------------------------------------------------------------------------- 1 | upstream client { 2 | server client:3000; 3 | } 4 | 5 | upstream api { 6 | server api:5000; 7 | } 8 | 9 | server { 10 | listen 80; 11 | 12 | location / { 13 | proxy_pass http://client; 14 | } 15 | 16 | location /sockjs-node { 17 | proxy_pass http://client; 18 | proxy_http_version 1.1; 19 | proxy_set_header Upgrade $http_upgrade; 20 | proxy_set_header Connection "Upgrade"; 21 | } 22 | 23 | location /api { 24 | rewrite /api/(.*) /$1 break; 25 | proxy_pass http://api; 26 | } 27 | } -------------------------------------------------------------------------------- /09_Dockerizing_Multiple_Services/server/Dockerfile.dev: -------------------------------------------------------------------------------- 1 | FROM node:alpine 2 | WORKDIR /app 3 | COPY ./package.json ./ 4 | RUN npm install 5 | COPY . . 6 | CMD ["npm", "run", "dev"] -------------------------------------------------------------------------------- /09_Dockerizing_Multiple_Services/server/index.js: -------------------------------------------------------------------------------- 1 | const keys = require('./keys'); 2 | 3 | // Express App Setup 4 | const express = require('express'); 5 | const bodyParser = require('body-parser'); 6 | const cors = require('cors'); 7 | 8 | const app = express(); 9 | app.use(cors()); 10 | app.use(bodyParser.json()); 11 | 12 | // Postgres Client Setup 13 | const { Pool } = require('pg'); 14 | const pgClient = new Pool({ 15 | user: keys.pgUser, 16 | host: keys.pgHost, 17 | database: keys.pgDatabase, 18 | password: keys.pgPassword, 19 | port: keys.pgPort 20 | }); 21 | pgClient.on('error', () => console.log('Lost PG connection')); 22 | 23 | pgClient 24 | .query('CREATE TABLE IF NOT EXISTS values (number INT)') 25 | .catch(err => console.log(err)); 26 | 27 | // Redis Client Setup 28 | const redis = require('redis'); 29 | const redisClient = redis.createClient({ 30 | host: keys.redisHost, 31 | port: keys.redisPort, 32 | retry_strategy: () => 1000 33 | }); 34 | const redisPublisher = redisClient.duplicate(); 35 | 36 | // Express route handlers 37 | 38 | app.get('/', (req, res) => { 39 | res.send('Hi'); 40 | }); 41 | 42 | app.get('/values/all', async (req, res) => { 43 | const values = await pgClient.query('SELECT * from values'); 44 | 45 | res.send(values.rows); 46 | }); 47 | 48 | app.get('/values/current', async (req, res) => { 49 | redisClient.hgetall('values', (err, values) => { 50 | res.send(values); 51 | }); 52 | }); 53 | 54 | app.post('/values', async (req, res) => { 55 | const index = req.body.index; 56 | 57 | if (parseInt(index) > 40) { 58 | return res.status(422).send('Index too high'); 59 | } 60 | 61 | redisClient.hset('values', index, 'Nothing yet!'); 62 | redisPublisher.publish('insert', index); 63 | pgClient.query('INSERT INTO values(number) VALUES($1)', [index]); 64 | 65 | res.send({ working: true }); 66 | }); 67 | 68 | app.listen(5000, err => { 69 | console.log('Listening'); 70 | }); 71 | -------------------------------------------------------------------------------- /09_Dockerizing_Multiple_Services/server/keys.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | redisHost: process.env.REDIS_HOST, 3 | redisPort: process.env.REDIS_PORT, 4 | pgUser: process.env.PGUSER, 5 | pgHost: process.env.PGHOST, 6 | pgDatabase: process.env.PGDATABASE, 7 | pgPassword: process.env.PGPASSWORD, 8 | pgPort: process.env.PGPORT 9 | }; 10 | -------------------------------------------------------------------------------- /09_Dockerizing_Multiple_Services/server/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "dependencies": { 3 | "express": "4.16.3", 4 | "pg": "7.4.3", 5 | "redis": "2.8.0", 6 | "cors": "2.8.4", 7 | "nodemon": "1.18.3", 8 | "body-parser": "*" 9 | }, 10 | "scripts": { 11 | "dev": "nodemon", 12 | "start": "node index.js" 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /09_Dockerizing_Multiple_Services/worker/Dockerfile.dev: -------------------------------------------------------------------------------- 1 | FROM node:alpine 2 | WORKDIR /app 3 | COPY ./package.json ./ 4 | RUN npm install 5 | COPY . . 6 | CMD ["npm", "run", "dev"] -------------------------------------------------------------------------------- /09_Dockerizing_Multiple_Services/worker/index.js: -------------------------------------------------------------------------------- 1 | const keys = require('./keys'); 2 | const redis = require('redis'); 3 | 4 | const redisClient = redis.createClient({ 5 | host: keys.redisHost, 6 | port: keys.redisPort, 7 | retry_strategy: () => 1000 8 | }); 9 | const sub = redisClient.duplicate(); 10 | 11 | function fib(index) { 12 | if (index < 2) return 1; 13 | return fib(index - 1) + fib(index - 2); 14 | } 15 | 16 | sub.on('message', (channel, message) => { 17 | redisClient.hset('values', message, fib(parseInt(message))); 18 | }); 19 | sub.subscribe('insert'); 20 | -------------------------------------------------------------------------------- /09_Dockerizing_Multiple_Services/worker/keys.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | redisHost: process.env.REDIS_HOST, 3 | redisPort: process.env.REDIS_PORT 4 | }; 5 | -------------------------------------------------------------------------------- /09_Dockerizing_Multiple_Services/worker/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "dependencies": { 3 | "nodemon": "1.18.3", 4 | "redis": "2.8.0" 5 | }, 6 | "scripts": { 7 | "start": "node index.js", 8 | "dev": "nodemon" 9 | } 10 | } -------------------------------------------------------------------------------- /10_A_Continuous_Integration_Workflow_for_Multiple_Images/.travis.yml: -------------------------------------------------------------------------------- 1 | sudo: required 2 | services: 3 | - docker 4 | 5 | before_install: 6 | - docker build -t marley/react-test -f ./client/Dockerfile.dev ./client 7 | 8 | script: 9 | - docker run marley/react-test npm test -- --coverage 10 | 11 | after_success: 12 | - docker build -t marley/multi-client ./client 13 | - docker build -t marley/multi-nginx ./nginx 14 | - docker build -t marley/multi-server ./server 15 | - docker build -t marley/multi-worker ./worker 16 | 17 | # Log in to the docker CLI 18 | - echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_ID" --password-stdin 19 | 20 | # Take those images and push them to docker hub 21 | - docker push marley/multi-client 22 | - docker push marley/multi-nginx 23 | - docker push marley/multi-server 24 | - docker push marley/multi-worker 25 | -------------------------------------------------------------------------------- /10_A_Continuous_Integration_Workflow_for_Multiple_Images/client/.gitignore: -------------------------------------------------------------------------------- 1 | # See https://help.github.com/ignore-files/ for more about ignoring files. 2 | 3 | # dependencies 4 | /node_modules 5 | 6 | # testing 7 | /coverage 8 | 9 | # production 10 | /build 11 | 12 | # misc 13 | .DS_Store 14 | .env.local 15 | .env.development.local 16 | .env.test.local 17 | .env.production.local 18 | 19 | npm-debug.log* 20 | yarn-debug.log* 21 | yarn-error.log* 22 | -------------------------------------------------------------------------------- /10_A_Continuous_Integration_Workflow_for_Multiple_Images/client/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM node:alpine as builder 2 | WORKDIR /app 3 | COPY ./package.json ./ 4 | RUN npm install 5 | COPY . . 6 | RUN npm run build 7 | 8 | FROM nginx 9 | EXPOSE 3000 10 | COPY ./nginx/default.conf /etc/nginx/conf.d/default.conf 11 | COPY --from=builder /app/build /usr/share/nginx/html -------------------------------------------------------------------------------- /10_A_Continuous_Integration_Workflow_for_Multiple_Images/client/Dockerfile.dev: -------------------------------------------------------------------------------- 1 | FROM node:alpine 2 | WORKDIR /app 3 | COPY ./package*.json ./ 4 | RUN npm install 5 | COPY . . 6 | CMD ["npm", "run", "start"] -------------------------------------------------------------------------------- /10_A_Continuous_Integration_Workflow_for_Multiple_Images/client/nginx/default.conf: -------------------------------------------------------------------------------- 1 | server { 2 | listen 3000; 3 | 4 | location / { 5 | root /usr/share/nginx/html; 6 | index index.htm index.html; 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /10_A_Continuous_Integration_Workflow_for_Multiple_Images/client/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "client", 3 | "version": "0.1.0", 4 | "private": true, 5 | "dependencies": { 6 | "react": "^16.4.2", 7 | "react-dom": "^16.4.2", 8 | "react-scripts": "1.1.4", 9 | "react-router-dom": "4.3.1", 10 | "axios": "0.18.0" 11 | }, 12 | "scripts": { 13 | "start": "react-scripts start", 14 | "build": "react-scripts build", 15 | "test": "react-scripts test --env=jsdom", 16 | "eject": "react-scripts eject" 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /10_A_Continuous_Integration_Workflow_for_Multiple_Images/client/public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/webmakaka/Docker-and-Kubernetes-The-Complete-Guide/488b431085038ebf03f07a78aec15723fa6783c3/10_A_Continuous_Integration_Workflow_for_Multiple_Images/client/public/favicon.ico -------------------------------------------------------------------------------- /10_A_Continuous_Integration_Workflow_for_Multiple_Images/client/public/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 11 | 12 | 13 | 22 | React App 23 | 24 | 25 | 28 |
29 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /10_A_Continuous_Integration_Workflow_for_Multiple_Images/client/public/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "short_name": "React App", 3 | "name": "Create React App Sample", 4 | "icons": [ 5 | { 6 | "src": "favicon.ico", 7 | "sizes": "64x64 32x32 24x24 16x16", 8 | "type": "image/x-icon" 9 | } 10 | ], 11 | "start_url": "./index.html", 12 | "display": "standalone", 13 | "theme_color": "#000000", 14 | "background_color": "#ffffff" 15 | } 16 | -------------------------------------------------------------------------------- /10_A_Continuous_Integration_Workflow_for_Multiple_Images/client/src/App.css: -------------------------------------------------------------------------------- 1 | .App { 2 | text-align: center; 3 | } 4 | 5 | .App-logo { 6 | animation: App-logo-spin infinite 20s linear; 7 | height: 80px; 8 | } 9 | 10 | .App-header { 11 | background-color: #222; 12 | height: 150px; 13 | padding: 20px; 14 | color: white; 15 | } 16 | 17 | .App-title { 18 | font-size: 1.5em; 19 | } 20 | 21 | .App-intro { 22 | font-size: large; 23 | } 24 | 25 | @keyframes App-logo-spin { 26 | from { transform: rotate(0deg); } 27 | to { transform: rotate(360deg); } 28 | } 29 | -------------------------------------------------------------------------------- /10_A_Continuous_Integration_Workflow_for_Multiple_Images/client/src/App.js: -------------------------------------------------------------------------------- 1 | import React, { Component } from 'react'; 2 | import logo from './logo.svg'; 3 | import './App.css'; 4 | import { BrowserRouter as Router, Route, Link } from 'react-router-dom'; 5 | import OtherPage from './OtherPage'; 6 | import Fib from './Fib'; 7 | 8 | class App extends Component { 9 | render() { 10 | return ( 11 | 12 |
13 |
14 | logo 15 |

Welcome to React

16 | Home 17 | Other Page 18 |
19 |
20 | 21 | 22 |
23 |
24 |
25 | ); 26 | } 27 | } 28 | 29 | export default App; 30 | -------------------------------------------------------------------------------- /10_A_Continuous_Integration_Workflow_for_Multiple_Images/client/src/App.test.js: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | import ReactDOM from "react-dom"; 3 | import App from "./App"; 4 | 5 | it("renders without crashing", () => {}); 6 | -------------------------------------------------------------------------------- /10_A_Continuous_Integration_Workflow_for_Multiple_Images/client/src/Fib.js: -------------------------------------------------------------------------------- 1 | import React, { Component } from 'react'; 2 | import axios from 'axios'; 3 | 4 | class Fib extends Component { 5 | state = { 6 | seenIndexes: [], 7 | values: {}, 8 | index: '' 9 | }; 10 | 11 | componentDidMount() { 12 | this.fetchValues(); 13 | this.fetchIndexes(); 14 | } 15 | 16 | async fetchValues() { 17 | const values = await axios.get('/api/values/current'); 18 | this.setState({ values: values.data }); 19 | } 20 | 21 | async fetchIndexes() { 22 | const seenIndexes = await axios.get('/api/values/all'); 23 | this.setState({ 24 | seenIndexes: seenIndexes.data 25 | }); 26 | } 27 | 28 | handleSubmit = async event => { 29 | event.preventDefault(); 30 | 31 | await axios.post('/api/values', { 32 | index: this.state.index 33 | }); 34 | this.setState({ index: '' }); 35 | }; 36 | 37 | renderSeenIndexes() { 38 | return this.state.seenIndexes.map(({ number }) => number).join(', '); 39 | } 40 | 41 | renderValues() { 42 | const entries = []; 43 | 44 | for (let key in this.state.values) { 45 | entries.push( 46 |
47 | For index {key} I calculated {this.state.values[key]} 48 |
49 | ); 50 | } 51 | 52 | return entries; 53 | } 54 | 55 | render() { 56 | return ( 57 |
58 |
59 | 60 | this.setState({ index: event.target.value })} 63 | /> 64 | 65 |
66 | 67 |

Indexes I have seen:

68 | {this.renderSeenIndexes()} 69 | 70 |

Calculated Values:

71 | {this.renderValues()} 72 |
73 | ); 74 | } 75 | } 76 | 77 | export default Fib; 78 | -------------------------------------------------------------------------------- /10_A_Continuous_Integration_Workflow_for_Multiple_Images/client/src/OtherPage.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { Link } from 'react-router-dom'; 3 | 4 | export default () => { 5 | return ( 6 |
7 | Im some other page 8 | Go back to home page! 9 |
10 | ); 11 | }; 12 | -------------------------------------------------------------------------------- /10_A_Continuous_Integration_Workflow_for_Multiple_Images/client/src/index.css: -------------------------------------------------------------------------------- 1 | body { 2 | margin: 0; 3 | padding: 0; 4 | font-family: sans-serif; 5 | } 6 | -------------------------------------------------------------------------------- /10_A_Continuous_Integration_Workflow_for_Multiple_Images/client/src/index.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import ReactDOM from 'react-dom'; 3 | import './index.css'; 4 | import App from './App'; 5 | import registerServiceWorker from './registerServiceWorker'; 6 | 7 | ReactDOM.render(, document.getElementById('root')); 8 | registerServiceWorker(); 9 | -------------------------------------------------------------------------------- /10_A_Continuous_Integration_Workflow_for_Multiple_Images/client/src/logo.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /10_A_Continuous_Integration_Workflow_for_Multiple_Images/client/src/registerServiceWorker.js: -------------------------------------------------------------------------------- 1 | // In production, we register a service worker to serve assets from local cache. 2 | 3 | // This lets the app load faster on subsequent visits in production, and gives 4 | // it offline capabilities. However, it also means that developers (and users) 5 | // will only see deployed updates on the "N+1" visit to a page, since previously 6 | // cached resources are updated in the background. 7 | 8 | // To learn more about the benefits of this model, read https://goo.gl/KwvDNy. 9 | // This link also includes instructions on opting out of this behavior. 10 | 11 | const isLocalhost = Boolean( 12 | window.location.hostname === 'localhost' || 13 | // [::1] is the IPv6 localhost address. 14 | window.location.hostname === '[::1]' || 15 | // 127.0.0.1/8 is considered localhost for IPv4. 16 | window.location.hostname.match( 17 | /^127(?:\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}$/ 18 | ) 19 | ); 20 | 21 | export default function register() { 22 | if (process.env.NODE_ENV === 'production' && 'serviceWorker' in navigator) { 23 | // The URL constructor is available in all browsers that support SW. 24 | const publicUrl = new URL(process.env.PUBLIC_URL, window.location); 25 | if (publicUrl.origin !== window.location.origin) { 26 | // Our service worker won't work if PUBLIC_URL is on a different origin 27 | // from what our page is served on. This might happen if a CDN is used to 28 | // serve assets; see https://github.com/facebookincubator/create-react-app/issues/2374 29 | return; 30 | } 31 | 32 | window.addEventListener('load', () => { 33 | const swUrl = `${process.env.PUBLIC_URL}/service-worker.js`; 34 | 35 | if (isLocalhost) { 36 | // This is running on localhost. Lets check if a service worker still exists or not. 37 | checkValidServiceWorker(swUrl); 38 | 39 | // Add some additional logging to localhost, pointing developers to the 40 | // service worker/PWA documentation. 41 | navigator.serviceWorker.ready.then(() => { 42 | console.log( 43 | 'This web app is being served cache-first by a service ' + 44 | 'worker. To learn more, visit https://goo.gl/SC7cgQ' 45 | ); 46 | }); 47 | } else { 48 | // Is not local host. Just register service worker 49 | registerValidSW(swUrl); 50 | } 51 | }); 52 | } 53 | } 54 | 55 | function registerValidSW(swUrl) { 56 | navigator.serviceWorker 57 | .register(swUrl) 58 | .then(registration => { 59 | registration.onupdatefound = () => { 60 | const installingWorker = registration.installing; 61 | installingWorker.onstatechange = () => { 62 | if (installingWorker.state === 'installed') { 63 | if (navigator.serviceWorker.controller) { 64 | // At this point, the old content will have been purged and 65 | // the fresh content will have been added to the cache. 66 | // It's the perfect time to display a "New content is 67 | // available; please refresh." message in your web app. 68 | console.log('New content is available; please refresh.'); 69 | } else { 70 | // At this point, everything has been precached. 71 | // It's the perfect time to display a 72 | // "Content is cached for offline use." message. 73 | console.log('Content is cached for offline use.'); 74 | } 75 | } 76 | }; 77 | }; 78 | }) 79 | .catch(error => { 80 | console.error('Error during service worker registration:', error); 81 | }); 82 | } 83 | 84 | function checkValidServiceWorker(swUrl) { 85 | // Check if the service worker can be found. If it can't reload the page. 86 | fetch(swUrl) 87 | .then(response => { 88 | // Ensure service worker exists, and that we really are getting a JS file. 89 | if ( 90 | response.status === 404 || 91 | response.headers.get('content-type').indexOf('javascript') === -1 92 | ) { 93 | // No service worker found. Probably a different app. Reload the page. 94 | navigator.serviceWorker.ready.then(registration => { 95 | registration.unregister().then(() => { 96 | window.location.reload(); 97 | }); 98 | }); 99 | } else { 100 | // Service worker found. Proceed as normal. 101 | registerValidSW(swUrl); 102 | } 103 | }) 104 | .catch(() => { 105 | console.log( 106 | 'No internet connection found. App is running in offline mode.' 107 | ); 108 | }); 109 | } 110 | 111 | export function unregister() { 112 | if ('serviceWorker' in navigator) { 113 | navigator.serviceWorker.ready.then(registration => { 114 | registration.unregister(); 115 | }); 116 | } 117 | } 118 | -------------------------------------------------------------------------------- /10_A_Continuous_Integration_Workflow_for_Multiple_Images/docker-compose.yml: -------------------------------------------------------------------------------- 1 | version: "3" 2 | services: 3 | postgres: 4 | image: "postgres:latest" 5 | redis: 6 | image: "redis:latest" 7 | nginx: 8 | restart: always 9 | build: 10 | dockerfile: Dockerfile.dev 11 | context: ./nginx 12 | ports: 13 | - "8080:80" 14 | api: 15 | build: 16 | dockerfile: Dockerfile.dev 17 | context: ./server 18 | volumes: 19 | - /app/node_modules 20 | - ./server:/app 21 | environment: 22 | - REDIS_HOST=redis 23 | - REDIS_PORT=6379 24 | - PGUSER=postgres 25 | - PGHOST=postgres 26 | - PGDATABASE=postgres 27 | - PGPASSWORD=postgres_password 28 | - PGPORT=5432 29 | client: 30 | build: 31 | dockerfile: Dockerfile.dev 32 | context: ./client 33 | volumes: 34 | - /app/node_modules 35 | - ./client:/app 36 | worker: 37 | environment: 38 | - REDIS_HOST=redis 39 | - REDIS_PORT=6379 40 | build: 41 | dockerfile: Dockerfile.dev 42 | context: ./worker 43 | volumes: 44 | - /app/node_modules 45 | - ./worker:/app 46 | -------------------------------------------------------------------------------- /10_A_Continuous_Integration_Workflow_for_Multiple_Images/nginx/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM nginx 2 | COPY ./default.conf /etc/nginx/conf.d/default.conf 3 | -------------------------------------------------------------------------------- /10_A_Continuous_Integration_Workflow_for_Multiple_Images/nginx/Dockerfile.dev: -------------------------------------------------------------------------------- 1 | FROM nginx 2 | COPY ./default.conf /etc/nginx/conf.d/default.conf 3 | -------------------------------------------------------------------------------- /10_A_Continuous_Integration_Workflow_for_Multiple_Images/nginx/default.conf: -------------------------------------------------------------------------------- 1 | upstream client { 2 | server client:3000; 3 | } 4 | 5 | upstream api { 6 | server api:5000; 7 | } 8 | 9 | server { 10 | listen 80; 11 | 12 | location / { 13 | proxy_pass http://client; 14 | } 15 | 16 | location /sockjs-node { 17 | proxy_pass http://client; 18 | proxy_http_version 1.1; 19 | proxy_set_header Upgrade $http_upgrade; 20 | proxy_set_header Connection "Upgrade"; 21 | } 22 | 23 | location /api { 24 | rewrite /api/(.*) /$1 break; 25 | proxy_pass http://api; 26 | } 27 | } -------------------------------------------------------------------------------- /10_A_Continuous_Integration_Workflow_for_Multiple_Images/server/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM node:alpine 2 | WORKDIR /app 3 | COPY ./package.json ./ 4 | RUN npm install 5 | COPY . . 6 | CMD ["npm", "run", "start"] -------------------------------------------------------------------------------- /10_A_Continuous_Integration_Workflow_for_Multiple_Images/server/Dockerfile.dev: -------------------------------------------------------------------------------- 1 | FROM node:alpine 2 | WORKDIR /app 3 | COPY ./package.json ./ 4 | RUN npm install 5 | COPY . . 6 | CMD ["npm", "run", "dev"] -------------------------------------------------------------------------------- /10_A_Continuous_Integration_Workflow_for_Multiple_Images/server/index.js: -------------------------------------------------------------------------------- 1 | const keys = require('./keys'); 2 | 3 | // Express App Setup 4 | const express = require('express'); 5 | const bodyParser = require('body-parser'); 6 | const cors = require('cors'); 7 | 8 | const app = express(); 9 | app.use(cors()); 10 | app.use(bodyParser.json()); 11 | 12 | // Postgres Client Setup 13 | const { Pool } = require('pg'); 14 | const pgClient = new Pool({ 15 | user: keys.pgUser, 16 | host: keys.pgHost, 17 | database: keys.pgDatabase, 18 | password: keys.pgPassword, 19 | port: keys.pgPort 20 | }); 21 | pgClient.on('error', () => console.log('Lost PG connection')); 22 | 23 | pgClient 24 | .query('CREATE TABLE IF NOT EXISTS values (number INT)') 25 | .catch(err => console.log(err)); 26 | 27 | // Redis Client Setup 28 | const redis = require('redis'); 29 | const redisClient = redis.createClient({ 30 | host: keys.redisHost, 31 | port: keys.redisPort, 32 | retry_strategy: () => 1000 33 | }); 34 | const redisPublisher = redisClient.duplicate(); 35 | 36 | // Express route handlers 37 | 38 | app.get('/', (req, res) => { 39 | res.send('Hi'); 40 | }); 41 | 42 | app.get('/values/all', async (req, res) => { 43 | const values = await pgClient.query('SELECT * from values'); 44 | 45 | res.send(values.rows); 46 | }); 47 | 48 | app.get('/values/current', async (req, res) => { 49 | redisClient.hgetall('values', (err, values) => { 50 | res.send(values); 51 | }); 52 | }); 53 | 54 | app.post('/values', async (req, res) => { 55 | const index = req.body.index; 56 | 57 | if (parseInt(index) > 40) { 58 | return res.status(422).send('Index too high'); 59 | } 60 | 61 | redisClient.hset('values', index, 'Nothing yet!'); 62 | redisPublisher.publish('insert', index); 63 | pgClient.query('INSERT INTO values(number) VALUES($1)', [index]); 64 | 65 | res.send({ working: true }); 66 | }); 67 | 68 | app.listen(5000, err => { 69 | console.log('Listening'); 70 | }); 71 | -------------------------------------------------------------------------------- /10_A_Continuous_Integration_Workflow_for_Multiple_Images/server/keys.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | redisHost: process.env.REDIS_HOST, 3 | redisPort: process.env.REDIS_PORT, 4 | pgUser: process.env.PGUSER, 5 | pgHost: process.env.PGHOST, 6 | pgDatabase: process.env.PGDATABASE, 7 | pgPassword: process.env.PGPASSWORD, 8 | pgPort: process.env.PGPORT 9 | }; 10 | -------------------------------------------------------------------------------- /10_A_Continuous_Integration_Workflow_for_Multiple_Images/server/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "dependencies": { 3 | "express": "4.16.3", 4 | "pg": "7.4.3", 5 | "redis": "2.8.0", 6 | "cors": "2.8.4", 7 | "nodemon": "1.18.3", 8 | "body-parser": "*" 9 | }, 10 | "scripts": { 11 | "dev": "nodemon", 12 | "start": "node index.js" 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /10_A_Continuous_Integration_Workflow_for_Multiple_Images/worker/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM node:alpine 2 | WORKDIR /app 3 | COPY ./package.json ./ 4 | RUN npm install 5 | COPY . . 6 | CMD ["npm", "run", "start"] -------------------------------------------------------------------------------- /10_A_Continuous_Integration_Workflow_for_Multiple_Images/worker/Dockerfile.dev: -------------------------------------------------------------------------------- 1 | FROM node:alpine 2 | WORKDIR /app 3 | COPY ./package.json ./ 4 | RUN npm install 5 | COPY . . 6 | CMD ["npm", "run", "dev"] -------------------------------------------------------------------------------- /10_A_Continuous_Integration_Workflow_for_Multiple_Images/worker/index.js: -------------------------------------------------------------------------------- 1 | const keys = require('./keys'); 2 | const redis = require('redis'); 3 | 4 | const redisClient = redis.createClient({ 5 | host: keys.redisHost, 6 | port: keys.redisPort, 7 | retry_strategy: () => 1000 8 | }); 9 | const sub = redisClient.duplicate(); 10 | 11 | function fib(index) { 12 | if (index < 2) return 1; 13 | return fib(index - 1) + fib(index - 2); 14 | } 15 | 16 | sub.on('message', (channel, message) => { 17 | redisClient.hset('values', message, fib(parseInt(message))); 18 | }); 19 | sub.subscribe('insert'); 20 | -------------------------------------------------------------------------------- /10_A_Continuous_Integration_Workflow_for_Multiple_Images/worker/keys.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | redisHost: process.env.REDIS_HOST, 3 | redisPort: process.env.REDIS_PORT 4 | }; 5 | -------------------------------------------------------------------------------- /10_A_Continuous_Integration_Workflow_for_Multiple_Images/worker/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "dependencies": { 3 | "nodemon": "1.18.3", 4 | "redis": "2.8.0" 5 | }, 6 | "scripts": { 7 | "start": "node index.js", 8 | "dev": "nodemon" 9 | } 10 | } -------------------------------------------------------------------------------- /11_Multi_Container_Deployments_to_AWS/.travis.yml: -------------------------------------------------------------------------------- 1 | sudo: required 2 | services: 3 | - docker 4 | 5 | before_install: 6 | - docker build -t marley/react-test -f ./client/Dockerfile.dev ./client 7 | 8 | script: 9 | - docker run marley/react-test npm test -- --coverage 10 | 11 | after_success: 12 | - docker build -t marley/multi-client ./client 13 | - docker build -t marley/multi-nginx ./nginx 14 | - docker build -t marley/multi-server ./server 15 | - docker build -t marley/multi-worker ./worker 16 | 17 | # Log in to the docker CLI 18 | - echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_ID" --password-stdin 19 | 20 | # Take those images and push them to docker hub 21 | - docker push marley/multi-client 22 | - docker push marley/multi-nginx 23 | - docker push marley/multi-server 24 | - docker push marley/multi-worker 25 | 26 | deploy: 27 | provider: elasticbeanstalk 28 | region: "us-west-1" 29 | app: "multi-docker" 30 | env: "MultiDocker-env" 31 | bucket_name: "elasticbeanstalk-us-west-1-3064766" 32 | bucket_path: "docker-multi" 33 | on: 34 | branch: master 35 | access_key_id: $AWS_ACCESS_KEY 36 | secret_access_key: 37 | secure: "$AWS_SECRET_KEY" 38 | -------------------------------------------------------------------------------- /11_Multi_Container_Deployments_to_AWS/Dcokerrun.aws.json: -------------------------------------------------------------------------------- 1 | { 2 | "AWSEBDockerrunVersion": 2, 3 | "containerDefinitions": [ 4 | { 5 | "name": "client", 6 | "image": "marley/multi-client", 7 | "hostname": "client", 8 | "essential": false, 9 | "memory": 128 10 | }, 11 | { 12 | "name": "server", 13 | "image": "marley/multi-server", 14 | "hostname": "api", 15 | "essential": false, 16 | "memory": 128 17 | }, 18 | { 19 | "name": "worker", 20 | "image": "marley/multi-worker", 21 | "hostname": "worker", 22 | "essential": false, 23 | "memory": 128 24 | }, 25 | { 26 | "name": "nginx", 27 | "image": "marley/multi-nginx", 28 | "hostname": "nginx", 29 | "essential": true, 30 | "portMappings": [ 31 | { 32 | "hostPort": 80, 33 | "containerPort": 80 34 | } 35 | ], 36 | "links": ["client", "server"], 37 | "memory": 128 38 | } 39 | ] 40 | } 41 | -------------------------------------------------------------------------------- /11_Multi_Container_Deployments_to_AWS/client/.gitignore: -------------------------------------------------------------------------------- 1 | # See https://help.github.com/ignore-files/ for more about ignoring files. 2 | 3 | # dependencies 4 | /node_modules 5 | 6 | # testing 7 | /coverage 8 | 9 | # production 10 | /build 11 | 12 | # misc 13 | .DS_Store 14 | .env.local 15 | .env.development.local 16 | .env.test.local 17 | .env.production.local 18 | 19 | npm-debug.log* 20 | yarn-debug.log* 21 | yarn-error.log* 22 | -------------------------------------------------------------------------------- /11_Multi_Container_Deployments_to_AWS/client/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM node:alpine as builder 2 | WORKDIR /app 3 | COPY ./package.json ./ 4 | RUN npm install 5 | COPY . . 6 | RUN npm run build 7 | 8 | FROM nginx 9 | EXPOSE 3000 10 | COPY ./nginx/default.conf /etc/nginx/conf.d/default.conf 11 | COPY --from=builder /app/build /usr/share/nginx/html -------------------------------------------------------------------------------- /11_Multi_Container_Deployments_to_AWS/client/Dockerfile.dev: -------------------------------------------------------------------------------- 1 | FROM node:alpine 2 | WORKDIR /app 3 | COPY ./package*.json ./ 4 | RUN npm install 5 | COPY . . 6 | CMD ["npm", "run", "start"] -------------------------------------------------------------------------------- /11_Multi_Container_Deployments_to_AWS/client/nginx/default.conf: -------------------------------------------------------------------------------- 1 | server { 2 | listen 3000; 3 | 4 | location / { 5 | root /usr/share/nginx/html; 6 | index index.htm index.html; 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /11_Multi_Container_Deployments_to_AWS/client/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "client", 3 | "version": "0.1.0", 4 | "private": true, 5 | "dependencies": { 6 | "react": "^16.4.2", 7 | "react-dom": "^16.4.2", 8 | "react-scripts": "1.1.4", 9 | "react-router-dom": "4.3.1", 10 | "axios": "0.18.0" 11 | }, 12 | "scripts": { 13 | "start": "react-scripts start", 14 | "build": "react-scripts build", 15 | "test": "react-scripts test --env=jsdom", 16 | "eject": "react-scripts eject" 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /11_Multi_Container_Deployments_to_AWS/client/public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/webmakaka/Docker-and-Kubernetes-The-Complete-Guide/488b431085038ebf03f07a78aec15723fa6783c3/11_Multi_Container_Deployments_to_AWS/client/public/favicon.ico -------------------------------------------------------------------------------- /11_Multi_Container_Deployments_to_AWS/client/public/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 11 | 12 | 13 | 22 | React App 23 | 24 | 25 | 28 |
29 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /11_Multi_Container_Deployments_to_AWS/client/public/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "short_name": "React App", 3 | "name": "Create React App Sample", 4 | "icons": [ 5 | { 6 | "src": "favicon.ico", 7 | "sizes": "64x64 32x32 24x24 16x16", 8 | "type": "image/x-icon" 9 | } 10 | ], 11 | "start_url": "./index.html", 12 | "display": "standalone", 13 | "theme_color": "#000000", 14 | "background_color": "#ffffff" 15 | } 16 | -------------------------------------------------------------------------------- /11_Multi_Container_Deployments_to_AWS/client/src/App.css: -------------------------------------------------------------------------------- 1 | .App { 2 | text-align: center; 3 | } 4 | 5 | .App-logo { 6 | animation: App-logo-spin infinite 20s linear; 7 | height: 80px; 8 | } 9 | 10 | .App-header { 11 | background-color: #222; 12 | height: 150px; 13 | padding: 20px; 14 | color: white; 15 | } 16 | 17 | .App-title { 18 | font-size: 1.5em; 19 | } 20 | 21 | .App-intro { 22 | font-size: large; 23 | } 24 | 25 | @keyframes App-logo-spin { 26 | from { transform: rotate(0deg); } 27 | to { transform: rotate(360deg); } 28 | } 29 | -------------------------------------------------------------------------------- /11_Multi_Container_Deployments_to_AWS/client/src/App.js: -------------------------------------------------------------------------------- 1 | import React, { Component } from 'react'; 2 | import logo from './logo.svg'; 3 | import './App.css'; 4 | import { BrowserRouter as Router, Route, Link } from 'react-router-dom'; 5 | import OtherPage from './OtherPage'; 6 | import Fib from './Fib'; 7 | 8 | class App extends Component { 9 | render() { 10 | return ( 11 | 12 |
13 |
14 | logo 15 |

Welcome to React

16 | Home 17 | Other Page 18 |
19 |
20 | 21 | 22 |
23 |
24 |
25 | ); 26 | } 27 | } 28 | 29 | export default App; 30 | -------------------------------------------------------------------------------- /11_Multi_Container_Deployments_to_AWS/client/src/App.test.js: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | import ReactDOM from "react-dom"; 3 | import App from "./App"; 4 | 5 | it("renders without crashing", () => {}); 6 | -------------------------------------------------------------------------------- /11_Multi_Container_Deployments_to_AWS/client/src/Fib.js: -------------------------------------------------------------------------------- 1 | import React, { Component } from 'react'; 2 | import axios from 'axios'; 3 | 4 | class Fib extends Component { 5 | state = { 6 | seenIndexes: [], 7 | values: {}, 8 | index: '' 9 | }; 10 | 11 | componentDidMount() { 12 | this.fetchValues(); 13 | this.fetchIndexes(); 14 | } 15 | 16 | async fetchValues() { 17 | const values = await axios.get('/api/values/current'); 18 | this.setState({ values: values.data }); 19 | } 20 | 21 | async fetchIndexes() { 22 | const seenIndexes = await axios.get('/api/values/all'); 23 | this.setState({ 24 | seenIndexes: seenIndexes.data 25 | }); 26 | } 27 | 28 | handleSubmit = async event => { 29 | event.preventDefault(); 30 | 31 | await axios.post('/api/values', { 32 | index: this.state.index 33 | }); 34 | this.setState({ index: '' }); 35 | }; 36 | 37 | renderSeenIndexes() { 38 | return this.state.seenIndexes.map(({ number }) => number).join(', '); 39 | } 40 | 41 | renderValues() { 42 | const entries = []; 43 | 44 | for (let key in this.state.values) { 45 | entries.push( 46 |
47 | For index {key} I calculated {this.state.values[key]} 48 |
49 | ); 50 | } 51 | 52 | return entries; 53 | } 54 | 55 | render() { 56 | return ( 57 |
58 |
59 | 60 | this.setState({ index: event.target.value })} 63 | /> 64 | 65 |
66 | 67 |

Indexes I have seen:

68 | {this.renderSeenIndexes()} 69 | 70 |

Calculated Values:

71 | {this.renderValues()} 72 |
73 | ); 74 | } 75 | } 76 | 77 | export default Fib; 78 | -------------------------------------------------------------------------------- /11_Multi_Container_Deployments_to_AWS/client/src/OtherPage.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { Link } from 'react-router-dom'; 3 | 4 | export default () => { 5 | return ( 6 |
7 | Im some other page 8 | Go back to home page! 9 |
10 | ); 11 | }; 12 | -------------------------------------------------------------------------------- /11_Multi_Container_Deployments_to_AWS/client/src/index.css: -------------------------------------------------------------------------------- 1 | body { 2 | margin: 0; 3 | padding: 0; 4 | font-family: sans-serif; 5 | } 6 | -------------------------------------------------------------------------------- /11_Multi_Container_Deployments_to_AWS/client/src/index.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import ReactDOM from 'react-dom'; 3 | import './index.css'; 4 | import App from './App'; 5 | import registerServiceWorker from './registerServiceWorker'; 6 | 7 | ReactDOM.render(, document.getElementById('root')); 8 | registerServiceWorker(); 9 | -------------------------------------------------------------------------------- /11_Multi_Container_Deployments_to_AWS/client/src/logo.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /11_Multi_Container_Deployments_to_AWS/client/src/registerServiceWorker.js: -------------------------------------------------------------------------------- 1 | // In production, we register a service worker to serve assets from local cache. 2 | 3 | // This lets the app load faster on subsequent visits in production, and gives 4 | // it offline capabilities. However, it also means that developers (and users) 5 | // will only see deployed updates on the "N+1" visit to a page, since previously 6 | // cached resources are updated in the background. 7 | 8 | // To learn more about the benefits of this model, read https://goo.gl/KwvDNy. 9 | // This link also includes instructions on opting out of this behavior. 10 | 11 | const isLocalhost = Boolean( 12 | window.location.hostname === 'localhost' || 13 | // [::1] is the IPv6 localhost address. 14 | window.location.hostname === '[::1]' || 15 | // 127.0.0.1/8 is considered localhost for IPv4. 16 | window.location.hostname.match( 17 | /^127(?:\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}$/ 18 | ) 19 | ); 20 | 21 | export default function register() { 22 | if (process.env.NODE_ENV === 'production' && 'serviceWorker' in navigator) { 23 | // The URL constructor is available in all browsers that support SW. 24 | const publicUrl = new URL(process.env.PUBLIC_URL, window.location); 25 | if (publicUrl.origin !== window.location.origin) { 26 | // Our service worker won't work if PUBLIC_URL is on a different origin 27 | // from what our page is served on. This might happen if a CDN is used to 28 | // serve assets; see https://github.com/facebookincubator/create-react-app/issues/2374 29 | return; 30 | } 31 | 32 | window.addEventListener('load', () => { 33 | const swUrl = `${process.env.PUBLIC_URL}/service-worker.js`; 34 | 35 | if (isLocalhost) { 36 | // This is running on localhost. Lets check if a service worker still exists or not. 37 | checkValidServiceWorker(swUrl); 38 | 39 | // Add some additional logging to localhost, pointing developers to the 40 | // service worker/PWA documentation. 41 | navigator.serviceWorker.ready.then(() => { 42 | console.log( 43 | 'This web app is being served cache-first by a service ' + 44 | 'worker. To learn more, visit https://goo.gl/SC7cgQ' 45 | ); 46 | }); 47 | } else { 48 | // Is not local host. Just register service worker 49 | registerValidSW(swUrl); 50 | } 51 | }); 52 | } 53 | } 54 | 55 | function registerValidSW(swUrl) { 56 | navigator.serviceWorker 57 | .register(swUrl) 58 | .then(registration => { 59 | registration.onupdatefound = () => { 60 | const installingWorker = registration.installing; 61 | installingWorker.onstatechange = () => { 62 | if (installingWorker.state === 'installed') { 63 | if (navigator.serviceWorker.controller) { 64 | // At this point, the old content will have been purged and 65 | // the fresh content will have been added to the cache. 66 | // It's the perfect time to display a "New content is 67 | // available; please refresh." message in your web app. 68 | console.log('New content is available; please refresh.'); 69 | } else { 70 | // At this point, everything has been precached. 71 | // It's the perfect time to display a 72 | // "Content is cached for offline use." message. 73 | console.log('Content is cached for offline use.'); 74 | } 75 | } 76 | }; 77 | }; 78 | }) 79 | .catch(error => { 80 | console.error('Error during service worker registration:', error); 81 | }); 82 | } 83 | 84 | function checkValidServiceWorker(swUrl) { 85 | // Check if the service worker can be found. If it can't reload the page. 86 | fetch(swUrl) 87 | .then(response => { 88 | // Ensure service worker exists, and that we really are getting a JS file. 89 | if ( 90 | response.status === 404 || 91 | response.headers.get('content-type').indexOf('javascript') === -1 92 | ) { 93 | // No service worker found. Probably a different app. Reload the page. 94 | navigator.serviceWorker.ready.then(registration => { 95 | registration.unregister().then(() => { 96 | window.location.reload(); 97 | }); 98 | }); 99 | } else { 100 | // Service worker found. Proceed as normal. 101 | registerValidSW(swUrl); 102 | } 103 | }) 104 | .catch(() => { 105 | console.log( 106 | 'No internet connection found. App is running in offline mode.' 107 | ); 108 | }); 109 | } 110 | 111 | export function unregister() { 112 | if ('serviceWorker' in navigator) { 113 | navigator.serviceWorker.ready.then(registration => { 114 | registration.unregister(); 115 | }); 116 | } 117 | } 118 | -------------------------------------------------------------------------------- /11_Multi_Container_Deployments_to_AWS/docker-compose.yml: -------------------------------------------------------------------------------- 1 | version: "3" 2 | services: 3 | postgres: 4 | image: "postgres:latest" 5 | redis: 6 | image: "redis:latest" 7 | nginx: 8 | restart: always 9 | build: 10 | dockerfile: Dockerfile.dev 11 | context: ./nginx 12 | ports: 13 | - "8080:80" 14 | api: 15 | build: 16 | dockerfile: Dockerfile.dev 17 | context: ./server 18 | volumes: 19 | - /app/node_modules 20 | - ./server:/app 21 | environment: 22 | - REDIS_HOST=redis 23 | - REDIS_PORT=6379 24 | - PGUSER=postgres 25 | - PGHOST=postgres 26 | - PGDATABASE=postgres 27 | - PGPASSWORD=postgres_password 28 | - PGPORT=5432 29 | client: 30 | build: 31 | dockerfile: Dockerfile.dev 32 | context: ./client 33 | volumes: 34 | - /app/node_modules 35 | - ./client:/app 36 | worker: 37 | environment: 38 | - REDIS_HOST=redis 39 | - REDIS_PORT=6379 40 | build: 41 | dockerfile: Dockerfile.dev 42 | context: ./worker 43 | volumes: 44 | - /app/node_modules 45 | - ./worker:/app 46 | -------------------------------------------------------------------------------- /11_Multi_Container_Deployments_to_AWS/nginx/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM nginx 2 | COPY ./default.conf /etc/nginx/conf.d/default.conf 3 | -------------------------------------------------------------------------------- /11_Multi_Container_Deployments_to_AWS/nginx/Dockerfile.dev: -------------------------------------------------------------------------------- 1 | FROM nginx 2 | COPY ./default.conf /etc/nginx/conf.d/default.conf 3 | -------------------------------------------------------------------------------- /11_Multi_Container_Deployments_to_AWS/nginx/default.conf: -------------------------------------------------------------------------------- 1 | upstream client { 2 | server client:3000; 3 | } 4 | 5 | upstream api { 6 | server api:5000; 7 | } 8 | 9 | server { 10 | listen 80; 11 | 12 | location / { 13 | proxy_pass http://client; 14 | } 15 | 16 | location /sockjs-node { 17 | proxy_pass http://client; 18 | proxy_http_version 1.1; 19 | proxy_set_header Upgrade $http_upgrade; 20 | proxy_set_header Connection "Upgrade"; 21 | } 22 | 23 | location /api { 24 | rewrite /api/(.*) /$1 break; 25 | proxy_pass http://api; 26 | } 27 | } -------------------------------------------------------------------------------- /11_Multi_Container_Deployments_to_AWS/server/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM node:alpine 2 | WORKDIR /app 3 | COPY ./package.json ./ 4 | RUN npm install 5 | COPY . . 6 | CMD ["npm", "run", "start"] -------------------------------------------------------------------------------- /11_Multi_Container_Deployments_to_AWS/server/Dockerfile.dev: -------------------------------------------------------------------------------- 1 | FROM node:alpine 2 | WORKDIR /app 3 | COPY ./package.json ./ 4 | RUN npm install 5 | COPY . . 6 | CMD ["npm", "run", "dev"] -------------------------------------------------------------------------------- /11_Multi_Container_Deployments_to_AWS/server/index.js: -------------------------------------------------------------------------------- 1 | const keys = require('./keys'); 2 | 3 | // Express App Setup 4 | const express = require('express'); 5 | const bodyParser = require('body-parser'); 6 | const cors = require('cors'); 7 | 8 | const app = express(); 9 | app.use(cors()); 10 | app.use(bodyParser.json()); 11 | 12 | // Postgres Client Setup 13 | const { Pool } = require('pg'); 14 | const pgClient = new Pool({ 15 | user: keys.pgUser, 16 | host: keys.pgHost, 17 | database: keys.pgDatabase, 18 | password: keys.pgPassword, 19 | port: keys.pgPort 20 | }); 21 | pgClient.on('error', () => console.log('Lost PG connection')); 22 | 23 | pgClient 24 | .query('CREATE TABLE IF NOT EXISTS values (number INT)') 25 | .catch(err => console.log(err)); 26 | 27 | // Redis Client Setup 28 | const redis = require('redis'); 29 | const redisClient = redis.createClient({ 30 | host: keys.redisHost, 31 | port: keys.redisPort, 32 | retry_strategy: () => 1000 33 | }); 34 | const redisPublisher = redisClient.duplicate(); 35 | 36 | // Express route handlers 37 | 38 | app.get('/', (req, res) => { 39 | res.send('Hi'); 40 | }); 41 | 42 | app.get('/values/all', async (req, res) => { 43 | // const values = await pgClient.query('SELECT * from values'); 44 | // res.send(values.rows); 45 | res.send([1, 2, 3]); 46 | }); 47 | 48 | app.get('/values/current', async (req, res) => { 49 | redisClient.hgetall('values', (err, values) => { 50 | res.send(values); 51 | }); 52 | }); 53 | 54 | app.post('/values', async (req, res) => { 55 | const index = req.body.index; 56 | 57 | if (parseInt(index) > 40) { 58 | return res.status(422).send('Index too high'); 59 | } 60 | 61 | redisClient.hset('values', index, 'Nothing yet!'); 62 | redisPublisher.publish('insert', index); 63 | pgClient.query('INSERT INTO values(number) VALUES($1)', [index]); 64 | 65 | res.send({ working: true }); 66 | }); 67 | 68 | app.listen(5000, err => { 69 | console.log('Listening'); 70 | }); 71 | -------------------------------------------------------------------------------- /11_Multi_Container_Deployments_to_AWS/server/keys.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | redisHost: process.env.REDIS_HOST, 3 | redisPort: process.env.REDIS_PORT, 4 | pgUser: process.env.PGUSER, 5 | pgHost: process.env.PGHOST, 6 | pgDatabase: process.env.PGDATABASE, 7 | pgPassword: process.env.PGPASSWORD, 8 | pgPort: process.env.PGPORT 9 | }; 10 | -------------------------------------------------------------------------------- /11_Multi_Container_Deployments_to_AWS/server/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "dependencies": { 3 | "express": "4.16.3", 4 | "pg": "7.4.3", 5 | "redis": "2.8.0", 6 | "cors": "2.8.4", 7 | "nodemon": "1.18.3", 8 | "body-parser": "*" 9 | }, 10 | "scripts": { 11 | "dev": "nodemon", 12 | "start": "node index.js" 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /11_Multi_Container_Deployments_to_AWS/worker/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM node:alpine 2 | WORKDIR /app 3 | COPY ./package.json ./ 4 | RUN npm install 5 | COPY . . 6 | CMD ["npm", "run", "start"] -------------------------------------------------------------------------------- /11_Multi_Container_Deployments_to_AWS/worker/Dockerfile.dev: -------------------------------------------------------------------------------- 1 | FROM node:alpine 2 | WORKDIR /app 3 | COPY ./package.json ./ 4 | RUN npm install 5 | COPY . . 6 | CMD ["npm", "run", "dev"] -------------------------------------------------------------------------------- /11_Multi_Container_Deployments_to_AWS/worker/index.js: -------------------------------------------------------------------------------- 1 | const keys = require('./keys'); 2 | const redis = require('redis'); 3 | 4 | const redisClient = redis.createClient({ 5 | host: keys.redisHost, 6 | port: keys.redisPort, 7 | retry_strategy: () => 1000 8 | }); 9 | const sub = redisClient.duplicate(); 10 | 11 | function fib(index) { 12 | if (index < 2) return 1; 13 | return fib(index - 1) + fib(index - 2); 14 | } 15 | 16 | sub.on('message', (channel, message) => { 17 | redisClient.hset('values', message, fib(parseInt(message))); 18 | }); 19 | sub.subscribe('insert'); 20 | -------------------------------------------------------------------------------- /11_Multi_Container_Deployments_to_AWS/worker/keys.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | redisHost: process.env.REDIS_HOST, 3 | redisPort: process.env.REDIS_PORT 4 | }; 5 | -------------------------------------------------------------------------------- /11_Multi_Container_Deployments_to_AWS/worker/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "dependencies": { 3 | "nodemon": "1.18.3", 4 | "redis": "2.8.0" 5 | }, 6 | "scripts": { 7 | "start": "node index.js", 8 | "dev": "nodemon" 9 | } 10 | } -------------------------------------------------------------------------------- /12_Onwards_to_Kubernetes/client-node-pod.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: Service 3 | metadata: 4 | name: client-node-port 5 | spec: 6 | type: NodePort 7 | ports: 8 | - port: 8080 9 | targetPort: 3000 10 | nodePort: 31515 11 | selector: 12 | component: web 13 | -------------------------------------------------------------------------------- /12_Onwards_to_Kubernetes/client-pod.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: Pod 3 | metadata: 4 | name: client-pod 5 | labels: 6 | component: web 7 | spec: 8 | containers: 9 | - name: client 10 | image: marley/multi-client 11 | ports: 12 | - containerPort: 3000 13 | -------------------------------------------------------------------------------- /13_Maintaining_Sets_of_Containers_with_Deployments/client-deployment.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: apps/v1 2 | kind: Deployment 3 | metadata: 4 | name: client-deployment 5 | spec: 6 | replicas: 1 7 | selector: 8 | matchLabels: 9 | component: web 10 | template: 11 | metadata: 12 | labels: 13 | component: web 14 | spec: 15 | containers: 16 | - name: client 17 | image: marley/multi-client 18 | ports: 19 | - containerPort: 3000 20 | -------------------------------------------------------------------------------- /13_Maintaining_Sets_of_Containers_with_Deployments/client-node-pod.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: Service 3 | metadata: 4 | name: client-node-port 5 | spec: 6 | type: NodePort 7 | ports: 8 | - port: 8080 9 | targetPort: 3000 10 | nodePort: 31515 11 | selector: 12 | component: web 13 | -------------------------------------------------------------------------------- /14_A_Multi_Container_App_with_Kubernetes/client-cluster-ip-service.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: Service 3 | metadata: 4 | name: client-cluster-ip-service 5 | spec: 6 | type: ClusterIP 7 | selector: 8 | component: web 9 | ports: 10 | - port: 3000 11 | targetPort: 3000 12 | -------------------------------------------------------------------------------- /14_A_Multi_Container_App_with_Kubernetes/client-deployment.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: apps/v1 2 | kind: Deployment 3 | metadata: 4 | name: client-deployment 5 | spec: 6 | replicas: 3 7 | selector: 8 | matchLabels: 9 | component: web 10 | template: 11 | metadata: 12 | labels: 13 | component: web 14 | spec: 15 | containers: 16 | - name: client 17 | image: techhead/grider-client 18 | ports: 19 | - containerPort: 3000 20 | -------------------------------------------------------------------------------- /14_A_Multi_Container_App_with_Kubernetes/database-persistent-volume-claim.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: PersistentVolumeClaim 3 | metadata: 4 | name: database-persistent-volume-claim 5 | spec: 6 | accessModes: 7 | - ReadWriteOnce 8 | resources: 9 | requests: 10 | storage: 2Gi 11 | -------------------------------------------------------------------------------- /14_A_Multi_Container_App_with_Kubernetes/postgres-cluster-ip-service.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: Service 3 | metadata: 4 | name: postgres-cluster-ip-service 5 | spec: 6 | type: ClusterIP 7 | selector: 8 | component: postgres 9 | ports: 10 | - port: 5432 11 | targetPort: 5432 12 | -------------------------------------------------------------------------------- /14_A_Multi_Container_App_with_Kubernetes/postgres-deployment.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: apps/v1 2 | kind: Deployment 3 | metadata: 4 | name: postgres-deployment 5 | spec: 6 | replicas: 1 7 | selector: 8 | matchLabels: 9 | component: postgres 10 | template: 11 | metadata: 12 | labels: 13 | component: postgres 14 | spec: 15 | volumes: 16 | - name: postgres-storage 17 | persistentVolumeClaim: 18 | claimName: database-persistent-volume-claim 19 | containers: 20 | - name: postgres 21 | image: postgres 22 | ports: 23 | - containerPort: 5432 24 | volumeMounts: 25 | - name: postgres-storage 26 | mountPath: /var/lib/postgresql/data 27 | subPath: postgres 28 | env: 29 | - name: PGPASSWORD 30 | valueFrom: 31 | secretKeyRef: 32 | name: pgpassword 33 | key: PGPASSWORD 34 | -------------------------------------------------------------------------------- /14_A_Multi_Container_App_with_Kubernetes/redis-cluster-ip-service.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: Service 3 | metadata: 4 | name: redis-cluster-ip-service 5 | spec: 6 | type: ClusterIP 7 | selector: 8 | component: redis 9 | ports: 10 | - port: 6379 11 | targetPort: 6379 12 | -------------------------------------------------------------------------------- /14_A_Multi_Container_App_with_Kubernetes/redis-deployment.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: apps/v1 2 | kind: Deployment 3 | metadata: 4 | name: redis-deployment 5 | spec: 6 | replicas: 1 7 | selector: 8 | matchLabels: 9 | component: redis 10 | template: 11 | metadata: 12 | labels: 13 | component: redis 14 | spec: 15 | containers: 16 | - name: redis 17 | image: redis 18 | ports: 19 | - containerPort: 6379 20 | -------------------------------------------------------------------------------- /14_A_Multi_Container_App_with_Kubernetes/server-cluster-ip-service.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: Service 3 | metadata: 4 | name: server-cluster-ip-service 5 | spec: 6 | type: ClusterIP 7 | selector: 8 | component: server 9 | ports: 10 | - port: 5000 11 | targetPort: 5000 12 | -------------------------------------------------------------------------------- /14_A_Multi_Container_App_with_Kubernetes/server-deployment.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: apps/v1 2 | kind: Deployment 3 | metadata: 4 | name: server-deployment 5 | spec: 6 | replicas: 3 7 | selector: 8 | matchLabels: 9 | component: server 10 | template: 11 | metadata: 12 | labels: 13 | component: server 14 | spec: 15 | containers: 16 | - name: server 17 | image: techhead/grider-server 18 | ports: 19 | - containerPort: 5000 20 | env: 21 | - name: REDIS_HOST 22 | value: redis-cluster-ip-service 23 | - name: REDIS_PORT 24 | value: "6379" 25 | - name: PGUSER 26 | value: postgres 27 | - name: PGHOST 28 | value: postgres-cluster-ip-service 29 | - name: PGPORT 30 | value: "5432" 31 | - name: PGDATABASE 32 | value: postgres 33 | - name: PGPASSWORD 34 | valueFrom: 35 | secretKeyRef: 36 | name: pgpassword 37 | key: PGPASSWORD 38 | -------------------------------------------------------------------------------- /14_A_Multi_Container_App_with_Kubernetes/worker-deploymant.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: apps/v1 2 | kind: Deployment 3 | metadata: 4 | name: wroker-deployment 5 | spec: 6 | replicas: 1 7 | selector: 8 | matchLabels: 9 | component: worker 10 | template: 11 | metadata: 12 | labels: 13 | component: worker 14 | spec: 15 | containers: 16 | - name: worker 17 | image: techhead/grider-worker 18 | env: 19 | - name: REDIS_HOST 20 | value: redis-cluster-ip-service 21 | - name: REDIS_PORT 22 | value: "6379" 23 | -------------------------------------------------------------------------------- /15_Handling_Traffic_with_Ingress_Controllers/ingress-service.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: extensions/v1beta1 2 | kind: Ingress 3 | metadata: 4 | name: ingress-service 5 | annotations: 6 | kubernetes.io/ingress.class: nginx 7 | nginx.ingress.kubernetes.io/rewrite-target: /$1 8 | nginx.ingress.kubernetes.io/ssl-redirect: 'false' 9 | spec: 10 | rules: 11 | - http: 12 | paths: 13 | - path: /?(.*) 14 | backend: 15 | serviceName: client-cluster-ip-service 16 | servicePort: 3000 17 | - path: /api/?(.*) 18 | backend: 19 | serviceName: server-cluster-ip-service 20 | servicePort: 5000 21 | -------------------------------------------------------------------------------- /16_Kubernetes_Production_Deployment/.travis.yml: -------------------------------------------------------------------------------- 1 | sudo: required 2 | services: 3 | - docker 4 | 5 | env: 6 | global: 7 | - SHA=$(git rev-parse HEAD) 8 | - CLOUDSDK_CORE_DISABLE_PROMPTS=1 9 | 10 | before_install: 11 | # string from command line when you encrypt service account by travis cli 12 | - openssl aes-256-cbc -K $encrypted_0c35eebf403c_key -iv $encrypted_0c35eebf403c_iv -in service-account.json.enc -out service-account.json -d 13 | - curl https://sdk.cloud.google.com | bash > /dev/null; 14 | - source $HOME/google-cloud-sdk/path.bash.inc 15 | - gcloud components udpate kubectl 16 | - gcloud auth activate-service-account --key-file service-account.json 17 | # skilful-berm-214822 - project id in google cloud platform 18 | - gcloud config set project skilful-berm-214822 19 | - gcloud config set compute/zone us-central1-a 20 | # milti-cluster project name 21 | - gcloud container clusters get-credentials multi-cluster 22 | # DOCKER_PASSWORD and DOCKER_USERNAME - vars inside travis environment 23 | - echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin 24 | - docker build -t marley/react-test -f ./client/Dockerfile.dev ./client 25 | 26 | script: 27 | - docker run marley/react-test npm test -- --coverage 28 | 29 | deploy: 30 | provider: script 31 | script: bash ./deploy.sh 32 | on: 33 | branch: master 34 | # after_success: 35 | # - docker build -t marley/multi-client ./client 36 | # - docker build -t marley/multi-nginx ./nginx 37 | # - docker build -t marley/multi-server ./server 38 | # - docker build -t marley/multi-worker ./worker 39 | 40 | # # Log in to the docker CLI 41 | # - echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_ID" --password-stdin 42 | 43 | # # Take those images and push them to docker hub 44 | # - docker push marley/multi-client 45 | # - docker push marley/multi-nginx 46 | # - docker push marley/multi-server 47 | # - docker push marley/multi-worker 48 | 49 | # deploy: 50 | # provider: elasticbeanstalk 51 | # region: "us-west-1" 52 | # app: "multi-docker" 53 | # env: "MultiDocker-env" 54 | # bucket_name: "elasticbeanstalk-us-west-1-3064766" 55 | # bucket_path: "docker-multi" 56 | # on: 57 | # branch: master 58 | # access_key_id: $AWS_ACCESS_KEY 59 | # secret_access_key: 60 | # secure: "$AWS_SECRET_KEY" 61 | -------------------------------------------------------------------------------- /16_Kubernetes_Production_Deployment/README.md: -------------------------------------------------------------------------------- 1 | # [Stephen Grider] Docker and Kubernetes: The Complete Guide [2018, ENG] 2 | 3 |
4 | 5 | # 16 Kubernetes Production Deployment 6 | 7 | I will only watch. Do not want to pay for Google Clouds. 8 | 9 | console.cloud.google.com 10 | 11 |
12 | 13 | ![Kubernetes Google Clouds](/img/pic-16-01.png?raw=true) 14 | 15 |
16 | 17 | ![Kubernetes Google Clouds](/img/pic-16-02.png?raw=true) 18 | 19 |
20 | 21 | ![Kubernetes Google Clouds](/img/pic-16-03.png?raw=true) 22 | 23 |
24 | 25 | ![Kubernetes Google Clouds](/img/pic-16-04.png?raw=true) 26 | 27 |
28 | 29 | ![Kubernetes Google Clouds](/img/pic-16-05.png?raw=true) 30 | 31 |
32 | 33 | ![Kubernetes Google Clouds](/img/pic-16-06.png?raw=true) 34 | 35 |
36 | 37 | ![Kubernetes Google Clouds](/img/pic-16-07.png?raw=true) 38 | 39 |
40 | 41 | ![Kubernetes Google Clouds](/img/pic-16-08.png?raw=true) 42 | 43 |
44 | 45 | ![Kubernetes Google Clouds](/img/pic-16-09.png?raw=true) 46 | 47 |
48 | 49 | ![Kubernetes Google Clouds](/img/pic-16-10.png?raw=true) 50 | 51 |
52 | 53 | ![Kubernetes Google Clouds](/img/pic-16-11.png?raw=true) 54 | 55 |
56 | 57 | ![Kubernetes Google Clouds](/img/pic-16-12.png?raw=true) 58 | 59 |
60 | 61 | ![Kubernetes Google Clouds](/img/pic-16-13.png?raw=true) 62 | 63 |
64 | 65 | ![Kubernetes Google Clouds](/img/pic-16-14.png?raw=true) 66 | 67 |
68 | 69 | ![Kubernetes Google Clouds](/img/pic-16-15.png?raw=true) 70 | 71 |
72 | 73 | ![Kubernetes Google Clouds](/img/pic-16-16.png?raw=true) 74 | 75 |
76 | 77 | ![Kubernetes Google Clouds](/img/pic-16-17.png?raw=true) 78 | 79 |
80 | 81 | ![Kubernetes Google Clouds](/img/pic-16-18.png?raw=true) 82 | 83 |
84 | 85 | ![Kubernetes Google Clouds](/img/pic-16-19.png?raw=true) 86 | 87 |
88 | 89 | ![Kubernetes Google Clouds](/img/pic-16-20.png?raw=true) 90 | 91 |
92 | 93 | ### Encript google service account by travis 94 | 95 | $ docker run -it $(pwd):/app ruby:2.3 sh 96 | # cd app 97 | # gem install travis --no-rdoc --no-ri 98 | # travis login 99 | 100 | copy service-account.json to $(pwd) 101 | 102 | // !!! github account case sensitive 103 | # travis encrypt-file service-account.json -r marley-js/multi-k8s 104 | 105 | // !!! 106 | delete original service-account.json 107 | 108 | exit 109 | 110 |
111 | 112 | push updated project with service-account.json.enc to github. 113 | 114 |
115 | 116 | ![Kubernetes Google Clouds](/img/pic-16-21.png?raw=true) 117 | 118 |
119 | 120 | ![Kubernetes Google Clouds](/img/pic-16-22.png?raw=true) 121 | 122 |
123 | 124 | ![Kubernetes Google Clouds](/img/pic-16-23.png?raw=true) 125 | 126 |
127 | 128 | ![Kubernetes Google Clouds](/img/pic-16-24.png?raw=true) 129 | 130 |
131 | 132 | ![Kubernetes Google Clouds](/img/pic-16-25.png?raw=true) 133 | 134 |
135 | 136 | ![Kubernetes Google Clouds](/img/pic-16-26.png?raw=true) 137 | 138 |
139 | 140 | ![Kubernetes Google Clouds](/img/pic-16-27.png?raw=true) 141 | 142 |
143 | 144 | ![Kubernetes Google Clouds](/img/pic-16-28.png?raw=true) 145 | 146 |
147 | 148 | ### Helm/Tiller 149 | 150 | https://kubernetes.github.io/ingress-nginx/deploy/#using-helm 151 | 152 | https://github.com/helm/helm 153 | 154 | https://helm.sh/docs/using_helm/#from-script 155 | 156 | $ curl https://raw.githubusercontent.com/helm/helm/master/scripts/get > get_helm.sh 157 | $ chmod 700 get_helm.sh 158 | $ ./get_helm.sh 159 | 160 |
161 | 162 | ![Kubernetes Google Clouds](/img/pic-16-29.png?raw=true) 163 | 164 |
165 | 166 | ![Kubernetes Google Clouds](/img/pic-16-30.png?raw=true) 167 | 168 |
169 | 170 | ![Kubernetes Google Clouds](/img/pic-16-31.png?raw=true) 171 | 172 |
173 | 174 | ![Kubernetes Google Clouds](/img/pic-16-32.png?raw=true) 175 | 176 |
177 | 178 | ![Kubernetes Google Clouds](/img/pic-16-33.png?raw=true) 179 | 180 |
181 | 182 | ![Kubernetes Google Clouds](/img/pic-16-34.png?raw=true) 183 | 184 |
185 | 186 | ![Kubernetes Google Clouds](/img/pic-16-35.png?raw=true) 187 | 188 |
189 | 190 | https://kubernetes.github.io/ingress-nginx/deploy/#using-helm 191 | 192 | $ helm install stable/nginx-ingress --name my-nginx --set rbac.create=true 193 | 194 |
195 | 196 | ![Kubernetes Google Clouds](/img/pic-16-36.png?raw=true) 197 | 198 |
199 | 200 | ![Kubernetes Google Clouds](/img/pic-16-37.png?raw=true) 201 | 202 |
203 | 204 | ![Kubernetes Google Clouds](/img/pic-16-38.png?raw=true) 205 | 206 |
207 | 208 | ![Kubernetes Google Clouds](/img/pic-16-39.png?raw=true) 209 | 210 |
211 | 212 | ![Kubernetes Google Clouds](/img/pic-16-40.png?raw=true) 213 | 214 |
215 | 216 | ![Kubernetes Google Clouds](/img/pic-16-41.png?raw=true) 217 | 218 |
219 | 220 | ![Kubernetes Google Clouds](/img/pic-16-42.png?raw=true) 221 | 222 |
223 | 224 | ![Kubernetes Google Clouds](/img/pic-16-43.png?raw=true) 225 | 226 |
227 | 228 | --- 229 | 230 |
231 | 232 | **Marley** 233 | 234 | Any questions on eng: https://jsdev.org/chat/ 235 | Любые вопросы на русском: https://jsdev.ru/chat/ 236 | -------------------------------------------------------------------------------- /16_Kubernetes_Production_Deployment/deploy.sh: -------------------------------------------------------------------------------- 1 | docker build -t marley/multi-client:latest -t marley/multi-client:$SHA -f ./client/Dockerfile ./client 2 | docker build -t marley/multi-server:latest -t marley/multi-server:$SHA -f ./server/Dockerfile ./server 3 | docker build -t marley/multi-worker:latest -t marley/multi-worker:$SHA -f ./worker/Dockerfile ./workers 4 | 5 | docker push marley/multi-client:latest 6 | docker push marley/multi-server:latest 7 | docker push marley/multi-worker:latest 8 | 9 | docker push marley/multi-client:$SHA 10 | docker push marley/multi-server:$SHA 11 | docker push marley/multi-worker:$SHA 12 | 13 | kubect apply -f k8s 14 | kubectl set image deployments/client-deployment client=marley/multi-client:$SHA 15 | kubectl set image deployments/server-deployment server=marley/multi-server:$SHA 16 | kubectl set image deployments/worker-deployment worker=marley/multi-worker:$SHA -------------------------------------------------------------------------------- /17_HTTPS_Setup_with_Kubernetes/README.md: -------------------------------------------------------------------------------- 1 | # [Stephen Grider] Docker and Kubernetes: The Complete Guide [2018, ENG] 2 | 3 |
4 | 5 | # 17 HTTPS Setup with Kubernetes 6 | 7 |
8 | 9 | ![Kubernetes Google Clouds](/img/pic-17-01.png?raw=true) 10 | 11 |
12 | 13 | ![Kubernetes Google Clouds](/img/pic-17-02.png?raw=true) 14 | 15 |
16 | 17 | ![Kubernetes Google Clouds](/img/pic-17-03.png?raw=true) 18 | 19 |
20 | 21 | ![Kubernetes Google Clouds](/img/pic-17-04.png?raw=true) 22 | 23 |
24 | 25 | ![Kubernetes Google Clouds](/img/pic-17-05.png?raw=true) 26 | 27 |
28 | 29 | https://docs.cert-manager.io/en/latest/getting-started/install.html#installing-with-helm 30 | 31 |
32 | 33 | ![Kubernetes Google Clouds](/img/pic-17-06.png?raw=true) 34 | 35 |
36 | 37 | ![Kubernetes Google Clouds](/img/pic-17-07.png?raw=true) 38 | 39 |
40 | 41 | ![Kubernetes Google Clouds](/img/pic-17-08.png?raw=true) 42 | 43 |
44 | 45 | ![Kubernetes Google Clouds](/img/pic-17-09.png?raw=true) 46 | 47 |
48 | 49 | ![Kubernetes Google Clouds](/img/pic-17-10.png?raw=true) 50 | 51 |
52 | 53 | ![Kubernetes Google Clouds](/img/pic-17-11.png?raw=true) 54 | 55 |
56 | 57 | ![Kubernetes Google Clouds](/img/pic-17-12.png?raw=true) 58 | 59 |
60 | 61 | ![Kubernetes Google Clouds](/img/pic-17-13.png?raw=true) 62 | 63 |
64 | 65 | --- 66 | 67 |
68 | 69 | **Marley** 70 | 71 | Any questions on eng: https://jsdev.org/chat/ 72 | Любые вопросы на русском: https://jsdev.ru/chat/ 73 | -------------------------------------------------------------------------------- /17_HTTPS_Setup_with_Kubernetes/certificate.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: certmanager.k8s.io/v1alpha1 2 | kind: Certificate 3 | metadata: 4 | name: k8s-multi-com-tls 5 | spec: 6 | secretName: k8s-multi-com 7 | issuerRef: 8 | name: letsencrypt-prod 9 | kind: ClusterIssuer 10 | commonName: k8s-multi.com 11 | dnsNames: 12 | - k8s-multi.com 13 | - www.k8s-multi.com 14 | acme: 15 | config: 16 | - http01: 17 | ingressClass: nginx 18 | domains: 19 | - k8s-multi.com 20 | - www.k8s-multi.com 21 | -------------------------------------------------------------------------------- /17_HTTPS_Setup_with_Kubernetes/ingress-service.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: extensions/v1beta1 2 | kind: Ingress 3 | metadata: 4 | name: ingress-service 5 | annotations: 6 | kubernetes.io/ingress.class: nginx 7 | nginx.ingress.kubernetes.io/rewrite-target: / 8 | certmanager.k8s.io/cluster-issuer: "letsencrypt-prod" 9 | nginx.ingress.kubernetes.io/ssl-redirect: "true" 10 | spec: 11 | tls: 12 | - hosts: 13 | - k8s-multi.com 14 | - www.k8s-multi.com 15 | secretName: k8s-multi-com 16 | rules: 17 | - host: k8s-multi.com 18 | http: 19 | paths: 20 | - path: / 21 | backend: 22 | serviceName: client-cluster-ip-service 23 | servicePort: 3000 24 | - path: /api/ 25 | backend: 26 | serviceName: server-cluster-ip-service 27 | servicePort: 5000 28 | - host: www.k8s-multi.com 29 | http: 30 | paths: 31 | - path: / 32 | backend: 33 | serviceName: client-cluster-ip-service 34 | servicePort: 3000 35 | - path: /api/ 36 | backend: 37 | serviceName: server-cluster-ip-service 38 | servicePort: 5000 39 | -------------------------------------------------------------------------------- /17_HTTPS_Setup_with_Kubernetes/issuer.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: certmanager.k8s.io/v1alpha1 2 | kind: ClusterIssuer 3 | metadata: 4 | name: letsencrypt-prod 5 | spec: 6 | acme: 7 | server: https://acme-v02.api.letsencrypt.org/directory 8 | email: "myemail@gmail.com" 9 | privateKeySecretRef: 10 | name: letsencrypt-prod 11 | http01: {} 12 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # [Stephen Grider] Docker and Kubernetes: The Complete Guide [ENG, 2018] 2 | 3 | **Original src**: 4 | https://github.com/StephenGrider/DockerCasts 5 | 6 | **[Offtopic]**: 7 | Deploy application from video course [Stephen Grider] Docker and Kubernetes: The Complete Guide [2018, ENG] on local kubernetes cluster 8 | https://github.com/wildmakaka/Docker-and-Kubernetes-The-Complete-Guide-Deploy-on-Local-Kubernetes-Cluster-Only 9 | 10 |
11 | 12 | ## 09 Dockerizing Multiple Services 13 | 14 |
15 | 16 | ![Application](/img/pic-09-01.png?raw=true) 17 | 18 |
19 | 20 | ![Application](/img/pic-09-02.png?raw=true) 21 | 22 |
23 | 24 | ![Application](/img/pic-09-03.png?raw=true) 25 | 26 |
27 | 28 | ![Application](/img/pic-09-04.png?raw=true) 29 | 30 |
31 | 32 | ![Application](/img/pic-09-05.png?raw=true) 33 | 34 |
35 | 36 | ![Application](/img/pic-09-06.png?raw=true) 37 | 38 |
39 | 40 | Stephen forgot to add in docker-compose.yml 41 | 42 |
43 | 44 | ``` 45 | worker: 46 | environment: 47 | - REDIS_HOST=redis 48 | - REDIS_PORT=6379 49 | ``` 50 | 51 |
52 | 53 | $ cd 09_Dockerizing_Multiple_Services 54 | $ docker-compose up --build 55 | $ ctrl^C 56 | $ docker-compose up 57 | 58 |
59 | 60 | ![Application](/img/pic-09-07.png?raw=true) 61 | 62 | http://localhost:8080/api/values/current 63 | 64 |
65 | 66 | ``` 67 | $ docker-compose ps 68 | Name Command State Ports 69 | ----------------------------------------------------------------------------------------------------------- 70 | 09_dockerizing_multiple_services_api_1 npm run dev Up 71 | 09_dockerizing_multiple_services_client_1 npm run start Up 72 | 09_dockerizing_multiple_services_nginx_1 nginx -g daemon off; Up 0.0.0.0:8080->80/tcp 73 | 09_dockerizing_multiple_services_postgres_1 docker-entrypoint.sh postgres Up 5432/tcp 74 | 09_dockerizing_multiple_services_redis_1 docker-entrypoint.sh redis ... Up 6379/tcp 75 | 76 | ``` 77 | 78 |
79 | 80 | ## 10 A Continuous Integration Workflow for Multiple Images 81 | 82 |
83 | 84 | ![Application](/img/pic-10-01.png?raw=true) 85 | 86 | Travis-ci.org --> OUR Project --> More options --> Settings --> Environment Variables 87 | 88 | ![Application](/img/pic-10-02.png?raw=true) 89 | 90 | DOCKER_ID marley 91 | DOCKER_PASSWORD mypassword 92 | 93 | ![Application](/img/pic-10-03.png?raw=true) 94 | 95 | ![Application](/img/pic-10-04.png?raw=true) 96 | 97 |
98 | 99 | ### 11 Multi-Container Deployments to AWS 100 | 101 | I do not want to pay money for testing AWS. 102 | 103 | ![Application](/img/pic-11-01.png?raw=true) 104 | 105 | ![Application](/img/pic-11-02.png?raw=true) 106 | 107 | https://docs.aws.amazon.com/AmazonECS/latest/developerguide/task_definitions.html 108 | 109 |
110 | 111 | Travis-ci.org --> OUR Project --> More options --> Settings --> Environment Variables 112 | 113 | AWS_ACCESS_KEY 114 | AWS_SECRET_KEY 115 | 116 |
117 | 118 | ### 12 Onwards to Kubernetes 119 | 120 | $ minikube start 121 | 122 | $ cd 12_Onwards_to_Kubernetes/ 123 | 124 | $ kubectl apply -f client-pod.yaml 125 | $ kubectl apply -f client-node-pod.yaml 126 | 127 |
128 | 129 | $ kubectl get pods 130 | NAME READY STATUS RESTARTS AGE 131 | client-pod 1/1 Running 0 14s 132 | 133 |
134 | 135 | $ kubectl get services 136 | NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE 137 | client-node-port NodePort 10.97.14.234 8080:31515/TCP 33s 138 | kubernetes ClusterIP 10.96.0.1 443/TCP 32m 139 | 140 |
141 | 142 | $ echo $(minikube service client-node-port --url) 143 | http://192.168.99.117:31515 144 | 145 |
146 | 147 | $ kubectl delete -f client-pod.yaml 148 | $ kubectl delete -f client-node-pod.yaml 149 | 150 |
151 | 152 | ## 13 Maintaining Sets of Containers with Deployments 153 | 154 | $ kubectl apply -f client-node-pod.yaml 155 | $ kubectl apply -f client-deployment.yaml 156 | $ kubectl get pods 157 | $ kubectl get deployments 158 | NAME DESIRED CURRENT UP-TO-DATE AVAILABLE AGE 159 | client-deployment 1 1 1 1 1m 160 | 161 | $ echo $(minikube service client-node-port --url) 162 | http://192.168.99.117:31515 163 | 164 |
165 | 166 | $ kubectl get pods -o wide 167 | NAME READY STATUS RESTARTS AGE IP NODE 168 | client-deployment-588947887b-lkqsc 1/1 Running 0 8m 172.17.0.7 minikube 169 | 170 |
171 | 172 | $ vi client-deployment.yaml 173 | 174 | set replicas: 5 175 | 176 | $ kubectl apply -f client-deployment.yaml 177 | 178 |
179 | 180 | $ kubectl get deployments 181 | NAME READY UP-TO-DATE AVAILABLE AGE 182 | client-deployment 5/5 5 5 16m 183 | 184 |
185 | 186 | set replicas back to: 1 187 | 188 |
189 | 190 | **Update container:** 191 | 192 | $ kubectl set image deployment/client-deployment client=marley/multi-client:v5 193 | 194 |
195 | 196 | **Reconfiguring Docker CLI** 197 | 198 | $ minikube docker-env 199 | export DOCKER_TLS_VERIFY="1" 200 | export DOCKER_HOST="tcp://192.168.99.117:2376" 201 | export DOCKER_CERT_PATH="/home/marley/.minikube/certs" 202 | export DOCKER_API_VERSION="1.35" 203 | # Run this command to configure your shell: 204 | # eval $(minikube docker-env) 205 | 206 |
207 | 208 | $ eval $(minikube docker-env) 209 | $ docker ps 210 | 211 |
212 | 213 | ## 14 A Multi-Container App with Kubernetes 214 | 215 |
216 | 217 | $ minikube stop 218 | $ minikube delete 219 | $ minikube start 220 | 221 |
222 | 223 | ![Application](/img/pic-14-01.png?raw=true) 224 | 225 |
226 | 227 | ![Application](/img/pic-14-02.png?raw=true) 228 | 229 |
230 | 231 | **Persitence Volume && Persitence Volume Claims** 232 | 233 |
234 | 235 | ![Application](/img/pic-14-03.png?raw=true) 236 | 237 | ![Application](/img/pic-14-04.png?raw=true) 238 | 239 |
240 | 241 | ![Application](/img/pic-14-05.png?raw=true) 242 | 243 |
244 | 245 | ![Application](/img/pic-14-06.png?raw=true) 246 | 247 |
248 | 249 | ![Application](/img/pic-14-07.png?raw=true) 250 | 251 |
252 | 253 | ![Application](/img/pic-14-08.png?raw=true) 254 | 255 |
256 | 257 | // we will use default minikube storageclass 258 | $ kubectl get storageclass 259 | $ kubectl describe storageclass 260 | 261 |
262 | 263 | $ cd 14_A_Multi_Container_App_with_Kubernetes 264 | 265 | $ kubectl apply -f . 266 | $ kubectl get pv 267 | $ kubectl get pvc 268 | 269 |
270 | 271 | **Environment Variables** 272 | 273 |
274 | 275 | ![Application](/img/pic-14-09.png?raw=true) 276 | 277 |
278 | 279 | ![Application](/img/pic-14-10.png?raw=true) 280 | 281 |
282 | 283 | **Secrets** 284 | 285 | $ kubectl create secret generic pgpassword --from-literal PGPASSWORD=12345asdf 286 | $ kubectl get secrets 287 | 288 |
289 | 290 | **Final** 291 | 292 | $ kubectl apply -f . 293 | 294 |
295 | 296 | ## 15 Handling Traffic with Ingress Controllers 297 | 298 |
299 | 300 | $ minikube addons enable ingress 301 | 302 |
303 | 304 | ![Application](/img/pic-15-01.png?raw=true) 305 | 306 |
307 | 308 | ![Application](/img/pic-15-02.png?raw=true) 309 | 310 |
311 | 312 | ![Application](/img/pic-15-03.png?raw=true) 313 | 314 |
315 | 316 | ![Application](/img/pic-15-04.png?raw=true) 317 | 318 | https://github.com/kubernetes/ingress-nginx 319 | 320 | https://kubernetes.github.io/ingress-nginx/deploy/#prerequisite-generic-deployment-command 321 | 322 | $ kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/master/deploy/static/mandatory.yaml 323 | 324 | https://kubernetes.github.io/ingress-nginx/deploy/#minikube 325 | 326 |
327 | 328 | $ cd 15_Handling_Traffic_with_Ingress_Controllers/ 329 | 330 | $ kubectl apply -f ingress-service.yaml 331 | 332 |
333 | 334 | $ minikube ip 335 | 192.168.99.100 336 | 337 | https://192.168.99.100/ 338 | 339 |
340 | 341 | ![Application](/img/pic-15-05.png?raw=true) 342 | 343 |
344 | 345 | $ minikube stop 346 | $ minikube delete 347 | 348 |
349 | 350 | ## 16 Kubernetes Production Deployment 351 | 352 | I will only watch. Do not want to pay for Google Clouds. 353 | 354 | here 355 | 356 |
357 | 358 | ## 17 HTTPS Setup with Kubernetes 359 | 360 | here 361 | 362 |
363 | 364 | --- 365 | 366 |
367 | 368 | **Marley** 369 | 370 | Any questions in eng: https://jsdev.org/chat/ 371 | Любые вопросы на русском: https://jsdev.ru/chat/ 372 | -------------------------------------------------------------------------------- /img/pic-09-01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/webmakaka/Docker-and-Kubernetes-The-Complete-Guide/488b431085038ebf03f07a78aec15723fa6783c3/img/pic-09-01.png -------------------------------------------------------------------------------- /img/pic-09-02.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/webmakaka/Docker-and-Kubernetes-The-Complete-Guide/488b431085038ebf03f07a78aec15723fa6783c3/img/pic-09-02.png -------------------------------------------------------------------------------- /img/pic-09-03.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/webmakaka/Docker-and-Kubernetes-The-Complete-Guide/488b431085038ebf03f07a78aec15723fa6783c3/img/pic-09-03.png -------------------------------------------------------------------------------- /img/pic-09-04.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/webmakaka/Docker-and-Kubernetes-The-Complete-Guide/488b431085038ebf03f07a78aec15723fa6783c3/img/pic-09-04.png -------------------------------------------------------------------------------- /img/pic-09-05.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/webmakaka/Docker-and-Kubernetes-The-Complete-Guide/488b431085038ebf03f07a78aec15723fa6783c3/img/pic-09-05.png -------------------------------------------------------------------------------- /img/pic-09-06.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/webmakaka/Docker-and-Kubernetes-The-Complete-Guide/488b431085038ebf03f07a78aec15723fa6783c3/img/pic-09-06.png -------------------------------------------------------------------------------- /img/pic-09-07.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/webmakaka/Docker-and-Kubernetes-The-Complete-Guide/488b431085038ebf03f07a78aec15723fa6783c3/img/pic-09-07.png -------------------------------------------------------------------------------- /img/pic-10-01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/webmakaka/Docker-and-Kubernetes-The-Complete-Guide/488b431085038ebf03f07a78aec15723fa6783c3/img/pic-10-01.png -------------------------------------------------------------------------------- /img/pic-10-02.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/webmakaka/Docker-and-Kubernetes-The-Complete-Guide/488b431085038ebf03f07a78aec15723fa6783c3/img/pic-10-02.png -------------------------------------------------------------------------------- /img/pic-10-03.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/webmakaka/Docker-and-Kubernetes-The-Complete-Guide/488b431085038ebf03f07a78aec15723fa6783c3/img/pic-10-03.png -------------------------------------------------------------------------------- /img/pic-10-04.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/webmakaka/Docker-and-Kubernetes-The-Complete-Guide/488b431085038ebf03f07a78aec15723fa6783c3/img/pic-10-04.png -------------------------------------------------------------------------------- /img/pic-11-01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/webmakaka/Docker-and-Kubernetes-The-Complete-Guide/488b431085038ebf03f07a78aec15723fa6783c3/img/pic-11-01.png -------------------------------------------------------------------------------- /img/pic-11-02.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/webmakaka/Docker-and-Kubernetes-The-Complete-Guide/488b431085038ebf03f07a78aec15723fa6783c3/img/pic-11-02.png -------------------------------------------------------------------------------- /img/pic-14-01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/webmakaka/Docker-and-Kubernetes-The-Complete-Guide/488b431085038ebf03f07a78aec15723fa6783c3/img/pic-14-01.png -------------------------------------------------------------------------------- /img/pic-14-02.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/webmakaka/Docker-and-Kubernetes-The-Complete-Guide/488b431085038ebf03f07a78aec15723fa6783c3/img/pic-14-02.png -------------------------------------------------------------------------------- /img/pic-14-03.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/webmakaka/Docker-and-Kubernetes-The-Complete-Guide/488b431085038ebf03f07a78aec15723fa6783c3/img/pic-14-03.png -------------------------------------------------------------------------------- /img/pic-14-04.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/webmakaka/Docker-and-Kubernetes-The-Complete-Guide/488b431085038ebf03f07a78aec15723fa6783c3/img/pic-14-04.png -------------------------------------------------------------------------------- /img/pic-14-05.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/webmakaka/Docker-and-Kubernetes-The-Complete-Guide/488b431085038ebf03f07a78aec15723fa6783c3/img/pic-14-05.png -------------------------------------------------------------------------------- /img/pic-14-06.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/webmakaka/Docker-and-Kubernetes-The-Complete-Guide/488b431085038ebf03f07a78aec15723fa6783c3/img/pic-14-06.png -------------------------------------------------------------------------------- /img/pic-14-07.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/webmakaka/Docker-and-Kubernetes-The-Complete-Guide/488b431085038ebf03f07a78aec15723fa6783c3/img/pic-14-07.png -------------------------------------------------------------------------------- /img/pic-14-08.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/webmakaka/Docker-and-Kubernetes-The-Complete-Guide/488b431085038ebf03f07a78aec15723fa6783c3/img/pic-14-08.png -------------------------------------------------------------------------------- /img/pic-14-09.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/webmakaka/Docker-and-Kubernetes-The-Complete-Guide/488b431085038ebf03f07a78aec15723fa6783c3/img/pic-14-09.png -------------------------------------------------------------------------------- /img/pic-14-10.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/webmakaka/Docker-and-Kubernetes-The-Complete-Guide/488b431085038ebf03f07a78aec15723fa6783c3/img/pic-14-10.png -------------------------------------------------------------------------------- /img/pic-15-01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/webmakaka/Docker-and-Kubernetes-The-Complete-Guide/488b431085038ebf03f07a78aec15723fa6783c3/img/pic-15-01.png -------------------------------------------------------------------------------- /img/pic-15-02.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/webmakaka/Docker-and-Kubernetes-The-Complete-Guide/488b431085038ebf03f07a78aec15723fa6783c3/img/pic-15-02.png -------------------------------------------------------------------------------- /img/pic-15-03.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/webmakaka/Docker-and-Kubernetes-The-Complete-Guide/488b431085038ebf03f07a78aec15723fa6783c3/img/pic-15-03.png -------------------------------------------------------------------------------- /img/pic-15-04.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/webmakaka/Docker-and-Kubernetes-The-Complete-Guide/488b431085038ebf03f07a78aec15723fa6783c3/img/pic-15-04.png -------------------------------------------------------------------------------- /img/pic-15-05.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/webmakaka/Docker-and-Kubernetes-The-Complete-Guide/488b431085038ebf03f07a78aec15723fa6783c3/img/pic-15-05.png -------------------------------------------------------------------------------- /img/pic-16-01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/webmakaka/Docker-and-Kubernetes-The-Complete-Guide/488b431085038ebf03f07a78aec15723fa6783c3/img/pic-16-01.png -------------------------------------------------------------------------------- /img/pic-16-02.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/webmakaka/Docker-and-Kubernetes-The-Complete-Guide/488b431085038ebf03f07a78aec15723fa6783c3/img/pic-16-02.png -------------------------------------------------------------------------------- /img/pic-16-03.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/webmakaka/Docker-and-Kubernetes-The-Complete-Guide/488b431085038ebf03f07a78aec15723fa6783c3/img/pic-16-03.png -------------------------------------------------------------------------------- /img/pic-16-04.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/webmakaka/Docker-and-Kubernetes-The-Complete-Guide/488b431085038ebf03f07a78aec15723fa6783c3/img/pic-16-04.png -------------------------------------------------------------------------------- /img/pic-16-05.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/webmakaka/Docker-and-Kubernetes-The-Complete-Guide/488b431085038ebf03f07a78aec15723fa6783c3/img/pic-16-05.png -------------------------------------------------------------------------------- /img/pic-16-06.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/webmakaka/Docker-and-Kubernetes-The-Complete-Guide/488b431085038ebf03f07a78aec15723fa6783c3/img/pic-16-06.png -------------------------------------------------------------------------------- /img/pic-16-07.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/webmakaka/Docker-and-Kubernetes-The-Complete-Guide/488b431085038ebf03f07a78aec15723fa6783c3/img/pic-16-07.png -------------------------------------------------------------------------------- /img/pic-16-08.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/webmakaka/Docker-and-Kubernetes-The-Complete-Guide/488b431085038ebf03f07a78aec15723fa6783c3/img/pic-16-08.png -------------------------------------------------------------------------------- /img/pic-16-09.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/webmakaka/Docker-and-Kubernetes-The-Complete-Guide/488b431085038ebf03f07a78aec15723fa6783c3/img/pic-16-09.png -------------------------------------------------------------------------------- /img/pic-16-10.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/webmakaka/Docker-and-Kubernetes-The-Complete-Guide/488b431085038ebf03f07a78aec15723fa6783c3/img/pic-16-10.png -------------------------------------------------------------------------------- /img/pic-16-11.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/webmakaka/Docker-and-Kubernetes-The-Complete-Guide/488b431085038ebf03f07a78aec15723fa6783c3/img/pic-16-11.png -------------------------------------------------------------------------------- /img/pic-16-12.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/webmakaka/Docker-and-Kubernetes-The-Complete-Guide/488b431085038ebf03f07a78aec15723fa6783c3/img/pic-16-12.png -------------------------------------------------------------------------------- /img/pic-16-13.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/webmakaka/Docker-and-Kubernetes-The-Complete-Guide/488b431085038ebf03f07a78aec15723fa6783c3/img/pic-16-13.png -------------------------------------------------------------------------------- /img/pic-16-14.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/webmakaka/Docker-and-Kubernetes-The-Complete-Guide/488b431085038ebf03f07a78aec15723fa6783c3/img/pic-16-14.png -------------------------------------------------------------------------------- /img/pic-16-15.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/webmakaka/Docker-and-Kubernetes-The-Complete-Guide/488b431085038ebf03f07a78aec15723fa6783c3/img/pic-16-15.png -------------------------------------------------------------------------------- /img/pic-16-16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/webmakaka/Docker-and-Kubernetes-The-Complete-Guide/488b431085038ebf03f07a78aec15723fa6783c3/img/pic-16-16.png -------------------------------------------------------------------------------- /img/pic-16-17.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/webmakaka/Docker-and-Kubernetes-The-Complete-Guide/488b431085038ebf03f07a78aec15723fa6783c3/img/pic-16-17.png -------------------------------------------------------------------------------- /img/pic-16-18.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/webmakaka/Docker-and-Kubernetes-The-Complete-Guide/488b431085038ebf03f07a78aec15723fa6783c3/img/pic-16-18.png -------------------------------------------------------------------------------- /img/pic-16-19.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/webmakaka/Docker-and-Kubernetes-The-Complete-Guide/488b431085038ebf03f07a78aec15723fa6783c3/img/pic-16-19.png -------------------------------------------------------------------------------- /img/pic-16-20.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/webmakaka/Docker-and-Kubernetes-The-Complete-Guide/488b431085038ebf03f07a78aec15723fa6783c3/img/pic-16-20.png -------------------------------------------------------------------------------- /img/pic-16-21.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/webmakaka/Docker-and-Kubernetes-The-Complete-Guide/488b431085038ebf03f07a78aec15723fa6783c3/img/pic-16-21.png -------------------------------------------------------------------------------- /img/pic-16-22.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/webmakaka/Docker-and-Kubernetes-The-Complete-Guide/488b431085038ebf03f07a78aec15723fa6783c3/img/pic-16-22.png -------------------------------------------------------------------------------- /img/pic-16-23.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/webmakaka/Docker-and-Kubernetes-The-Complete-Guide/488b431085038ebf03f07a78aec15723fa6783c3/img/pic-16-23.png -------------------------------------------------------------------------------- /img/pic-16-24.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/webmakaka/Docker-and-Kubernetes-The-Complete-Guide/488b431085038ebf03f07a78aec15723fa6783c3/img/pic-16-24.png -------------------------------------------------------------------------------- /img/pic-16-25.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/webmakaka/Docker-and-Kubernetes-The-Complete-Guide/488b431085038ebf03f07a78aec15723fa6783c3/img/pic-16-25.png -------------------------------------------------------------------------------- /img/pic-16-26.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/webmakaka/Docker-and-Kubernetes-The-Complete-Guide/488b431085038ebf03f07a78aec15723fa6783c3/img/pic-16-26.png -------------------------------------------------------------------------------- /img/pic-16-27.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/webmakaka/Docker-and-Kubernetes-The-Complete-Guide/488b431085038ebf03f07a78aec15723fa6783c3/img/pic-16-27.png -------------------------------------------------------------------------------- /img/pic-16-28.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/webmakaka/Docker-and-Kubernetes-The-Complete-Guide/488b431085038ebf03f07a78aec15723fa6783c3/img/pic-16-28.png -------------------------------------------------------------------------------- /img/pic-16-29.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/webmakaka/Docker-and-Kubernetes-The-Complete-Guide/488b431085038ebf03f07a78aec15723fa6783c3/img/pic-16-29.png -------------------------------------------------------------------------------- /img/pic-16-30.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/webmakaka/Docker-and-Kubernetes-The-Complete-Guide/488b431085038ebf03f07a78aec15723fa6783c3/img/pic-16-30.png -------------------------------------------------------------------------------- /img/pic-16-31.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/webmakaka/Docker-and-Kubernetes-The-Complete-Guide/488b431085038ebf03f07a78aec15723fa6783c3/img/pic-16-31.png -------------------------------------------------------------------------------- /img/pic-16-32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/webmakaka/Docker-and-Kubernetes-The-Complete-Guide/488b431085038ebf03f07a78aec15723fa6783c3/img/pic-16-32.png -------------------------------------------------------------------------------- /img/pic-16-33.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/webmakaka/Docker-and-Kubernetes-The-Complete-Guide/488b431085038ebf03f07a78aec15723fa6783c3/img/pic-16-33.png -------------------------------------------------------------------------------- /img/pic-16-34.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/webmakaka/Docker-and-Kubernetes-The-Complete-Guide/488b431085038ebf03f07a78aec15723fa6783c3/img/pic-16-34.png -------------------------------------------------------------------------------- /img/pic-16-35.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/webmakaka/Docker-and-Kubernetes-The-Complete-Guide/488b431085038ebf03f07a78aec15723fa6783c3/img/pic-16-35.png -------------------------------------------------------------------------------- /img/pic-16-36.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/webmakaka/Docker-and-Kubernetes-The-Complete-Guide/488b431085038ebf03f07a78aec15723fa6783c3/img/pic-16-36.png -------------------------------------------------------------------------------- /img/pic-16-37.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/webmakaka/Docker-and-Kubernetes-The-Complete-Guide/488b431085038ebf03f07a78aec15723fa6783c3/img/pic-16-37.png -------------------------------------------------------------------------------- /img/pic-16-38.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/webmakaka/Docker-and-Kubernetes-The-Complete-Guide/488b431085038ebf03f07a78aec15723fa6783c3/img/pic-16-38.png -------------------------------------------------------------------------------- /img/pic-16-39.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/webmakaka/Docker-and-Kubernetes-The-Complete-Guide/488b431085038ebf03f07a78aec15723fa6783c3/img/pic-16-39.png -------------------------------------------------------------------------------- /img/pic-16-40.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/webmakaka/Docker-and-Kubernetes-The-Complete-Guide/488b431085038ebf03f07a78aec15723fa6783c3/img/pic-16-40.png -------------------------------------------------------------------------------- /img/pic-16-41.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/webmakaka/Docker-and-Kubernetes-The-Complete-Guide/488b431085038ebf03f07a78aec15723fa6783c3/img/pic-16-41.png -------------------------------------------------------------------------------- /img/pic-16-42.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/webmakaka/Docker-and-Kubernetes-The-Complete-Guide/488b431085038ebf03f07a78aec15723fa6783c3/img/pic-16-42.png -------------------------------------------------------------------------------- /img/pic-16-43.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/webmakaka/Docker-and-Kubernetes-The-Complete-Guide/488b431085038ebf03f07a78aec15723fa6783c3/img/pic-16-43.png -------------------------------------------------------------------------------- /img/pic-17-01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/webmakaka/Docker-and-Kubernetes-The-Complete-Guide/488b431085038ebf03f07a78aec15723fa6783c3/img/pic-17-01.png -------------------------------------------------------------------------------- /img/pic-17-02.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/webmakaka/Docker-and-Kubernetes-The-Complete-Guide/488b431085038ebf03f07a78aec15723fa6783c3/img/pic-17-02.png -------------------------------------------------------------------------------- /img/pic-17-03.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/webmakaka/Docker-and-Kubernetes-The-Complete-Guide/488b431085038ebf03f07a78aec15723fa6783c3/img/pic-17-03.png -------------------------------------------------------------------------------- /img/pic-17-04.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/webmakaka/Docker-and-Kubernetes-The-Complete-Guide/488b431085038ebf03f07a78aec15723fa6783c3/img/pic-17-04.png -------------------------------------------------------------------------------- /img/pic-17-05.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/webmakaka/Docker-and-Kubernetes-The-Complete-Guide/488b431085038ebf03f07a78aec15723fa6783c3/img/pic-17-05.png -------------------------------------------------------------------------------- /img/pic-17-06.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/webmakaka/Docker-and-Kubernetes-The-Complete-Guide/488b431085038ebf03f07a78aec15723fa6783c3/img/pic-17-06.png -------------------------------------------------------------------------------- /img/pic-17-07.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/webmakaka/Docker-and-Kubernetes-The-Complete-Guide/488b431085038ebf03f07a78aec15723fa6783c3/img/pic-17-07.png -------------------------------------------------------------------------------- /img/pic-17-08.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/webmakaka/Docker-and-Kubernetes-The-Complete-Guide/488b431085038ebf03f07a78aec15723fa6783c3/img/pic-17-08.png -------------------------------------------------------------------------------- /img/pic-17-09.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/webmakaka/Docker-and-Kubernetes-The-Complete-Guide/488b431085038ebf03f07a78aec15723fa6783c3/img/pic-17-09.png -------------------------------------------------------------------------------- /img/pic-17-10.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/webmakaka/Docker-and-Kubernetes-The-Complete-Guide/488b431085038ebf03f07a78aec15723fa6783c3/img/pic-17-10.png -------------------------------------------------------------------------------- /img/pic-17-11.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/webmakaka/Docker-and-Kubernetes-The-Complete-Guide/488b431085038ebf03f07a78aec15723fa6783c3/img/pic-17-11.png -------------------------------------------------------------------------------- /img/pic-17-12.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/webmakaka/Docker-and-Kubernetes-The-Complete-Guide/488b431085038ebf03f07a78aec15723fa6783c3/img/pic-17-12.png -------------------------------------------------------------------------------- /img/pic-17-13.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/webmakaka/Docker-and-Kubernetes-The-Complete-Guide/488b431085038ebf03f07a78aec15723fa6783c3/img/pic-17-13.png --------------------------------------------------------------------------------