diff --git a/.gitignore b/.gitignore index 0290c0c..ae65a46 100644 --- a/.gitignore +++ b/.gitignore @@ -2,4 +2,7 @@ node_modules/ DS_STORE .DS_STORE -.vagrant \ No newline at end of file +.vagrant + +#dependecies +CLASE-05/challenge/05/project/** \ No newline at end of file diff --git a/CLASE-04/Challenge/01/01challenge.sh b/CLASE-04/Challenge/01/01challenge.sh new file mode 100644 index 0000000..bebfe36 --- /dev/null +++ b/CLASE-04/Challenge/01/01challenge.sh @@ -0,0 +1,13 @@ +#!/bin/bash +# Download mysql +docker pull mysql:5.7 +# Download phpmyadmin +docker pull phpmyadmin:apache +# Run Mysql +docker run --name=challenge01-db -p 3306:3306 -e MYSQL_ROOT_PASSWORD=challenge01 -d mysql:5.7 +# Run PhpMyAdmin +docker run --name=challenge01-phpmyadmin -p 8082:80 --link challenge01-db:db -d phpmyadmin:apache +docker stop challenge01-phpmyadmin +docker rm challenge01-phpmyadmin +docker stop challenge01-db +docker rm challenge01-db \ No newline at end of file diff --git a/CLASE-04/Challenge/01/1-nginx.sh b/CLASE-04/Challenge/01/1-nginx.sh new file mode 100644 index 0000000..91e6a3d --- /dev/null +++ b/CLASE-04/Challenge/01/1-nginx.sh @@ -0,0 +1,10 @@ +#!/bin/bash +# Download nginx +docker pull nginx:1.22.1 +# Run nginx +mkdir html +cd html +cat > index.html << EOF +Challenge 01 +EOF +docker run --name challenge01 -v /root/html:/usr/share/nginx/html:ro -d -p 8080:80 nginx:1.22.1 \ No newline at end of file diff --git a/CLASE-04/Challenge/01/docker-playground.png b/CLASE-04/Challenge/01/docker-playground.png new file mode 100644 index 0000000..39622ae Binary files /dev/null and b/CLASE-04/Challenge/01/docker-playground.png differ diff --git a/CLASE-04/Challenge/01/phpmyadmin-web.png b/CLASE-04/Challenge/01/phpmyadmin-web.png new file mode 100644 index 0000000..6b3d07f Binary files /dev/null and b/CLASE-04/Challenge/01/phpmyadmin-web.png differ diff --git a/CLASE-04/Challenge/02/02challenge.sh b/CLASE-04/Challenge/02/02challenge.sh new file mode 100644 index 0000000..5da0ddf --- /dev/null +++ b/CLASE-04/Challenge/02/02challenge.sh @@ -0,0 +1,13 @@ +#!/bin/bash +# Download mongodb +docker pull mongo:4.2.24 +# Download python +docker pull python:3.7.16-alpine +# Run mongodb +docker run -d -p 27017:27017 --name challenge02-db mongo:4.2.24 +# Run python +pip install pymongo +python populate.py +python find.py +docker stop mongo:4.2.24 +docker rm mongo:4.2.24 \ No newline at end of file diff --git a/CLASE-04/Challenge/02/challenge02-console.png b/CLASE-04/Challenge/02/challenge02-console.png new file mode 100644 index 0000000..cfeb357 Binary files /dev/null and b/CLASE-04/Challenge/02/challenge02-console.png differ diff --git a/CLASE-04/Challenge/03/03challenge.bat b/CLASE-04/Challenge/03/03challenge.bat new file mode 100644 index 0000000..390b39f --- /dev/null +++ b/CLASE-04/Challenge/03/03challenge.bat @@ -0,0 +1,8 @@ +@ECHO OFF +:: Download nginx +docker pull nginx:1.22.1 +:: Run nginx +docker run --name challenge03 -v %cd%/web:/usr/share/nginx/html:ro -d -p 9999:80 nginx:1.22.1 +docker exec challenge03 ls /usr/share/nginx/html +docker stop challenge03 +docker rm challenge03 \ No newline at end of file diff --git a/CLASE-04/Challenge/03/03challenge.sh b/CLASE-04/Challenge/03/03challenge.sh new file mode 100644 index 0000000..ba3e314 --- /dev/null +++ b/CLASE-04/Challenge/03/03challenge.sh @@ -0,0 +1,8 @@ +#!/bin/bash +# Download nginx +docker pull nginx:1.22.1 +# Run nginx +docker run --name challenge03 -v /$(pwd)/web:/usr/share/nginx/html:ro -d -p 9999:80 nginx:1.22.1 +docker exec challenge03 ls /usr/share/nginx/html +docker stop challenge03 +docker rm challenge03 \ No newline at end of file diff --git a/CLASE-04/Challenge/03/challenge03-console.png b/CLASE-04/Challenge/03/challenge03-console.png new file mode 100644 index 0000000..05b58f2 Binary files /dev/null and b/CLASE-04/Challenge/03/challenge03-console.png differ diff --git a/CLASE-04/Challenge/03/challenge03-nginx.png b/CLASE-04/Challenge/03/challenge03-nginx.png new file mode 100644 index 0000000..d5017cd Binary files /dev/null and b/CLASE-04/Challenge/03/challenge03-nginx.png differ diff --git a/CLASE-04/Challenge/04/04challenge.sh b/CLASE-04/Challenge/04/04challenge.sh new file mode 100644 index 0000000..ffd513a --- /dev/null +++ b/CLASE-04/Challenge/04/04challenge.sh @@ -0,0 +1,14 @@ +#!/bin/bash +# Build Dockerfile +docker build . -t challenge04-apache:new +# Run Dockerfile +docker run -d --name challenge04 -p 5050:80 challenge04-apache:new +# Inspect Image +echo Inspect image +docker inspect challenge04-apache:new +echo History image +docker history challenge04-apache:new +echo Inspect image layers +docker image inspect challenge04-apache:new -f '{{.RootFS.Layers}}' +docker stop challenge04 +docker rm challenge04 \ No newline at end of file diff --git a/CLASE-04/Challenge/04/Dockerfile b/CLASE-04/Challenge/04/Dockerfile new file mode 100644 index 0000000..63f1fc9 --- /dev/null +++ b/CLASE-04/Challenge/04/Dockerfile @@ -0,0 +1,9 @@ +FROM nginx:alpine + +LABEL project="challenge04" + +#Como metadato, indicamos que el contenedor utiliza el puerto 80 +EXPOSE 80 + +#Modificaciones sobre la imagen que he utilizado como base, en este caso alpine +COPY content/ /usr/share/nginx/html/ \ No newline at end of file diff --git a/CLASE-04/Challenge/04/challenge04-console-part1.png b/CLASE-04/Challenge/04/challenge04-console-part1.png new file mode 100644 index 0000000..ec1c6e8 Binary files /dev/null and b/CLASE-04/Challenge/04/challenge04-console-part1.png differ diff --git a/CLASE-04/Challenge/04/challenge04-console-part2.png b/CLASE-04/Challenge/04/challenge04-console-part2.png new file mode 100644 index 0000000..9230a73 Binary files /dev/null and b/CLASE-04/Challenge/04/challenge04-console-part2.png differ diff --git a/CLASE-04/Challenge/05/05challenge.sh b/CLASE-04/Challenge/05/05challenge.sh new file mode 100644 index 0000000..7ba9043 --- /dev/null +++ b/CLASE-04/Challenge/05/05challenge.sh @@ -0,0 +1,13 @@ +#!/bin/bash +# Image in My Docker Hub +# wyataco/challenge05-app:1.0 +# wyataco/challenge05-consumer:1.0 + +# Run docker compose +docker-compose up -d +sleep 3 +curl localhost:8000 +sleep 2 +docker logs service-consumer +sleep 3 +docker-compose down \ No newline at end of file diff --git a/CLASE-04/Challenge/05/challenge05-console.png b/CLASE-04/Challenge/05/challenge05-console.png new file mode 100644 index 0000000..f2e740f Binary files /dev/null and b/CLASE-04/Challenge/05/challenge05-console.png differ diff --git a/CLASE-04/Challenge/05/docker-compose.yml b/CLASE-04/Challenge/05/docker-compose.yml new file mode 100644 index 0000000..b3f8bd9 --- /dev/null +++ b/CLASE-04/Challenge/05/docker-compose.yml @@ -0,0 +1,22 @@ +version: '3.8' + +services: + challenge05-app: + image: wyataco/challenge05-app:1.0 + container_name: service-flask-app + ports: + - 8000:8000 + networks: + - challenge05 + + challenge05-consumer: + image: wyataco/challenge05-consumer:1.0 + container_name: service-consumer + environment: + - LOCAL=true + - PYTHONUNBUFFERED=1 + networks: + - challenge05 + +networks: + challenge05: \ No newline at end of file diff --git a/CLASE-04/Challenge/05/src/app/Dockerfile b/CLASE-04/Challenge/05/src/app/Dockerfile new file mode 100644 index 0000000..3582640 --- /dev/null +++ b/CLASE-04/Challenge/05/src/app/Dockerfile @@ -0,0 +1,9 @@ +FROM python:3.10.11-alpine +WORKDIR /app +COPY requirements.txt requirements.txt + +RUN pip install --no-cache-dir --requirement requirements.txt +COPY . /app +EXPOSE 8000 + +CMD [ "python", "app.py" ] \ No newline at end of file diff --git a/CLASE-04/Challenge/05/src/app/requirements.txt b/CLASE-04/Challenge/05/src/app/requirements.txt new file mode 100644 index 0000000..fb0dec5 --- /dev/null +++ b/CLASE-04/Challenge/05/src/app/requirements.txt @@ -0,0 +1 @@ +Flask==2.0.3 \ No newline at end of file diff --git a/CLASE-04/Challenge/05/src/consumer/Dockerfile b/CLASE-04/Challenge/05/src/consumer/Dockerfile new file mode 100644 index 0000000..59ca3cf --- /dev/null +++ b/CLASE-04/Challenge/05/src/consumer/Dockerfile @@ -0,0 +1,8 @@ +FROM python:3.10.11-alpine +WORKDIR /consumer +COPY requirements.txt requirements.txt + +RUN pip install --no-cache-dir --requirement requirements.txt +COPY . /consumer + +CMD [ "python", "consumer.py" ] \ No newline at end of file diff --git a/CLASE-04/Challenge/05/src/consumer/requirements.txt b/CLASE-04/Challenge/05/src/consumer/requirements.txt new file mode 100644 index 0000000..e20605c --- /dev/null +++ b/CLASE-04/Challenge/05/src/consumer/requirements.txt @@ -0,0 +1 @@ +requests==2.22.0 \ No newline at end of file diff --git a/CLASE-04/Challenge/06/06challenge.sh b/CLASE-04/Challenge/06/06challenge.sh new file mode 100644 index 0000000..c6ff374 --- /dev/null +++ b/CLASE-04/Challenge/06/06challenge.sh @@ -0,0 +1,14 @@ +#!/bin/bash +# Build Dockerfile +docker build -t wyataco/challenge06-pokepy:1.0 . +# Run Dockerfile +docker run -d --name challenge06 -p 5000:5000 wyataco/challenge06-pokepy:1.0 +sleep 2 +curl http://localhost:5000 +sleep 3 +curl http://localhost:5000 +sleep 3 +docker stop challenge06 +docker rm challenge06 +# Image in My Docker Hub +# wyataco/challenge06-pokepy:1.0 \ No newline at end of file diff --git a/CLASE-04/Challenge/06/Dockerfile b/CLASE-04/Challenge/06/Dockerfile new file mode 100644 index 0000000..1fc5d94 --- /dev/null +++ b/CLASE-04/Challenge/06/Dockerfile @@ -0,0 +1,8 @@ +FROM python:3.10.11-alpine +WORKDIR /app +COPY requirements.txt requirements.txt + +RUN pip install --no-cache-dir --requirement requirements.txt +COPY . /app + +CMD [ "python", "app.py" ] \ No newline at end of file diff --git a/CLASE-04/Challenge/07/07challenge.sh b/CLASE-04/Challenge/07/07challenge.sh new file mode 100644 index 0000000..d587a62 --- /dev/null +++ b/CLASE-04/Challenge/07/07challenge.sh @@ -0,0 +1,9 @@ +#!/bin/bash +# Image in My Docker Hub +# wyataco/challenge07-backend-pokemon-app:1.0 +# wyataco/challenge07-frontend-pokemon-app:1.0 + +# Run docker compose +docker-compose up -d +sleep 30 +docker-compose down \ No newline at end of file diff --git a/CLASE-04/Challenge/07/backend-pokemon-app/Dockerfile b/CLASE-04/Challenge/07/backend-pokemon-app/Dockerfile new file mode 100644 index 0000000..a6860db --- /dev/null +++ b/CLASE-04/Challenge/07/backend-pokemon-app/Dockerfile @@ -0,0 +1,9 @@ +FROM python:3.10.11-alpine +WORKDIR /app +COPY requirements.txt requirements.txt + +RUN pip install --no-cache-dir --requirement requirements.txt +COPY . /app +EXPOSE 8000 + +CMD [ "python", "main.py" ] \ No newline at end of file diff --git a/CLASE-04/Challenge/07/docker-compose.yml b/CLASE-04/Challenge/07/docker-compose.yml new file mode 100644 index 0000000..49634f3 --- /dev/null +++ b/CLASE-04/Challenge/07/docker-compose.yml @@ -0,0 +1,26 @@ +version: '3.8' + +services: + challenge07-backend: + image: wyataco/challenge07-backend-pokemon-app:1.0 + container_name: backend-pokemon-app + environment: + - PORT=8500 + ports: + - 8000:8500 + networks: + - challenge07 + + challenge07-front: + image: wyataco/challenge07-frontend-pokemon-app:1.0 + container_name: frontend-pokemon-app + environment: + - REACT_APP_URL_DEVELOPMENT=http://localhost:8000 + ports: + - 3000:3000 + networks: + - challenge07 + +networks: + challenge07: + driver: bridge \ No newline at end of file diff --git a/CLASE-04/Challenge/07/frontend-pokemon-app/Dockerfile b/CLASE-04/Challenge/07/frontend-pokemon-app/Dockerfile new file mode 100644 index 0000000..7b5c633 --- /dev/null +++ b/CLASE-04/Challenge/07/frontend-pokemon-app/Dockerfile @@ -0,0 +1,10 @@ +FROM node:16-alpine +WORKDIR /usr/src/app +COPY package*.json ./ + +RUN npm install + +COPY . /usr/src/app +EXPOSE 3000 + +CMD [ "npm", "start" ] \ No newline at end of file diff --git a/CLASE-04/Challenge/08/08challenge.sh b/CLASE-04/Challenge/08/08challenge.sh new file mode 100644 index 0000000..50a3266 --- /dev/null +++ b/CLASE-04/Challenge/08/08challenge.sh @@ -0,0 +1,14 @@ +#!/bin/bash +# Image in My Docker Hub +# wyataco/challenge08-app:1.0 + +# Run docker compose +docker-compose up -d +sleep 5 +curl http://localhost:8080 +curl http://localhost:8080 +curl http://localhost:8080 +curl http://localhost:8080 +curl http://localhost:8080 +sleep 5 +docker-compose down \ No newline at end of file diff --git a/CLASE-04/Challenge/08/Dockerfile b/CLASE-04/Challenge/08/Dockerfile new file mode 100644 index 0000000..cb0eb9b --- /dev/null +++ b/CLASE-04/Challenge/08/Dockerfile @@ -0,0 +1,9 @@ +FROM python:3.10.11-alpine +WORKDIR /app +COPY requirements.txt requirements.txt + +RUN pip install --no-cache-dir --requirement requirements.txt +COPY . /app + + +CMD [ "python", "app.py" ] \ No newline at end of file diff --git a/CLASE-04/Challenge/08/docker-compose.yml b/CLASE-04/Challenge/08/docker-compose.yml new file mode 100644 index 0000000..c321780 --- /dev/null +++ b/CLASE-04/Challenge/08/docker-compose.yml @@ -0,0 +1,26 @@ +version: '3.8' + +services: + challenge08-app: + build: ./ + container_name: challenge08-app + restart: always + ports: + - 8080:80 + depends_on: + - challenge08-redis + networks: + - challenge08 + + challenge08-redis: + image: redis-alpine + container_name: redis + restart: always + ports: + - 6379:6379 + networks: + - challenge08 + +networks: + challenge08: + driver: bridge \ No newline at end of file diff --git a/CLASE-04/Challenge/09/09challenge.sh b/CLASE-04/Challenge/09/09challenge.sh new file mode 100644 index 0000000..be29e94 --- /dev/null +++ b/CLASE-04/Challenge/09/09challenge.sh @@ -0,0 +1,6 @@ +#!/bin/bash +git clone https://github.com/wodby/docker4drupal.git +cd docker4drupal +docker4drupal$ docker-compose up -d +sleep 30 +docker ps \ No newline at end of file diff --git a/CLASE-04/Challenge/10/10challenge.sh b/CLASE-04/Challenge/10/10challenge.sh new file mode 100644 index 0000000..c230a74 --- /dev/null +++ b/CLASE-04/Challenge/10/10challenge.sh @@ -0,0 +1,4 @@ +#!/bin/bash +docker-compose up -d --build +sleep 120 +docker-compose down -v --rmi all \ No newline at end of file diff --git a/CLASE-04/Challenge/10/challenge10-console.png b/CLASE-04/Challenge/10/challenge10-console.png new file mode 100644 index 0000000..6cffe2d Binary files /dev/null and b/CLASE-04/Challenge/10/challenge10-console.png differ diff --git a/CLASE-04/Challenge/10/challenge10-pgadmin-part1.png b/CLASE-04/Challenge/10/challenge10-pgadmin-part1.png new file mode 100644 index 0000000..19854a2 Binary files /dev/null and b/CLASE-04/Challenge/10/challenge10-pgadmin-part1.png differ diff --git a/CLASE-04/Challenge/10/challenge10-pgadmin-part2.png b/CLASE-04/Challenge/10/challenge10-pgadmin-part2.png new file mode 100644 index 0000000..3032334 Binary files /dev/null and b/CLASE-04/Challenge/10/challenge10-pgadmin-part2.png differ diff --git a/CLASE-04/Challenge/10/challenge10-pgadmin-part3.png b/CLASE-04/Challenge/10/challenge10-pgadmin-part3.png new file mode 100644 index 0000000..53d1a1d Binary files /dev/null and b/CLASE-04/Challenge/10/challenge10-pgadmin-part3.png differ diff --git a/CLASE-04/Challenge/10/docker-compose.yml b/CLASE-04/Challenge/10/docker-compose.yml new file mode 100644 index 0000000..246c837 --- /dev/null +++ b/CLASE-04/Challenge/10/docker-compose.yml @@ -0,0 +1,41 @@ +version: '3.8' + +services: + + db: + image: postgres:12 + container_name: challenge10-postgres + restart: always + environment: + POSTGRES_USER: admin + POSTGRES_PASSWORD: secret123 + POSTGRES_DB: challenge10_database + PGDATA: /data/postgres + volumes: + - vol_postgres:/data/postgres + ports: + - "5432:5432" + networks: + - challenge10 + + pgadmin: + image: dpage/pgadmin4 + container_name: challenge10-pgadmin + restart: always + ports: + - "8080:80" + environment: + PGADMIN_DEFAULT_EMAIL: admin@example.com + PGADMIN_DEFAULT_PASSWORD: secret123 + volumes: + - vol_pgadmin:/var/lib/pgadmin + networks: + - challenge10 + +volumes: + vol_postgres: + vol_pgadmin: + +networks: + challenge10: + driver: bridge \ No newline at end of file diff --git a/CLASE-04/Challenge/11/11challenge.sh b/CLASE-04/Challenge/11/11challenge.sh new file mode 100644 index 0000000..464d28c --- /dev/null +++ b/CLASE-04/Challenge/11/11challenge.sh @@ -0,0 +1,10 @@ +#!/bin/bash +mkdir lamp-app-ecommerce +cp -r ../../../CLASE-02/lamp-app-ecommerce/* lamp-app-ecommerce +docker compose up -d +sleep 30 +docker ps +docker exec -t challenge11-php bash -c "sed -i 's/172.20.1.101/mariadb/g' /var/www/html/index.php" +sleep 30 +docker-compose down -v --rmi all +rm -r lamp-app-ecommerce \ No newline at end of file diff --git a/CLASE-04/Challenge/11/Dockerfile b/CLASE-04/Challenge/11/Dockerfile new file mode 100644 index 0000000..cc958d0 --- /dev/null +++ b/CLASE-04/Challenge/11/Dockerfile @@ -0,0 +1,4 @@ +FROM php:8-fpm + +RUN apt-get update && \ + docker-php-ext-install mysqli pdo pdo_mysql \ No newline at end of file diff --git a/CLASE-04/Challenge/11/challenge11-console.png b/CLASE-04/Challenge/11/challenge11-console.png new file mode 100644 index 0000000..85113e9 Binary files /dev/null and b/CLASE-04/Challenge/11/challenge11-console.png differ diff --git a/CLASE-04/Challenge/11/challenge11-web-error.png b/CLASE-04/Challenge/11/challenge11-web-error.png new file mode 100644 index 0000000..4795b32 Binary files /dev/null and b/CLASE-04/Challenge/11/challenge11-web-error.png differ diff --git a/CLASE-04/Challenge/11/challenge11-web-ok.png b/CLASE-04/Challenge/11/challenge11-web-ok.png new file mode 100644 index 0000000..ce7ffb2 Binary files /dev/null and b/CLASE-04/Challenge/11/challenge11-web-ok.png differ diff --git a/CLASE-04/Challenge/11/default.conf b/CLASE-04/Challenge/11/default.conf new file mode 100644 index 0000000..2e54e7f --- /dev/null +++ b/CLASE-04/Challenge/11/default.conf @@ -0,0 +1,18 @@ +server { + index index.php index.htm index.html; + + root /var/www/html; + + error_log /var/log/nginx/error.log; + access_log /var/log/nginx/access.log; + + location ~ \.php$ { + try_files $uri =404; + fastcgi_split_path_info ^(.+\.php)(/.+)$; + fastcgi_pass php:9000; + fastcgi_index index.php; + include fastcgi_params; + fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; + fastcgi_param PATH_INFO $fastcgi_path_info; + } +} \ No newline at end of file diff --git a/CLASE-04/Challenge/11/docker-compose.yml b/CLASE-04/Challenge/11/docker-compose.yml new file mode 100644 index 0000000..b8489b5 --- /dev/null +++ b/CLASE-04/Challenge/11/docker-compose.yml @@ -0,0 +1,46 @@ +version: '3.8' + +services: + challenge11-web: + image: nginx:1.22.1 + container_name: challenge11-web + volumes: + - ./lamp-app-ecommerce:/var/www/html + - ./default.conf:/etc/nginx/conf.d/default.conf + restart: always + ports: + - 8080:80 + depends_on: + - php + networks: + - challenge11 + + php: + build: . + container_name: challenge11-php + volumes: + - ./lamp-app-ecommerce:/var/www/html + depends_on: + - mariadb + networks: + - challenge11 + + mariadb: + image: mariadb:10.10 + container_name: challenge11-db + environment: + MARIADB_DATABASE : ecomdb + MARIADB_USER : ecomuser + MARIADB_PASSWORD : ecompassword + MARIADB_ROOT_PASSWORD: ecompassword + volumes: + - ./script-load-db.sql:/docker-entrypoint-initdb.d/init.sql + restart: always + ports: + - 3306:3306 + networks: + - challenge11 + +networks: + challenge11: + driver: bridge \ No newline at end of file diff --git a/CLASE-04/Challenge/11/script-load-db.sql b/CLASE-04/Challenge/11/script-load-db.sql new file mode 100644 index 0000000..b02f620 --- /dev/null +++ b/CLASE-04/Challenge/11/script-load-db.sql @@ -0,0 +1,3 @@ +USE ecomdb; +CREATE TABLE products (id mediumint(8) unsigned NOT NULL auto_increment,Name varchar(255) default NULL,Price varchar(255) default NULL, ImageUrl varchar(255) default NULL,PRIMARY KEY (id)) AUTO_INCREMENT=1; +INSERT INTO products (Name,Price,ImageUrl) VALUES ("Laptop","100","c-1.png"),("Drone","200","c-2.png"),("VR","300","c-3.png"),("Tablet","50","c-5.png"),("Watch","90","c-6.png"),("Phone Covers","20","c-7.png"),("Phone","80","c-8.png"),("Laptop","150","c-4.png"); \ No newline at end of file diff --git a/CLASE-05/challenge/01/01challenge.md b/CLASE-05/challenge/01/01challenge.md new file mode 100644 index 0000000..1884623 --- /dev/null +++ b/CLASE-05/challenge/01/01challenge.md @@ -0,0 +1,19 @@ +# **Challenge01** + +> Resultados al realizar challenge 01 \ +[bash](./01challenge.sh) + +## **Resultados** + +1. ***Archivo `.yaml` que has creado con la definición del Pod.*** +[Pod.yaml](./pod.yaml) +2. ***Imagen donde se comprueba que el Pod ha sido creado.*** +![Screenshot 01.](./image1.png) +3. ***Imagen donde se ve la información detallada del Pod.*** +![Screenshot 02.](./image2.png) +4. ***Imagen donde se ve el archivo `index.html` del DocumentRoot.*** +![Screenshot 03.](./image3.png) +5. ***Imagen del navegador accediendo a la aplicación con el `port-forward`.*** +![Screenshot 04.](./image4.png) +6. ***Imagen donde se ve los logs de acceso del Pod.*** +![Screenshot 05.](./image5.png) \ No newline at end of file diff --git a/CLASE-05/challenge/01/01challenge.sh b/CLASE-05/challenge/01/01challenge.sh new file mode 100644 index 0000000..316d837 --- /dev/null +++ b/CLASE-05/challenge/01/01challenge.sh @@ -0,0 +1,10 @@ +vagrant up +cd syncd +kubectl create namespace challenge01 +kubectl apply -f 01/pod.yaml -n challenge01 +kubectl -n challenge01 get pod +kubectl -n challenge01 describe pod pod-challenge01 +kubectl -n challenge01 exec -it pod-challenge01 -- sh +exit +kubectl -n challenge01 port-forward --address 0.0.0.0 pod-challenge01 8888:80 +kubectl -n challenge01 logs pod-challenge01 diff --git a/CLASE-05/challenge/01/image1.png b/CLASE-05/challenge/01/image1.png new file mode 100644 index 0000000..fe33cef Binary files /dev/null and b/CLASE-05/challenge/01/image1.png differ diff --git a/CLASE-05/challenge/01/image2.png b/CLASE-05/challenge/01/image2.png new file mode 100644 index 0000000..2a38bdb Binary files /dev/null and b/CLASE-05/challenge/01/image2.png differ diff --git a/CLASE-05/challenge/01/image3.png b/CLASE-05/challenge/01/image3.png new file mode 100644 index 0000000..87fc25a Binary files /dev/null and b/CLASE-05/challenge/01/image3.png differ diff --git a/CLASE-05/challenge/01/image4.png b/CLASE-05/challenge/01/image4.png new file mode 100644 index 0000000..84a5965 Binary files /dev/null and b/CLASE-05/challenge/01/image4.png differ diff --git a/CLASE-05/challenge/01/image5.png b/CLASE-05/challenge/01/image5.png new file mode 100644 index 0000000..3698603 Binary files /dev/null and b/CLASE-05/challenge/01/image5.png differ diff --git a/CLASE-05/challenge/01/pod.yaml b/CLASE-05/challenge/01/pod.yaml new file mode 100644 index 0000000..5a1263c --- /dev/null +++ b/CLASE-05/challenge/01/pod.yaml @@ -0,0 +1,11 @@ +apiVersion: v1 +kind: Pod +metadata: + name: app-challenge01 + labels: + app: challenge01 + service: web +spec: + containers: + - image: roxsross12/k8s_test_web:latest + name: container-challenge01 diff --git a/CLASE-05/challenge/02/02challenge.md b/CLASE-05/challenge/02/02challenge.md new file mode 100644 index 0000000..7287859 --- /dev/null +++ b/CLASE-05/challenge/02/02challenge.md @@ -0,0 +1,17 @@ +# **Challenge02** + +> Resultados al realizar challenge 02 \ +[bash](./02challenge.sh) + +## **Resultados** + +1. ***Archivo `.yaml` que has creado con la definición del ReplicaSet.*** +[rs.yaml](./rs.yaml) +2. ***Imagen donde se comprueba que el ReplicaSet y los 3 Pods se han creado.*** +![Screenshot 01.](./imagen2.jpg) +3. ***Imagen donde se ve la información detallada del ReplicaSet.*** +![Screenshot 02.](./imagen3.jpg) +4. ***Imagen donde se ven los Pods que se han creado, después de eliminar uno de ellos.*** +![Screenshot 03.](./imagen4.jpg) +5. ***Imagen donde se ven los Pods que se han creado después del escalado.*** +![Screenshot 04.](./imagen5.jpg) \ No newline at end of file diff --git a/CLASE-05/challenge/02/02challenge.sh b/CLASE-05/challenge/02/02challenge.sh new file mode 100644 index 0000000..95f2078 --- /dev/null +++ b/CLASE-05/challenge/02/02challenge.sh @@ -0,0 +1,12 @@ +vagrant up +cd syncd +kubectl create namespace challenge02 +kubectl apply -f 02/rs.yaml -n challenge02 +kubectl -n challenge02 get rs,pods +kubectl -n challenge02 describe rs replicaset-web +kubectl -n challenge02 delete pod +kubectl -n challenge02 get pods +kubectl -n challenge02 scale rs replicaset-web --replicas=6 +kubectl -n challenge02 get pods +kubectl -n challenge02 delete rs replicaset-web +kubectl -n challenge02 get rs,pods \ No newline at end of file diff --git a/CLASE-05/challenge/02/imagen2.jpg b/CLASE-05/challenge/02/imagen2.jpg new file mode 100644 index 0000000..6196b0c Binary files /dev/null and b/CLASE-05/challenge/02/imagen2.jpg differ diff --git a/CLASE-05/challenge/02/imagen3.jpg b/CLASE-05/challenge/02/imagen3.jpg new file mode 100644 index 0000000..0809eb5 Binary files /dev/null and b/CLASE-05/challenge/02/imagen3.jpg differ diff --git a/CLASE-05/challenge/02/imagen4.jpg b/CLASE-05/challenge/02/imagen4.jpg new file mode 100644 index 0000000..5c35f37 Binary files /dev/null and b/CLASE-05/challenge/02/imagen4.jpg differ diff --git a/CLASE-05/challenge/02/imagen5.jpg b/CLASE-05/challenge/02/imagen5.jpg new file mode 100644 index 0000000..f0a62ea Binary files /dev/null and b/CLASE-05/challenge/02/imagen5.jpg differ diff --git a/CLASE-05/challenge/02/rs.yaml b/CLASE-05/challenge/02/rs.yaml new file mode 100644 index 0000000..5459d9b --- /dev/null +++ b/CLASE-05/challenge/02/rs.yaml @@ -0,0 +1,19 @@ +apiVersion: apps/v1 +kind: ReplicaSet +metadata: + name: replicaset-web +spec: + replicas: 3 + selector: + matchLabels: + app: challenge02 + service: web + template: + metadata: + labels: + app: challenge02 + service: web + spec: + containers: + - image: roxsross12/k8s_test_web:latest + name: container-web diff --git a/CLASE-05/challenge/03/03challenge.md b/CLASE-05/challenge/03/03challenge.md new file mode 100644 index 0000000..90b4bcf --- /dev/null +++ b/CLASE-05/challenge/03/03challenge.md @@ -0,0 +1,17 @@ +# **Challenge03** + +> Resultados al realizar challenge 03 \ +[bash](./03challenge.sh) + +## **Resultados** + +1. ***Archivo `.yaml` que has creado con la definición del Deploy.*** +[deploy.yaml](./deploy.yaml) +2. ***Imagen donde se comprueba los recursos que se han creado.*** +![Screenshot 01.](./imagen2.jpg) +3. ***Imagen donde se ve la información detallada del Deployment.*** +![Screenshot 02.](./imagen3.jpg) +4. ***Imagen donde se vea el acceso desde un navegador web a la aplicación usando el `port-forward`*** +![Screenshot 03.](./imagen4.jpg) +5. ***Imagen donde se vea los logs del despliegue después del acceso*** +![Screenshot 04.](./imagen5.jpg) \ No newline at end of file diff --git a/CLASE-05/challenge/03/03challenge.sh b/CLASE-05/challenge/03/03challenge.sh new file mode 100644 index 0000000..b2b29e8 --- /dev/null +++ b/CLASE-05/challenge/03/03challenge.sh @@ -0,0 +1,10 @@ +vagrant up +cd syncd +kubectl create namespace challenge03 +kubectl apply -f 03/deploy.yaml -n challenge03 +kubectl -n challenge03 get deploy,rs,pods +kubectl -n challenge03 describe deployment deploy-challenge03 +kubectl -n challenge03 port-forward --address 0.0.0.0 deployment/deploy-challenge03 8080:80 +kubectl -n challenge03 logs deployment/deploy-challenge03 +kubectl -n challenge03 delete deployment deploy-challenge03 +kubectl -n challenge03 get deploy,rs,pods \ No newline at end of file diff --git a/CLASE-05/challenge/03/deploy.yaml b/CLASE-05/challenge/03/deploy.yaml new file mode 100644 index 0000000..099190c --- /dev/null +++ b/CLASE-05/challenge/03/deploy.yaml @@ -0,0 +1,22 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: deploy-challenge03 + labels: + app: challenge03 + service: web +spec: + replicas: 2 + selector: + matchLabels: + app: challenge03 + service: web + template: + metadata: + labels: + app: challenge03 + service: web + spec: + containers: + - name: container-challenge03 + image: roxsross12/k8s_test_web:latest \ No newline at end of file diff --git a/CLASE-05/challenge/03/imagen2.jpg b/CLASE-05/challenge/03/imagen2.jpg new file mode 100644 index 0000000..8d55b35 Binary files /dev/null and b/CLASE-05/challenge/03/imagen2.jpg differ diff --git a/CLASE-05/challenge/03/imagen3.jpg b/CLASE-05/challenge/03/imagen3.jpg new file mode 100644 index 0000000..2538223 Binary files /dev/null and b/CLASE-05/challenge/03/imagen3.jpg differ diff --git a/CLASE-05/challenge/03/imagen4.jpg b/CLASE-05/challenge/03/imagen4.jpg new file mode 100644 index 0000000..7a69e21 Binary files /dev/null and b/CLASE-05/challenge/03/imagen4.jpg differ diff --git a/CLASE-05/challenge/03/imagen5.jpg b/CLASE-05/challenge/03/imagen5.jpg new file mode 100644 index 0000000..ef9ad3f Binary files /dev/null and b/CLASE-05/challenge/03/imagen5.jpg differ diff --git a/CLASE-05/challenge/04/04challenge.md b/CLASE-05/challenge/04/04challenge.md new file mode 100644 index 0000000..0e7625a --- /dev/null +++ b/CLASE-05/challenge/04/04challenge.md @@ -0,0 +1,21 @@ +# **Challenge04** + +> Resultados al realizar challenge 04 \ +[bash](./04challenge.sh) + +## **Resultados** + +1. ***Archivo `.yaml` que has creado con la definición del Deploy.*** +[deploy.yaml](./deploy.yaml) +2. ***Imagen donde se vea el acceso desde un navegador web a la version 1 de la aplicación aplicación.*** +![Screenshot 01.](./imagen1.jpg) +3. ***Imagen donde se vea el acceso desde un navegador web a la version 2 de la aplicación aplicación.*** +![Screenshot 02.](./imagen2.jpg) +4. ***Imagen donde se visualice el historial de actualización del despliegue después de actualizar a la versión 2.*** +![Screenshot 03.](./imagen3.jpg) +5. ***Imagen donde se vea el acceso desde un navegador web a la version 3 de la aplicación.*** +![Screenshot 04.](./imagen4.jpg) +6. ***Imagen donde se visualice el historial de actualización después de realizar el `rollback` del despliegue.*** +![Screenshot 05.](./imagen5.jpg) +7. ***Imagen donde se vea el acceso desde un navegador web a la version de la aplicación que queda después de hacer el rollout.*** +![Screenshot 06.](./imagen6.jpg) \ No newline at end of file diff --git a/CLASE-05/challenge/04/04challenge.sh b/CLASE-05/challenge/04/04challenge.sh new file mode 100644 index 0000000..c97df3c --- /dev/null +++ b/CLASE-05/challenge/04/04challenge.sh @@ -0,0 +1,30 @@ +vagrant up +cd syncd +#Crear Namespace +kubectl create namespace challenge04 +#Deploy Version 1 +kubectl apply -f 04/deploy.yaml -n challenge04 +kubectl -n challenge04 annotate deployment/deploy-challenge04 kubernetes.io/change-cause="Primer despliegue. Desplegamos versión v1" +kubectl -n challenge04 port-forward --address 0.0.0.0 deployment/deploy-challenge04 8080:80 +#Deploy Version 2 +sed -i 's/k8s_test_web:v1/k8s_test_web:v2/g' 04/deploy.yaml +kubectl apply -f 04/deploy.yaml -n challenge04 +kubectl -n challenge04 annotate deployment/deploy-challenge04 kubernetes.io/change-cause="Primer despliegue. Desplegamos versión v2" +kubectl -n challenge04 get deploy,rs,pods +kubectl -n challenge04 rollout history deployment/deploy-challenge04 +kubectl -n challenge04 port-forward --address 0.0.0.0 deployment/deploy-challenge04 8080:80 +#Deploy Version 3 +sed -i 's/k8s_test_web:v2/k8s_test_web:v3/g' 04/deploy.yaml +kubectl apply -f 04/deploy.yaml -n challenge04 +kubectl -n challenge04 annotate deployment/deploy-challenge04 kubernetes.io/change-cause="Primer despliegue. Desplegamos versión v3" +kubectl -n challenge04 get deploy,rs,pods +kubectl -n challenge04 rollout history deployment/deploy-challenge04 +kubectl -n challenge04 port-forward --address 0.0.0.0 deployment/deploy-challenge04 8080:80 +#Rollback Version 2 +kubectl -n challenge04 rollout undo deployment/deploy-challenge04 +kubectl -n challenge04 get deploy,rs,pods +kubectl -n challenge04 rollout history deployment/deploy-challenge04 +kubectl -n challenge04 port-forward --address 0.0.0.0 deployment/deploy-challenge04 8080:80 + +kubectl -n challenge04 delete deployment deploy-challenge04 +kubectl -n challenge04 get deploy,rs,pods \ No newline at end of file diff --git a/CLASE-05/challenge/04/deploy.yaml b/CLASE-05/challenge/04/deploy.yaml new file mode 100644 index 0000000..69fd02b --- /dev/null +++ b/CLASE-05/challenge/04/deploy.yaml @@ -0,0 +1,28 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: deploy-challenge04 + labels: + app: challenge04 + service: web +spec: + revisionHistoryLimit: 5 + strategy: + type: RollingUpdate + replicas: 1 + selector: + matchLabels: + app: challenge04 + service: web + template: + metadata: + labels: + app: challenge04 + service: web + spec: + containers: + - name: container-challenge04 + image: roxsross12/k8s_test_web:v3 + ports: + - name: portchallenge04 + containerPort: 80 \ No newline at end of file diff --git a/CLASE-05/challenge/04/imagen1.jpg b/CLASE-05/challenge/04/imagen1.jpg new file mode 100644 index 0000000..be74f0f Binary files /dev/null and b/CLASE-05/challenge/04/imagen1.jpg differ diff --git a/CLASE-05/challenge/04/imagen2.jpg b/CLASE-05/challenge/04/imagen2.jpg new file mode 100644 index 0000000..b716b05 Binary files /dev/null and b/CLASE-05/challenge/04/imagen2.jpg differ diff --git a/CLASE-05/challenge/04/imagen3.jpg b/CLASE-05/challenge/04/imagen3.jpg new file mode 100644 index 0000000..2d2caa9 Binary files /dev/null and b/CLASE-05/challenge/04/imagen3.jpg differ diff --git a/CLASE-05/challenge/04/imagen4.jpg b/CLASE-05/challenge/04/imagen4.jpg new file mode 100644 index 0000000..41d5289 Binary files /dev/null and b/CLASE-05/challenge/04/imagen4.jpg differ diff --git a/CLASE-05/challenge/04/imagen5.jpg b/CLASE-05/challenge/04/imagen5.jpg new file mode 100644 index 0000000..11a90db Binary files /dev/null and b/CLASE-05/challenge/04/imagen5.jpg differ diff --git a/CLASE-05/challenge/04/imagen6.jpg b/CLASE-05/challenge/04/imagen6.jpg new file mode 100644 index 0000000..47310c7 Binary files /dev/null and b/CLASE-05/challenge/04/imagen6.jpg differ diff --git a/CLASE-05/challenge/05/05challenge.sh b/CLASE-05/challenge/05/05challenge.sh new file mode 100644 index 0000000..67ca196 --- /dev/null +++ b/CLASE-05/challenge/05/05challenge.sh @@ -0,0 +1,24 @@ +#!/bin/bash +# Image in My Docker Hub +# wyataco/challenge05-app:1.0 +# wyataco/challenge05-consumer:1.0 +cp -r ../../../CLASE-04/Challenge/05/ project/ +vagrant ssh +eval $(minikube -p minikube docker-env) +cd syncd/05/project +docker compose build +cd +kubectl apply -f ./syncd/05/deployments/flask-app.yaml \ + -f ./syncd/05/deployments/consumer.yaml \ + -f ./syncd/05/services/flask-app.yaml + +kubectl get deploy,service,pod +kubectl describe service/service-flask-app +minikube ip +curl ip:port +kubectl logs deployment/app-challenge05 +kubectl logs deployment/consumer-challenge05 + +kubectl delete -f ./syncd/05/deployments/flask-app.yaml \ + -f ./syncd/05/deployments/consumer.yaml \ + -f ./syncd/05/services/flask-app.yaml \ No newline at end of file diff --git a/CLASE-05/challenge/05/deployments/consumer.yaml b/CLASE-05/challenge/05/deployments/consumer.yaml new file mode 100644 index 0000000..fb12771 --- /dev/null +++ b/CLASE-05/challenge/05/deployments/consumer.yaml @@ -0,0 +1,25 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: consumer-challenge05 + labels: + app: challenge05 + service: consumer +spec: + replicas: 1 + selector: + matchLabels: + app: challenge05 + service: consumer + template: + metadata: + labels: + app: challenge05 + service: consumer + spec: + containers: + - name: container-consumer + image: wyataco/challenge05-consumer:1.0 + imagePullPolicy: Never + ports: + - containerPort: 80 \ No newline at end of file diff --git a/CLASE-05/challenge/05/deployments/flask-app.yaml b/CLASE-05/challenge/05/deployments/flask-app.yaml new file mode 100644 index 0000000..aba6f1e --- /dev/null +++ b/CLASE-05/challenge/05/deployments/flask-app.yaml @@ -0,0 +1,26 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: app-challenge05 + labels: + app: challenge05 + service: web +spec: + replicas: 1 + selector: + matchLabels: + app: challenge05 + service: web + template: + metadata: + labels: + app: challenge05 + service: web + spec: + containers: + - name: container-flask-app + image: wyataco/challenge05-app:1.0 + imagePullPolicy: Never + ports: + - name: port-flask-app + containerPort: 8000 \ No newline at end of file diff --git a/CLASE-05/challenge/05/services/flask-app.yaml b/CLASE-05/challenge/05/services/flask-app.yaml new file mode 100644 index 0000000..73b2dfd --- /dev/null +++ b/CLASE-05/challenge/05/services/flask-app.yaml @@ -0,0 +1,15 @@ +apiVersion: v1 +kind: Service +metadata: + name: service-flask-app + labels: + app: challenge05 +spec: + type: NodePort + ports: + - name: flask-app + port: 80 + targetPort: port-flask-app + selector: + app: challenge05 + service: web