Dockerize an Angular Application using Nginx

Get Arrays
7 Sept 202356:41

Summary

TLDREn este video, Junior muestra cómo decorar una aplicación Angular, la cual es la que han estado construyendo y planean dockerizar. La aplicación, que incluye funcionalidades como actualizar información de perfil, cambiar contraseña, roles y permisos, así como la capacidad de gestionar clientes y facturas, se ha desarrollado desde cero. Seguidamente, Junior explica el proceso de Dockerización, que incluye la creación de un Dockerfile para la aplicación Angular, utilizando una imagen de Node.js y Nginx. Detalla los comandos necesarios para copiar archivos, instalar dependencias, y construir la aplicación. Además, aborda la importancia de especificar una versión de Node.js para evitar problemas de compatibilidad y cómo usar el archivo '.dockerignore' para excluir archivos no necesarios en la imagen de Docker. Finalmente, Junior ejecuta el comando 'ng build' para construir la aplicación y se topa con errores de presupuesto de paquete, los cuales resuelve ajustando la configuración en el archivo 'angular.json'. El video es una guía útil para desarrolladores que deseen empaquetar su aplicación Angular en un contenedor Docker.

Takeaways

  • 🛠️ Se discute cómo decorar una aplicación Angular y se menciona que se usará para dockerizar.
  • 🏗️ Se detalla cómo se construyó la aplicación desde cero, incluyendo todas las funcionalidades.
  • 📝 Se muestra cómo se puede actualizar información de perfil, notificaciones, actividad de la cuenta y cambiar la contraseña.
  • 🔄 Se explica cómo cambiar la autorización y el rol de usuario, y cómo esto afecta los permisos del mismo.
  • 🗑️ Se destaca la capacidad de eliminar permisos para clientes y usuarios si el rol cambia.
  • 🖼️ Se menciona la posibilidad de actualizar la información de la cuenta, incluida la imagen de perfil.
  • 👥 Se cubre cómo se pueden gestionar los clientes, incluida la adición y actualización de información de clientes.
  • 📋 Se aborda el tema de la creación y gestión de facturas, incluyendo la selección de clientes y la entrada de información.
  • 📂 Se indica que la aplicación fue diseñada para manejar clientes y facturas, y se sugiere que se dockerizará.
  • 📁 Se describe el proceso de creación de un Dockerfile para la aplicación, incluyendo la especificación de la versión de Node.js y la configuración de un servidor web Nginx.
  • 🚀 Se discute la importancia de la compatibilidad de las bibliotecas con el tiempo de ejecución de Angular IV y cómo usar el comando `ngcc` para asegurar esta compatibilidad.

Q & A

  • ¿Qué aplicación está utilizando Junior para demostrar cómo decorar una aplicación Angular?

    -Junior está utilizando una aplicación Angular que ha construido previamente y planea dockerizar. La aplicación permite a los usuarios actualizar su información de perfil, recibir notificaciones, cambiar su contraseña, actualizar su rol y permisos, y también tiene funcionalidades para manejar clientes y facturas.

  • ¿Por qué es importante especificar una versión de Node.js en el archivo Dockerfile?

    -Es importante especificar una versión de Node.js en el archivo Dockerfile para evitar que se utilice la última versión disponible, la cual podría contener cambios que rompan la aplicación. Es recomendable usar una versión conocida que sea compatible con la aplicación para mantener su estabilidad.

  • ¿Qué hace el comando 'npx ngcc' en el archivo Dockerfile?

    -El comando 'npx ngcc' es la Compiladora de Compatibilidad de Angular, que se utiliza para compilar bibliotecas publicadas en un formato heredado y hacerlas compatibles con el tiempo de ejecución de Angular Ivy. Esto asegura que los archivos generados por 'NG build' sean compatibles con la mayoría de los navegadores.

  • ¿Cuál es el propósito del archivo '.dockerignore'?

    -El archivo '.dockerignore' funciona similar al archivo '.gitignore', y se utiliza para definir los archivos y carpetas que no deben ser copiados dentro del contenedor de Docker al crear la imagen del contenedor. Esto mejora la eficiencia del proceso de construcción al excluir archivos grandes o irrelevantes.

  • ¿Cómo se aborda el problema de los errores de dependencias externas en la aplicación Angular?

    -Para solucionar los errores de dependencias externas, se debe permitir explícitamente en el archivo 'angular.json' las dependencias comunes de JavaScript que la aplicación utiliza. Esto se hace agregando los nombres de las dependencias en el arreglo de 'allowedCommonJsDependencies'.

  • ¿Qué es la configuración de 'budgets' en el archivo 'angular.json' y por qué es importante?

    -La configuración de 'budgets' en el archivo 'angular.json' establece un límite de tamaño para los paquetes o bundles de la aplicación. Esto es importante para monitorear y controlar el tamaño de los archivos que se cargan inicialmente, lo que puede afectar directamente el rendimiento y la experiencia del usuario.

  • ¿Cómo se definen las variables de entorno para diferentes entornos de trabajo en Angular?

    -Se crean archivos de entorno separados, como 'environment.ts' para el entorno de desarrollo y 'environment.prod.ts' para el entorno de producción. Estos archivos contienen variables específicas para cada entorno y se selecciona el archivo correcto en función de la configuración de compilación de Angular.

  • ¿Cómo se soluciona el problema de las rutas en una aplicación de página única (SPA) cuando se refresca la página?

    -Para solucionar este problema, se configura el servidor web (en este caso, Nginx) para que siempre sirva el archivo 'index.html' cuando no encuentra la ruta solicitada. Esto permite que Angular maneje la navegación en el lado del cliente y no interrumpa la experiencia del usuario al refrescar la página.

  • ¿Por qué se utiliza un archivo 'default.conf' personalizado en el archivo Dockerfile?

    -Se utiliza un archivo 'default.conf' personalizado para incluir la configuración específica que se desea aplicar al servidor Nginx dentro del contenedor de Docker. Esto evita la necesidad de modificar manualmente el archivo de configuración dentro del contenedor y permite que la configuración sea parte del proceso de construcción de la imagen Docker.

  • ¿Cómo se puede implementar la aplicación Angular en un servidor utilizando Docker?

    -Se puede crear un archivo Dockerfile que defina los pasos para construir la imagen de Docker de la aplicación Angular, incluyendo la especificación de la versión de Node.js, la instalación de dependencias, la compilación de la aplicación y la configuración del servidor web. Luego, se utiliza 'docker-compose' o los comandos de Docker para construir la imagen y ejecutar el contenedor de la aplicación en el servidor.

  • ¿Cómo se puede acceder a los registros (logs) de un contenedor de Docker?

    -Se puede utilizar el comando 'docker logs' seguido del ID o el nombre del contenedor para acceder a los registros de ese contenedor. Esto permite a los desarrolladores y administradores verificar el funcionamiento y diagnósticar problemas en el contenedor de Docker.

Outlines

00:00

😀 Introducción y descripción de la aplicación Angular

Junior presenta el tutorial sobre cómo decorar una aplicación Angular. Explica que la aplicación ha sido desarrollada desde cero y que se usará para dockerizar. Detalla las funcionalidades de la aplicación, como la actualización de información de perfil, gestión de notificaciones, cambio de contraseña y autorización, y cómo se pueden modificar los roles y permisos de usuario. Además, menciona la posibilidad de habilitar la autenticación de múltiples factores y la gestión de clientes e información de cuenta.

05:02

🛠 Creación del Dockerfile para la aplicación Angular

Se inicia con la creación de un Dockerfile para la aplicación, explicando la necesidad de una imagen de Node.js y la copia de archivos dentro de un servidor web Nginx. Destaca la importancia de especificar una versión de Node.js conocida para evitar problemas de compatibilidad. Describe los comandos para copiar archivos, instalar dependencias de Node.js y ejecutar la compilación de Angular con npx ngcc, que es esencial para la compatibilidad de librerías con el tiempo de ejecución de Angular.

10:04

📄 Configuración del Dockerignore y construcción de la imagen

Se detalla la creación de un archivo .dockerignore para evitar la copia de archivos no deseados en el contenedor, similar al .gitignore. Luego, seguidamente, se ejecuta el comando npm run build para construir la aplicación, lo que resulta en la creación de la carpeta 'distribution' con los archivos estáticos generados. Se describe el proceso de copiado de estos archivos en el servidor Nginx y la exposición del puerto 80 para servir los archivos estáticos.

15:05

🚀 Ejecución del comando ng build y solución de problemas

Junior ejecuta el comando ng build y aborda el problema de 'no meeting the budget', que se refiere a la configuración de tamaño máximo de los archivos generados. Cambia la configuración en el archivo angular.json para aumentar el tamaño máximo del archivo. Posteriormente, se describe la estructura de la carpeta 'distribution' y cómo los archivos generados serán copiados en el servidor Nginx.

20:06

🔧 Configuración de entornos y variables de entorno en Angular

Se explica cómo crear archivos de entorno en Angular para diferentes configuraciones de desarrollo y producción. Se enfoca en la importancia de la bandera de producción y la URL base de la API. Se muestra cómo se utilizan estas variables en los servicios de la aplicación y cómo se configuran en el archivo angular.json para el intercambio de archivos de entorno según el entorno de producción o desarrollo.

25:06

🖥️ Creación del archivo docker-compose.yml

Se detalla la creación del archivo docker-compose.yml, donde se definen los servicios, la construcción de la imagen, la asignación de puertos y la red para la aplicación. Se resalta la importancia de este archivo para la ejecución y gestión de los contenedores de Docker.

30:09

🚧 Ejecución del contenedor y solución de errores

Se ejecuta el comando docker-compose up para construir la imagen y ejecutar el contenedor. Se aborda el problema de los errores y advertencias en la aplicación y cómo se resuelven al permitir las dependencias comunes de JavaScript en el archivo angular.json. Se menciona la necesidad de reiniciar el contenedor después de realizar cambios en la configuración.

35:10

🔄 Actualización y prueba de la aplicación en Docker

Seguidamente, se prueba la aplicación desplegada en Docker, accediendo a través de la dirección IP del host y confirmando que la aplicación se ejecuta correctamente. Se muestra cómo se puede interactuar con la aplicación, incluyendo la actualización de información de perfil y la gestión de clientes.

40:12

🛠️ Solución del problema de 404 no encontrado en la aplicación

Se identifica el problema de los errores 404 que ocurren al actualizar la página en una ruta específica en una aplicación de página única (SPA). Se explica que este es un problema común en frameworks JavaScript y se ofrece una solución sencilla para Nginx, que consiste en servir siempre el archivo index.html. Se demuestra cómo entrar en el contenedor en ejecución y modificar la configuración de Nginx para solucionar este problema.

45:13

📝 Edición de la configuración de Nginx y reinicio del contenedor

Se describe el proceso de edición de la configuración de Nginx dentro del contenedor y el reinicio del contenedor para aplicar los cambios. Se destaca la importancia de la directiva 'try_files' en la configuración de Nginx, que asegura que se sirva el archivo index.html en lugar de devolver un error 404. Además, se muestra cómo copiar una configuración predefinida en el Dockerfile para evitar la necesidad de editarla manualmente en el contenedor.

50:14

🔄 Recompilación de la imagen y confirmación del funcionamiento

Seguidamente, se recomienda la recompilación de la imagen de Docker y se ejecuta el comando para construir y reiniciar el contenedor. Se confirma que la aplicación funcione correctamente después de los cambios, evitando el error 404 al actualizar la página en cualquier ruta. Se ofrece ayuda para configurar un servidor Apache similar si es requerido.

55:15

📝 Finalización del tutorial y pruebas adicionales

Finalmente, se concluye el tutorial asegurándose de que la aplicación funcione correctamente en Docker, incluyendo la creación y edición de facturas y la actualización de información de clientes. Se invita a los espectadores a realizar pruebas en su propio entorno de desarrollo utilizando servicios en la nube como AWS o Microsoft Azure, y a ponerse en contacto a través de Discord para cualquier pregunta o asistencia adicional.

Mindmap

Keywords

💡Docker

Docker es una plataforma de contenedores que permite a los desarrolladores empaquetar, distribuir y ejecutar aplicaciones de manera eficiente y segura. En el video, se utiliza Docker para 'dockerizar' una aplicación Angular, lo que implica empaquetar la aplicación en un contenedor para su fácil despliegue y ejecución en diferentes entornos.

💡Angular

Angular es un framework de desarrollo web de código abierto que se utiliza para construir aplicaciones web de una sola página. En el video, la aplicación que se dockeriza es una aplicación Angular que incluye funcionalidades como la actualización de información de perfil, gestión de clientes y facturación.

💡Contenedores

Un contenedor en Docker es una unidad estándar que contiene todo lo necesario para que una aplicación funcione, incluyendo el código, las dependencias, las bibliotecas y otros archivos. En el contexto del video, los contenedores permiten que la aplicación Angular se ejecute de manera aislada y segura sin depender de la configuración del sistema anfitrión.

💡Nginx

Nginx es un servidor web de alto rendimiento广泛用于 web applications y servicios de contenido estático. En el video, se utiliza Nginx como un servidor web para servir los archivos estáticos de la aplicación Angular después de que se haya construido y empaquetado en un contenedor Docker.

💡npm

npm (Node Package Manager) es un administrador de paquetes para Node.js que permite a los desarrolladores instalar y gestionar las dependencias de sus proyectos. En el video, se utiliza npm para instalar las dependencias de la aplicación Angular y ejecutar la compilación de la aplicación con el comando 'npm run build'.

💡Dockerfile

Un Dockerfile es un script que contiene las instrucciones para construir una imagen de Docker. En el video, se crea un Dockerfile para definir el proceso de construcción de la imagen de Docker de la aplicación Angular, incluyendo la especificación de la versión de Node.js, la instalación de dependencias y la configuración del servidor Nginx.

💡Docker Compose

Docker Compose es una herramienta para definir y ejecutar aplicaciones de múltiples contenedores en Docker. En el video, se utiliza Docker Compose para crear un archivo de configuración que simplifica el lanzamiento y la gestión de la aplicación Angular en un entorno de contenedores Docker.

💡ngcc

El comando 'ngcc' es una herramienta incluida en Angular que se utiliza para compilar bibliotecas de Angular publicadas en un formato heredado, asegurando su compatibilidad con el tiempo de ejecución de Angular. En el video, se ejecuta 'npx ngcc' para procesar las dependencias y garantizar que la aplicación sea compatible con el formato de compilación de Angular.

💡Single Page Application (SPA)

Una Single Page Application (SPA) es un tipo de aplicación web que carga una única página y actualiza dinámicamente el contenido a medida que el usuario interactúa con la aplicación, en lugar de recargar la página completa. En el video, la aplicación Angular es un ejemplo de SPA, lo que requiere una configuración específica en el servidor Nginx para manejar correctamente la navegación en el cliente.

💡Environment Variables

Las variables de entorno son pares de valores de nombre que se utilizan para configurar la ejecución de una aplicación. En el video, se crean archivos de configuración de entorno para la aplicación Angular, permitiendo cambiar la configuración de la aplicación según el entorno de ejecución, como el entorno de producción o desarrollo.

💡Dockerignore

Un archivo .dockerignore es similar a un archivo .gitignore y se utiliza para especificar qué archivos o patrones de nombres de archivo se deben excluir del proceso de copia al crear una imagen de Docker. En el video, se menciona la creación de un archivo .dockerignore para evitar incluir archivos no necesarios, como el directorio node_modules, en la imagen de Docker de la aplicación.

Highlights

Junior muestra cómo decorar una aplicación Angular, la cual previamente construyeron y planean dockerizar.

La aplicación permite actualizar información de perfil, notificaciones y actividad de la cuenta.

Se puede cambiar la contraseña y la autorización, incluyendo el rol de usuario.

Se discute la importancia de las funciones de administración de permisos y la capacidad de eliminar permisos de clientes y usuarios.

Se abordan las funcionalidades de autenticación, incluyendo el registro de inicios de sesión y la autenticación de múltiples factores.

Se muestra cómo actualizar la foto de perfil y cómo afecta la barra de navegación.

Se explica cómo gestionar clientes y crear y actualizar información de facturación.

Se detalla el proceso de creación de un archivo Docker para la aplicación Angular.

Se discute la especificación de una versión de Node.js para evitar problemas de compatibilidad con versiones futuras.

Se menciona el uso de la imagen Alpine de Node.js para un contenedor más ligero.

Se define un directorio de trabajo y se copian los archivos package.json y package-lock.json.

Se instalarán las dependencias de Node.js y se ejecutará ngcc para compatibilidad con Angular Ivy.

Se describe el uso de un archivo .dockerignore para excluir archivos y carpetas grandes que no necesitan ser copiados en el contenedor.

Se ejecuta el comando ng build para crear archivos estáticos y se aborda el manejo de errores relacionados con el tamaño del paquete.

Se crean archivos de entorno para diferentes configuraciones de desarrollo y producción.

Se utiliza el archivo angular.json para configurar el reemplazo de archivos de entorno durante la compilación.

Se resalta la importancia de configurar correctamente las variables de entorno en los servicios de la aplicación.

Se crea un archivo docker-compose.yml para orquestar el contenedor de la aplicación y se explica su estructura.

Se aborda la solución de problemas comunes con aplicaciones de página única al refrescar la página o acceder a rutas específicas.

Se muestra cómo corregir la configuración de Nginx para servir correctamente las aplicaciones de Angular.

Se discute la implementación de configuraciones de Nginx dentro del propio archivo Docker para evitar la necesidad de modificarla manualmente.

Transcripts

play00:00

what's going on guys this is Junior here

play00:02

and today I'm going to show you how to

play00:03

decorize an angular application this is

play00:06

the application that we have built so

play00:08

far and it's the one that we're gonna

play00:10

use to dockerize and if you want to know

play00:12

how we actually build this application

play00:14

you can just check out the videos on the

play00:16

channel then you will know how we

play00:18

started working on this application and

play00:20

how we built it from scratch literally

play00:21

adding all the functionalities that you

play00:24

see here so I'm in my profile right now

play00:26

and I can update my information if I

play00:29

click here I can just change anything

play00:30

that I want here and then I can update

play00:32

it you can see that I have a

play00:33

notification and then the account

play00:35

activity is popping up here and I can

play00:37

also change my password give the current

play00:40

password and pass in a new password I

play00:42

can change my authorization so I can

play00:44

change my role so if I change my role to

play00:46

admin for example and then I click

play00:48

update you will see that my rule will be

play00:50

updated and also the permissions will

play00:52

change and if you notice you see that I

play00:54

don't have the delete permission for

play00:56

customers and users back to rule

play00:58

sysadmin which is the highest permission

play01:00

and then I saved that information again

play01:03

then you'll see that my permission will

play01:05

be updated you can see that I have the

play01:07

delete permission so I can delete

play01:08

customer and I can delete user and I can

play01:10

also update my account information so if

play01:12

my account is locked and if it's active

play01:14

and also authentication so if I want to

play01:16

show the logs as you can see here I can

play01:19

just click on this checkbox and it will

play01:21

disappear or appear and I can also

play01:23

enable multi-factor authentication so if

play01:25

I enable multi-factor authentication

play01:27

when I'm going to log in it's gonna send

play01:29

me a text message with a code that I'll

play01:31

need to put in but I'm going to go ahead

play01:33

and disable that because I wanna I don't

play01:34

want to have to go through this whenever

play01:36

I'm logging in and I can also update my

play01:38

profile picture so if I change this

play01:40

picture here it will change here as well

play01:42

as in the nav bar and also if I go back

play01:44

to the home page I can manage all of

play01:46

these customers so I can go to this

play01:48

first customer for example then I can

play01:50

update their information if I need to I

play01:52

can add a new customer so I can do new

play01:54

customer and then I can pass in the

play01:56

customer information I can see all the

play01:58

customers again and I can sort them and

play02:01

I can also add a new invoice you know I

play02:04

can select the customer and then pass in

play02:06

the information the data Etc and I can

play02:09

also see all of the invoices as of right

play02:11

now I don't have any invoice so it's an

play02:13

application that we build to manage

play02:15

customers in their invoices and we can

play02:17

also manage our account and that's what

play02:19

I showed you in the beginning so we can

play02:21

go here and then manage our account so

play02:23

that's the application that we're gonna

play02:24

be dockerizing so let's go ahead and

play02:26

work on that right now so let's go back

play02:28

to the code of the front end and the

play02:31

first thing we need to do is to create a

play02:33

Docker file so I'm going to right click

play02:35

here or you can click on this icon right

play02:37

here and then create a new file so here

play02:39

we're going to create the docker file so

play02:41

Docker file okay and for the docker file

play02:45

it's actually going to be pretty simple

play02:46

because we're just going to need a node

play02:48

image and then copy everything inside of

play02:51

a nginx web server so I'm going to see

play02:53

from we want to get node if you want to

play02:56

know what version of node that you want

play02:58

to have here you can just Google it and

play03:00

see what the latest version is or you

play03:02

can just leave node like if you leave it

play03:04

like this it will just get to the latest

play03:05

version which is fine in a lot of cases

play03:08

but the reason that you might not want

play03:10

to do this is because if you keep this

play03:13

file like this so the docker file if you

play03:16

just skip it with just from node which

play03:18

means every time it's going to get the

play03:20

latest version of node then it might

play03:22

break something in your application so

play03:23

if there is a new version of node.js and

play03:26

there is breaking changes then it's

play03:27

going to break your application because

play03:29

it's gonna get the latest version so

play03:31

it's best to specify a version that you

play03:33

know your application works with just

play03:35

fine so that you don't have to worry

play03:37

about a new version breaking your

play03:38

application and if you just want to know

play03:40

what you need to do here I can just go

play03:43

back and then I can just say node.js

play03:46

just Google it and then go to the

play03:48

official node version and you can see

play03:49

it's 18 17 1 which is the long term

play03:53

support so we can just pass in this

play03:55

number as the version of node that we

play03:57

want to have in our application because

play03:58

that's the version that I have in my

play04:00

computer and I know that with this

play04:01

version the application is working just

play04:03

fine there's nothing and that is broken

play04:05

okay so that's the that's usually what

play04:07

you want to do you want to specify the

play04:09

version that you know your application

play04:10

works with just fine so that later

play04:13

version of node doesn't introduce

play04:15

breaking changes on your application so

play04:17

now we can just say we know that our

play04:19

application is going to run with version

play04:22

18.17.1 and we can get an Alpine version

play04:26

of that which is just going to be like a

play04:28

smaller build for that particular image

play04:31

and then we're gonna assign it as a

play04:33

build okay so we're just defining a

play04:35

reference to this entire thing so that

play04:37

we can just copy the files that we need

play04:39

so very similar to what we did in the

play04:41

back and then I'm going to define a

play04:43

working director so I'm going to see uh

play04:45

word der and then I'm just gonna Define

play04:46

this as app and the reason I like to

play04:49

define a working directory is because if

play04:51

I need to go inside of the running

play04:53

container then I know exactly

play04:55

um what folder I need to go to to see

play04:57

the files that I'm going to copy inside

play04:59

and then here we're just gonna say uh

play05:01

after that we want to copy the

play05:04

package.json file so I'm going to say

play05:06

package that and then we're going to put

play05:08

a well I have to put a star first

play05:10

because we also need the lock file and

play05:12

then that Json so it's going to copy

play05:14

both the packet.json file in a package

play05:16

Dash lock file so this other file here

play05:19

this one right okay maybe I should just

play05:21

leave this open in this situation and

play05:23

then we're just gonna say that for slash

play05:25

which means it's going to copy it inside

play05:26

of this working directory because

play05:28

everything we do now from this point

play05:30

forward like everything we copy they

play05:32

will go inside of the working directory

play05:34

that we Define and then after that we're

play05:36

gonna run npm install so that we can

play05:39

install all of the uh node module

play05:42

dependencies and then after that there's

play05:45

a very important command that we need to

play05:46

run and that's the npx ngcc and then

play05:51

we're gonna say properties and I want

play05:54

the

play05:55

es2023 okay so you're going to see 2023

play05:58

and browser module Main and then we want

play06:04

to do first only and also dash dash

play06:09

create dot IV

play06:13

that entry that points okay and I have

play06:17

to explain what this command is doing

play06:19

but before I do that let me start from

play06:22

the beginning so we're saying we need

play06:24

the node version 1871 Alpine which is

play06:27

just a smaller bundle of this version of

play06:30

node and then we're going to give it an

play06:31

alias which is going to be built the

play06:33

reason we're going to give it an alias

play06:35

is because we're gonna ditch this part

play06:38

of the building of the image and then

play06:40

just copy the result of this entire

play06:42

process so we're gonna need this name to

play06:45

reference this build and then copy the

play06:48

file that we want and then put it in

play06:50

another nginx image or container

play06:53

whenever we run the container because

play06:54

ultimately we don't want a node image as

play06:57

the base of this image but we want an

play06:59

nginx okay so maybe when it's done I'm

play07:02

gonna go over it again then it's gonna

play07:03

make more sense so we say get us this

play07:05

version of node we're gonna give it an

play07:07

alias of build we're gonna Define this

play07:09

directory which is just a folder we're

play07:11

gonna copy the package.json also the

play07:14

package lock.json and to this app that's

play07:17

what this dot forward slash means and

play07:20

then after we have the packet.json files

play07:22

and the package Dash lag file we're

play07:24

gonna install the dependencies so we're

play07:26

gonna run npm install and then after we

play07:28

do that we're gonna run this command and

play07:30

this is the command that I really need

play07:31

to go over so that you understand what

play07:34

it's doing now you don't really need to

play07:36

do this but it's just the safest as of

play07:38

right now so you're in a better position

play07:39

when you pass in this command then when

play07:42

you do not and so what exactly is this

play07:45

comment doing so what this is doing is

play07:47

fairly simple but it's just a very long

play07:49

command so we're running so that's

play07:51

coming from Docker so this run here so

play07:54

all the ones in blue and capital letters

play07:56

they're a keyword coming from Doc so

play07:58

Docker is going to run this command and

play08:00

the MPX is also coming from the node

play08:03

package manager it actually stands for

play08:05

the node package executor so what this

play08:08

means is it's simply a package Runner so

play08:10

everything that exists in the npm

play08:13

registry we can just execute that using

play08:16

the MPX and what we want to execute in

play08:19

this case is the ngcc so so far so good

play08:22

we're invoking this node package

play08:24

executor which is going to allow us to

play08:26

execute some command or execute some

play08:28

package that is available in the npm

play08:31

register and in this case that's the

play08:33

ngcc so you can already see the NG here

play08:36

which gives you a hint about something

play08:38

being of the angular CLI and if I put a

play08:41

space here you can see that just that's

play08:43

just the engine command and then CC

play08:45

which stands for the angular so the NG

play08:48

here you can just see that's the angular

play08:49

command or the CLI prefix and the CC is

play08:53

the compatibility compiler for angular

play08:55

so the ngcc which is the angular

play08:58

compatibility compiler is a tool used to

play09:01

compile libraries that have been

play09:03

published in the Legacy format and you

play09:05

use this when these libraries are not

play09:08

compatible with the angular IV runtime

play09:10

so that you can format them to uh to a

play09:13

format that is compatible with the IV

play09:15

that you can see that I'm mentioning

play09:18

here now I don't want to get into all

play09:20

these details of the IV and all that but

play09:22

I really want you to understand what

play09:24

this means and why we need to do this so

play09:26

that's why this two parts are doing and

play09:29

the properties flag which you can see

play09:31

here because you have the dash dash so

play09:33

that means this is a flag it's just

play09:35

specifying in the format so all the

play09:38

packages will be processed in this es23

play09:40

which is just the ecmascript 2023 which

play09:43

is just a version of JavaScript so we

play09:45

want the 2023 and the browser module as

play09:48

Main and the first only flag means that

play09:51

ngcc is going to process the first

play09:54

property that it finds in the

play09:55

packet.json otherwise it will just

play09:57

process everything all the format in

play10:00

JavaScript so things like es2015 or esm

play10:03

2015 like there's a default value that

play10:06

it will use so that's why we're

play10:07

overriding it with this dash dash first

play10:09

only in this create IV entry point

play10:12

that's just gonna tell the ngcc command

play10:15

to create new properties for the IV

play10:17

generated entry instead of overriding

play10:19

the previous one so that's what this

play10:21

flag is doing and all this coming is

play10:24

doing as a whole is to make sure that it

play10:26

takes non-iv libraries and generate

play10:29

files that ivy can understand and this

play10:31

is really just a browser thing so that

play10:33

the Javascript file generated when we

play10:35

run NG build to build this application

play10:37

so that they can be compatible with most

play10:39

browsers so that's why we're doing this

play10:41

command here but don't worry too much

play10:43

about it just understand that it's

play10:45

somewhat important so far at the time of

play10:48

recording this video which is in

play10:49

September 2023 then you it's safer to do

play10:53

this than not to do and then we want to

play10:55

copy everything else so we're going to

play10:57

say copy that and then dot so copy all

play11:00

the rest of all the other files so all

play11:02

of this is going to be copied inside of

play11:03

the app folder and then lastly we're

play11:06

gonna run npm oops not in npm run build

play11:12

so you might be asking where is this

play11:14

comment coming from so if I open the

play11:16

packet.json you can see when we run the

play11:19

npm Run build then it's going to run the

play11:22

NG build which is going to build the

play11:23

application it's going to create a

play11:25

folder named secure Capital so whatever

play11:27

the name of the application is going to

play11:29

create that folder here and then it's

play11:30

going to put all the build file inside

play11:32

of this folder by this name and I'm

play11:34

going to run this command uh in just a

play11:36

moment so that you can see the result of

play11:37

it so that is the first part of the

play11:40

build that's what you call a multi-stage

play11:43

build uh Docker file so after that what

play11:45

we want to do we want to go and get an

play11:49

image for nginx so we're going to say

play11:51

nginx and then we want to get the stable

play11:54

version of nginx and then we want to

play11:56

copy from so we're going to copy from

play11:59

what we defined up there so we're going

play12:01

to say from the build because everything

play12:03

we did up until this point we don't

play12:05

really need it anymore we just need the

play12:07

result of running this command so we're

play12:09

gonna see we're gonna copy this time

play12:11

we're copying from build so copying from

play12:13

everything we just did here and we want

play12:15

to copy from inside of the app folder we

play12:18

want to copy everything that we have

play12:21

inside of this name here and this is all

play12:24

going to make sense in a second and we

play12:26

want to copy this inside of the USR

play12:30

share and then NG next

play12:33

forward slash HTML so for the nginx web

play12:36

server you want to serve your static

play12:38

files inside of this folder so that's

play12:41

nginx stuff so this is coming from nginx

play12:43

and we're just copying all of the file

play12:45

that resulted from this build that we

play12:48

know that will be located inside of the

play12:50

secret Capital app how do we know that's

play12:52

going to be the folder because when you

play12:53

run NG build it's going to look at the

play12:55

name of the project and then put all the

play12:57

files inside of this folder so we go

play12:59

inside of the app that's what we're

play13:01

working with from the build that's what

play13:03

we Define from build and then copy

play13:05

everything and then place them inside of

play13:07

the nginx folder for serving static

play13:10

resources in this case that's USR share

play13:12

nginx HTML and then lastly we want to

play13:15

expose Port 80. oops expose okay so you

play13:20

know this is a web server serving HTTP

play13:23

and that is done well it's not always

play13:25

done over Port 80 but the default is

play13:27

0.80 and that's just to serve the static

play13:30

files that are going to be generated

play13:31

from running npm run build so hopefully

play13:34

this is coming together and we're gonna

play13:36

continue in the next lecture so you guys

play13:38

know that inside of the docker container

play13:41

we're going to be copying everything as

play13:43

you can see on line six here but we know

play13:45

that we never want to copy this big huge

play13:47

file that contains all of our

play13:49

dependencies and the dependencies of

play13:51

these dependencies because this file is

play13:52

huge that's part of the reason we have

play13:55

the packet.json file because we Define

play13:57

all of our dependencies here so that we

play13:59

can install them again with npm install

play14:01

so what that means is that whenever

play14:03

we're gonna copy everything over inside

play14:05

of the container or to create the image

play14:06

we know that we don't want to copy this

play14:08

node modules folder so what we're going

play14:11

to do is to Define another file called

play14:13

that Docker oops

play14:15

Docker ignore so this file is similar to

play14:19

a git ignore file and here we're going

play14:22

to Define everything we don't want to be

play14:24

copied whenever we're running this copy

play14:26

command so whenever we're going to copy

play14:27

stuff from our local computer to the to

play14:30

inside of the container then it's going

play14:32

to look at this file and then it's going

play14:33

to skip everything that we're defined

play14:35

inside of this file so for example node

play14:38

underscore modules will go into that

play14:40

file because we never want to copy this

play14:42

huge folder inside of our container

play14:45

because whenever we run npm install then

play14:47

it's gonna just reinstall them again

play14:49

reaching out to the internet and then

play14:51

recreate this folder so we never want to

play14:53

copy this folder anywhere we only want

play14:55

to run npm install and then that's going

play14:57

to read our Json file or the packet.json

play15:00

file and it's going to install all of

play15:01

these dependencies so we're going to

play15:03

pass this in there there's other things

play15:04

that you can pass in there so things

play15:06

like that git or the license or readme

play15:09

file so everything that you really don't

play15:11

want to copy over to The Container then

play15:14

you would pass them inside of this file

play15:16

so what I'm going to do is to just give

play15:17

give you a standard DACA ignore file

play15:20

that you can use for node.js so I'm

play15:22

going to just select this and then paste

play15:24

it in here and all this is doing is it's

play15:26

just passing in the files and folders

play15:29

that we never want to copy over inside

play15:31

of the container so you can see

play15:32

distribution node module that git folder

play15:35

readme license Etc and you can put

play15:38

whatever really you want inside of this

play15:39

so for example if I didn't want to copy

play15:41

this editor config file I could just

play15:43

pass it in here so this is no big deal

play15:45

so that's the docker ignore file really

play15:47

very important because otherwise

play15:49

whenever we're gonna try to build an

play15:51

image from this background file copying

play15:53

this huge file is going to make it slow

play15:55

so you might think that there's

play15:57

something wrong with your Docker file

play15:59

but in reality it's just this file is so

play16:01

big and we never want to do that so

play16:03

that's what this is doing okay so you

play16:05

can just keep this for all of your node

play16:07

projects you just paste it in and then

play16:10

you should be good to go whenever you're

play16:11

creating a diagram so that's it for the

play16:14

docker ignore file it's similar to a git

play16:16

ignore file so this file that

play16:18

here so everything that we don't want to

play16:20

push to a git repository we're just

play16:22

going to place it in here that's

play16:23

literally the same idea but for Docker

play16:26

as you can see okay so that's what we

play16:27

have to do for the docker ignore file

play16:29

the next thing that I want to show you

play16:30

is what's going to happen when we run

play16:32

this NG or npm run build command Okay I

play16:36

want to show you what's going to happen

play16:38

to the application whenever we run this

play16:40

command so that you understand why we're

play16:42

copying from this folder and then

play16:45

placing everything inside of the nginx

play16:46

folder so let's go ahead and work on

play16:48

that next so I'm going to go ahead and

play16:50

bring up the terminal and I'm gonna do

play16:52

Ctrl C I'm also going to show you how

play16:54

we're going to get rid of all of these

play16:56

warnings because I know I've been seeing

play16:58

this for a while now but before I'm

play17:00

gonna clear the screen and you can

play17:02

either do NG build that will do the same

play17:05

thing and the reason this will work is

play17:07

because we have the angular CLI

play17:09

installed so if you go inside of the

play17:11

packet.json and we go to our script so

play17:13

if you do NG build then you will just do

play17:16

this run this build or you can do npm

play17:19

run build as the same thing so let's go

play17:21

back to the terminal and we're gonna do

play17:23

NG build or npm run build it's the same

play17:26

thing so I'm gonna run this and we're

play17:28

just gonna give it a second to finish

play17:29

and it's over but it wasn't successful

play17:32

okay so you can see here it tries to

play17:35

generate the bundles and then at the

play17:37

very bottom it says we didn't meet the

play17:39

budget so the maximum budget and what

play17:42

this error means is that we are watching

play17:44

how Big the bundles are and there's a

play17:47

default configuration in the angular

play17:49

application that sets the size of the

play17:51

bundle to a certain number and what that

play17:53

means is that whenever we're gonna build

play17:54

the project like we're doing here with

play17:57

the NG build if the bundles are bigger

play17:59

than what we Define in the configuration

play18:01

then it's going to give us this message

play18:02

so this is just a nice way that you can

play18:05

keep watch on your angular application

play18:07

bundle size okay so let's go ahead and

play18:09

just change that real quick so if I go

play18:11

back to the angular application I can go

play18:14

inside of the angular.json file and if I

play18:17

scroll down or there it is so you can

play18:19

see here we have this budget it's an

play18:22

array and you can Define the initial so

play18:24

the initial is what fails because it's

play18:26

1mb I think it was bigger than that yeah

play18:29

so budgets 1 MB but was not met by

play18:32

50.58 kilobytes so that means it was

play18:35

more than one so what we can do I mean

play18:37

this isn't really a big deal for me but

play18:39

some people are really careful about how

play18:41

big the bundle size are because that can

play18:43

affect their performance but in my case

play18:44

I don't really care about this too much

play18:46

so I'm gonna make sure everything is

play18:47

like at least two so I'm gonna change

play18:49

everything here to 2 megabyte okay

play18:52

because I don't really care too much

play18:54

about this budget thing or if you want

play18:56

you can just get rid of it all together

play18:57

if your application is that big but it's

play19:00

a good thing to use if you have a big

play19:02

team and A lot of people are working on

play19:05

the same application so that you make

play19:06

sure that you control to some degree the

play19:09

performance of your application by

play19:11

looking at the bundle size because the

play19:12

bundle size is important for the initial

play19:14

load of the application whenever the

play19:16

application is loading the bra is going

play19:18

to download all these bundles so if

play19:20

these bundles are too big then the app

play19:22

is going to be slow because the browse

play19:23

is going to need to take more time to

play19:25

download these bundles and if the user

play19:27

internet is not very good then it can

play19:30

take a very long time and that's just

play19:32

gonna make the user experience even

play19:33

worse so that's what this is so now

play19:35

let's go back and just run this command

play19:37

again gonna bring back the terminal

play19:39

gonna clear the screen and then run NG

play19:42

building and just give it a second to

play19:44

finish okay so it's over and this time

play19:46

you can see that everything was

play19:47

successful and if we go back now to the

play19:50

application and let's close all these

play19:53

files and go back here you can see now

play19:55

we have this distribution so this

play19:57

distribution folder was created and if

play19:59

we open it we have a folder by the same

play20:01

name of the application so you can see

play20:03

secure capital and then it has all of

play20:05

the static files that were generated so

play20:08

these are the files that we're going to

play20:09

copy if I open the docker file so we're

play20:13

going to copy all of these files as you

play20:15

can see here inside of the nginx HTML

play20:17

folder and also we need to pass in

play20:19

distribution here so the IST forward

play20:22

slash okay because they're inside of

play20:24

this distribution folder inside of this

play20:26

secret Capital which is the name of the

play20:28

application like this name that is

play20:30

defined in the packet.json file this

play20:32

name right here okay so these are the

play20:34

same right here okay you can see we are

play20:36

targeting these files we're copying them

play20:39

over to the nginx server so what this

play20:41

means is that whenever we complete all

play20:43

of this we get node we create this

play20:45

folder copy the package.json file

play20:47

install of the dependencies run this

play20:50

command for compatibility copy

play20:52

everything else and then run the npm Run

play20:54

build which is gonna do exactly NG build

play20:57

and it's going to create these files for

play20:59

us and then we're gonna say from this

play21:02

first page so from all of this which

play21:05

will result in this folder being created

play21:07

with these files we're gonna copy

play21:09

everything from the app that

play21:10

distribution so the app is the working

play21:13

directory because that's where

play21:14

everything is copied and we want to go

play21:15

to distribution secure capital which is

play21:18

going to give us access to all these

play21:19

files and then we're going to copy

play21:21

everything over to the nginx HTML folder

play21:24

which is where we serve static file in

play21:26

the nginx server and then one last thing

play21:29

we can do so you can see here we have

play21:32

this NG build we can also pass in a

play21:34

configuration for production so I can

play21:37

copy this and then paste it here and

play21:39

then pass in production so whenever we

play21:42

run NG build you can add as many of

play21:44

these scripts as you want but since I'm

play21:46

going to be running NG build or npm run

play21:48

build for this script then it's going to

play21:50

run this command which in this case will

play21:52

set the configuration to product and I'm

play21:54

going to show you why we're sending this

play21:55

to production actually this can be any

play21:57

name that you want it doesn't have to be

play21:59

production but I'm going to show you how

play22:00

we're going to use this in an

play22:01

environment because we can have

play22:03

different environments whenever we're

play22:04

building the application either for

play22:06

deployment for production or deployment

play22:08

for development whatever the case might

play22:10

be and angular can switch different

play22:11

environment files and then apply the

play22:14

properties in these files whenever you

play22:16

run the application in a specific

play22:17

environment so that's what I'm going to

play22:19

show you how to do next so what I'm

play22:20

going to do is I'm gonna just collapse

play22:24

this actually I can just delete this

play22:26

folder altogether so let's just go here

play22:29

and I'm going to do remove

play22:32

recursive Force verbose so that I can

play22:36

see everything and I'm gonna pass in

play22:38

distribution so that's going to remove

play22:39

this folder and everything inside it so

play22:41

I'm going to press enter and you can see

play22:43

it's removed clear the screen and if I

play22:45

go back this folder is removed from here

play22:47

so what I'm gonna do is I'm gonna go

play22:49

inside of the source folder and then I'm

play22:51

going to create another folder and then

play22:52

I'm going to call it environment

play22:55

so before by default whenever you use

play22:57

the angular CLI to create an angular

play22:59

application this folder would be created

play23:01

by default like it would be here by

play23:03

default with the angular CLI but for

play23:05

some reason they don't do that anymore

play23:07

but you can still use it as you can see

play23:09

that I'm doing here I'm defining it

play23:10

manually and then inside of here we can

play23:12

have environment

play23:15

dot TS and then we can have another file

play23:18

which is going to be the

play23:19

environment.prod so here we can see

play23:21

environment

play23:25

.prod.ts so we have two environment

play23:27

files one for development you could name

play23:29

this

play23:31

environment.dev.ts it's really update so

play23:33

but this used to be the default that

play23:36

comes with the angular CLI whenever you

play23:38

build an angular application with the NG

play23:40

new commit that's no longer the case and

play23:42

I have no idea why so inside of the

play23:45

environment.ts file we can just Define a

play23:47

simple uh object so we're going to say

play23:50

export cost and then we're gonna say

play23:52

environment

play23:54

and then we're going to set it equal to

play23:55

an object and then all we have to do is

play23:57

to Define whatever we want but one thing

play24:00

that's really important is the

play24:01

production flag so we can see production

play24:04

and we need to set this to false because

play24:06

angular is going to need to read this to

play24:08

determine what it needs to do with this

play24:10

file so we're going to set this to false

play24:12

and then we need to pass in the API

play24:15

underscore base underscore URL

play24:19

I'm gonna set this to whatever we have

play24:21

inside of this service so inside of the

play24:23

service remember in the customer service

play24:25

we have this string here so we don't

play24:27

need to pass this in like hard coded

play24:30

like this so I'm gonna cut it and then

play24:32

put it in here okay so this is going to

play24:34

be the environment of my local computer

play24:36

so this computer that's where the

play24:38

backend application is running so you

play24:40

can see here okay so that's running on

play24:42

my local computer if I scroll up you'll

play24:45

see there it is sorry application on

play24:48

port 8080 and I know the IP address of

play24:50

this computer is this IP address that

play24:52

you can see here

play24:54

19168.1.209 that's my local IP address

play24:57

and another thing worth mentioning is

play24:59

I'm using the local IP address because

play25:01

this is going to be deployed in a darker

play25:03

container and by default Docker is going

play25:06

to define a bridge Network and the

play25:08

bridge network has a switch that

play25:09

connects to your local network so that

play25:11

this application will be able to resolve

play25:14

this IP address okay so don't put

play25:16

localhost in here just get the IP

play25:18

address on your local network and then

play25:20

pass it in here instead if you put

play25:21

localhost then it's gonna look at the

play25:23

host container which is not gonna work

play25:26

for you okay so make sure you put the IP

play25:27

address in here so in the regular

play25:29

environment file we just Define

play25:31

production to be false and then pass in

play25:33

everything else that we want in this

play25:35

case we just have one other environment

play25:37

variable which is the API based URL and

play25:40

I'm defining it here so now all I can do

play25:42

is just copy everything here and then go

play25:44

to the prod paste and then just change

play25:47

this to true so that's the prod in our

play25:49

case the URL is going to be the same so

play25:51

we're just going to keep the same URL so

play25:53

now inside of the customer service we

play25:55

need to pass in this environment

play25:57

variable coming from this environment so

play26:00

also notice they have the same name so

play26:02

API based URL and also in the production

play26:04

it's API b0 in our case it doesn't

play26:07

really make sense because the URL is the

play26:09

same but just imagine that inside of the

play26:12

production environment so this file

play26:14

right here this was pointing to the

play26:16

production URL so it's angular that's

play26:17

gonna do the switching for this files

play26:20

and use the different environment

play26:21

variables so now we're gonna go inside

play26:23

of all of our service and then just read

play26:25

that environment variable from the

play26:27

environment file so instead of passing

play26:29

an empty string I'm just going to call

play26:31

the environment so we're going to see

play26:32

the environment as you can see here and

play26:34

then we're going to pass in the API b0l

play26:36

okay it's the same name this is really

play26:39

important and we're going to do the same

play26:40

for the we don't have anything in the

play26:43

service that's making HTTP call nothing

play26:45

in the notification service either but

play26:47

we do have something we can call in here

play26:49

and we're just gonna change that as well

play26:53

and make sure we import the environment

play26:54

okay so we import the environment coming

play26:57

from the environment so the one for the

play27:00

dev or the non-prod but whenever we run

play27:02

the NG build with the prod flag then

play27:04

it's gonna do the switching for us so

play27:06

now this is all good I'm gonna close

play27:09

these files and there's one last

play27:12

configuration we have to do before when

play27:15

you create an angular application with

play27:17

the angular CLI so using angular NG new

play27:19

command it would do all of this for you

play27:22

and they changed it in these newer

play27:24

versions of angular so I'm not sure why

play27:25

because I still use

play27:27

um this setup the way it is maybe it's

play27:29

because they want to start off with less

play27:31

files and you just Define these if you

play27:33

want them so this might be the reason

play27:34

but in any case we need to go inside of

play27:37

the angular.json file and tell angular

play27:39

about the switching of these files

play27:41

otherwise it's not going to do that so

play27:43

you want to go inside of your

play27:44

angular.json file and also by the way

play27:47

this is a very important file for the

play27:49

angular ecosystem or an angular

play27:51

application this file right here the

play27:52

English that Json file so instead of

play27:54

that file we want to scroll down and

play27:56

then go to configuration and in

play27:58

configuration you can see we have the

play28:00

production object here it only has the

play28:02

budget so instead of here we can do

play28:04

something called a file replacement so

play28:07

we're going to do file replacement you

play28:08

can see it coming up here and it's on

play28:10

array so in here we're gonna say we want

play28:12

to replace so we're going to say replace

play28:15

we want to replace something in the

play28:17

source forward slash environment

play28:21

for a slash environment that TS I think

play28:25

I need to rename these so inside of the

play28:28

source this is supposed to be

play28:30

environment so let's rename this to

play28:32

environments okay so because it's

play28:35

multiple environments so this is

play28:36

supposed to be environments so Source

play28:38

environment and then we want to switch

play28:40

the environment.ts file to a new file

play28:43

which in this case is going to be oops

play28:46

the prod file so we just copy this and

play28:50

then change it to prod.ts

play28:53

and then we want to say with it's very

play28:56

intuitive so we say for file replacement

play28:58

which is a configuration we're giving to

play29:00

this angular.json file look for this

play29:03

file replace it with this file and we

play29:05

want to do this when the configuration

play29:06

is production okay so instead of the

play29:09

production object this yellow open curly

play29:11

braces here so when the configuration is

play29:13

production configuration production

play29:15

switch the environment file to the

play29:18

product okay so that's all we have to do

play29:20

here and I think we should be good to go

play29:23

now everything should work just fine the

play29:25

only thing we have left to do is to

play29:27

create the docker compose file just to

play29:29

make it easier to run containers using

play29:32

this Docker image and this is going to

play29:34

be just like a few lines of code so

play29:36

let's go ahead and work on that right

play29:37

now so I'm gonna go ahead again click in

play29:39

this file explorer here and create a new

play29:42

file this time it's going to be the

play29:43

docker compose file so we're going to

play29:45

say Docker compose that EML press enter

play29:49

and then we're going to Define our

play29:50

services so we're going to say services

play29:52

and then we're gonna see a this is the

play29:55

secure Capital so that's the name of the

play29:58

service and then we need to pass in a

play30:00

container underscore name uh we can say

play30:04

secure copy the app container this is a

play30:09

long name I should change this also to

play30:10

app this is a weird name because we have

play30:13

like two A's touching each other so you

play30:16

can come up with a better name so we're

play30:18

defining our services and the first one

play30:20

is going to be the secure camera or the

play30:22

only one because that's the only service

play30:24

that we're gonna have in here the

play30:25

container name whenever the container is

play30:27

created it's going to be secure Capital

play30:28

app container and then we're gonna

play30:30

Define the build so we're gonna say

play30:33

build

play30:35

a DOT to denote the current directory

play30:38

because that's where the docker file is

play30:40

if the docker file was in a folder we

play30:42

would say you know folder name

play30:44

folder that blah blah blah okay in our

play30:47

case it's in the same directory so we

play30:49

just put a dot and then the image is

play30:51

going to be uh secure

play30:54

Capital app V1 like version one or

play30:59

latest if you want and then we're gonna

play31:00

Define some Port so we're gonna say

play31:02

ports which is on array and then we're

play31:05

gonna see we're gonna map 80 to Port 80.

play31:09

so map 80 under container which we're

play31:12

exposing here because that's what nginx

play31:14

use we're also mapping it to Port 80 on

play31:16

the host okay and we expose

play31:21

so that's import

play31:24

ant and also Define a network so

play31:26

Networks

play31:28

and this is going to be the same network

play31:31

so internal net and then I need to

play31:34

Define this network so we're going to

play31:35

say Network or networks and then we're

play31:38

gonna give it the same name so

play31:41

copy paste we can give it a driver so

play31:44

we're gonna say

play31:47

driver

play31:50

Bridge that's the default anyway but I

play31:53

just like to specify it so all this is

play31:55

gonna do when we run Docker compost up

play31:57

it's going to look at this Docker file

play31:59

build an image and then run the

play32:01

containers expose the sports so that's

play32:03

all we have to do for this Docker

play32:05

compose file as you can see it's just

play32:06

really just 16 or 15 lines of code and

play32:09

that's all we have to do here so

play32:10

everything is pretty much done the only

play32:12

thing we have to do now is to run this

play32:14

container and see everything in action

play32:16

and that's what we're going to be

play32:18

working on next so the last thing that I

play32:20

want to show you is how to get rid of

play32:22

all these errors that we've been seeing

play32:23

in the application so let's close

play32:25

everything here and I'm just gonna bring

play32:27

back the terminal and then we're gonna

play32:28

run the application and just so that we

play32:30

can see them so I'm going to do NG serve

play32:32

and then let this finish okay so it's

play32:35

over and you can see we have all of

play32:37

these warnings for external dependencies

play32:39

and all we need to do is to pass them in

play32:41

as we gonna allow them as common

play32:44

JavaScript dependencies so we have to go

play32:47

back to the application and open the

play32:51

angular.json file and we already started

play32:53

doing this we just didn't finish it so

play32:55

let's cool up a little more so you can

play32:56

see here we're passing in the jspdf so

play33:00

the jspdf is a library that we brought

play33:02

in to help us with the PDF generation so

play33:05

what we want to do is to also pass in

play33:07

the file saver that's another library

play33:10

that we brought in let me see if I can

play33:12

grab the package.json file and put it on

play33:16

the side so if you scroll down in our

play33:18

dependency we have this one which is an

play33:20

external Javascript dependency so we are

play33:22

allowing it as an external Java

play33:23

JavaScript dependency also the file

play33:25

saver so I'm passing in the file saver

play33:28

but the thing with this is it also

play33:30

sometimes complain for dependencies of

play33:33

these dependencies so if jspdf or

play33:36

fastsaver has a dependency on some other

play33:38

library then sometimes it's going to

play33:40

complain for it as well so all you have

play33:41

to do is to just look inside of the

play33:44

terminal and see what those dependencies

play33:46

names are and then just pass them inside

play33:48

of this array so let's go back and

play33:51

scroll up so you can see they're still

play33:52

here but I'm going to stop and rerun I'm

play33:54

gonna fast forward the video so that you

play33:56

don't have to wait for this and if I

play33:58

scroll up so it's over we still have

play34:00

some and if I scroll up you can see now

play34:02

it's complaining for this gorgeous

play34:04

module so you can see core core core all

play34:08

of these are core and then there's a

play34:10

raft and then there's a RGB color and

play34:13

then there's this uh don't purify and

play34:16

then this HTML canva so we just need to

play34:18

pass all of these in so let's do Ctrl C

play34:21

so I'm just going to copy them one by

play34:23

one and then I'm just gonna put them in

play34:25

so I'm gonna copy this gorgeous thing go

play34:28

back go here get another entry in this

play34:31

array which is core.js oops I don't need

play34:34

this single quote and then we're gonna

play34:35

do it for the next one which is Raf so

play34:38

copy that go back pass in ref and then

play34:43

we need to do it for RGB color copy that

play34:47

and then

play34:48

bust this in here and also for the uh

play34:52

this dumb purify copy that I can close

play34:55

this now and pass it in here

play34:59

lastly we're gonna do it for the HTML to

play35:02

Canvas to copy that and then we're gonna

play35:04

paste it in here

play35:07

just like that okay so now it shouldn't

play35:10

complain anymore so let's just give it a

play35:12

try here just to make sure we're good so

play35:15

NG serve and then let it finish all

play35:18

right and you can see now we don't have

play35:20

These Warnings anymore so it's really

play35:21

just look at the warnings just see what

play35:24

the dependency is sometimes it's not the

play35:26

dependency that you install but a

play35:28

dependency of the dependency that you

play35:30

install so just grab the name and then

play35:32

put it in the allowed common JS

play35:35

dependency as you can see and I know I

play35:37

say I would do this I just keep

play35:39

forgetting but that's how you solve this

play35:41

okay so now everything looks clean and

play35:43

they just make you feel good because I

play35:45

was having a hard time dealing with this

play35:47

errors all the time okay so the next

play35:49

thing we're gonna do is to just run this

play35:52

container using this Docker file in the

play35:55

docker compose and then see everything

play35:57

in action so that's why we're going to

play35:58

be working on next so I log into my

play36:01

Linux computer and I actually log inside

play36:03

of another machine which is the same one

play36:05

that I was using to deploy the back in

play36:08

because that's why I have darker install

play36:09

so if I do Docker it's going to give us

play36:12

something because I have darker install

play36:13

and if I clear the screen and I do you

play36:16

name Dash a for example you can see that

play36:19

I'm using a Linux computer so obviously

play36:21

it's not this Mac that you're looking at

play36:23

I'm just sshing inside of this computer

play36:26

that you can see here okay so that's why

play36:28

I have Docker install and I have also

play36:30

added the application in there so we can

play36:33

do secure copy that just so that we can

play36:35

go inside of this application and if I

play36:38

do an LS here you can see we have all of

play36:40

our files so the docker file is here and

play36:42

the dock compose file is also here so

play36:45

now all we have to do is to run the

play36:46

direct compose command and then launch

play36:49

this Docker container so I'm gonna do

play36:51

backer

play36:54

Dash compose

play36:56

that up Dash D and then we need to

play36:59

pattern dash dash build because we have

play37:01

a Docker file that we need to build so

play37:03

the same command that we use in the back

play37:05

end we're just going to use the same one

play37:07

here so what this is going to do it's

play37:08

just gonna create the darker image and

play37:10

then run that image with the

play37:12

configuration that we gave it instead of

play37:14

the docker compose file so I'm going to

play37:15

go ahead and press enter and we're just

play37:17

gonna let this finish this can take a

play37:19

minute because it needs to pull images

play37:21

from the internet so let's just give

play37:23

this a second to finish everything is

play37:25

finished you can see we have the steps

play37:27

that we've ran and the darker image was

play37:30

created the container was started and

play37:32

the network was also created so now I'm

play37:34

going to go ahead and clear the screen

play37:35

and just do Docker PS and we want to

play37:39

grip for the

play37:40

secure copy that so I can just say

play37:42

secure and then press enter as you can

play37:44

see here it says it's up 26 seconds ago

play37:47

so it's up and running and another thing

play37:49

I can do is I can do darker logs and

play37:52

then look at the logs so in this case I

play37:54

can pass in the ID of that container so

play37:56

that ID that you see here or I can pass

play37:59

in the name of the container which is

play38:00

the secure Capital app container and

play38:02

also I want to point out you can see the

play38:04

image that was used is the secure

play38:05

cabinet app version one which is the

play38:08

image that we specify and the docker

play38:10

compose file so the name of the email so

play38:11

if you want to see the log we can do

play38:13

secure Capital container you can see

play38:15

these are the logs coming from inside of

play38:18

that container here so if we go to the

play38:20

browser and we and just access the IP

play38:22

address of this computer we don't even

play38:24

have to pass an 80 because that's the

play38:26

default for HTTP then we should be able

play38:28

to see our application so I'm going to

play38:30

clear the screen again and then do

play38:32

hostname Dash I so that we can see the

play38:35

IP address of this computer so the first

play38:36

two IP addresses and those are the one

play38:39

that we're interested in everything else

play38:40

that you here this is just IP addresses

play38:43

coming from the the docker engine and

play38:45

the reason I have two IP addresses

play38:46

because I have this computer connected

play38:48

to the Wi-Fi and also to the network

play38:51

using a cable so I can just copy this

play38:54

right here oops I didn't mean to do that

play38:56

but I need to copy this and then I'm

play38:58

going to open my browser then I'm gonna

play39:00

bring it over here so we need to go to

play39:04

192.168.1.164 or 216 should give us the

play39:07

same thing so if I press enter here you

play39:09

can see the application is running so

play39:12

it's deployed using Docker and it's

play39:14

asking me to log in now remember this is

play39:17

using the backend that is connected to

play39:20

my computer running on the same network

play39:23

because I didn't pass in localhost so I

play39:25

should be able to access this

play39:27

application if I use the same credential

play39:30

Outlook gmail.com and then one two three

play39:33

four five six so if I press enter and

play39:35

just give this a second and you can see

play39:37

that I logged in successfully so now we

play39:39

know that everything is working and the

play39:42

application has been containerized so I

play39:44

can go to my profile I can update the

play39:46

information I can do everything that I

play39:48

was doing before so everything should

play39:49

work as expected you can see I can

play39:51

update my MFA I'm gonna disable that I

play39:54

can go to my profile and make an update

play39:57

here

play39:58

and then I can save everything should

play40:00

work as expected I can also update the

play40:02

customers so you guys can feel free to

play40:04

change whatever you want

play40:06

I'm gonna change this to Gmail update

play40:08

I'm just doing random stuff at this

play40:10

point because you know uh if I do rig

play40:12

you can see that everything is working

play40:14

go back to the home page so the

play40:15

application has been fully containerized

play40:18

and everything should be working as

play40:19

expected you shouldn't have any problem

play40:21

now there's one thing that I do want to

play40:23

show you and I'm going to show it to you

play40:25

right now so if you look here you can

play40:26

see that I'm looking at the specific IP

play40:29

address because I'm in the root or the

play40:31

home page of the application so if I

play40:32

refresh this you'll see that the

play40:34

application just refresh like normal

play40:36

however if I for example go to my

play40:38

profile and I try to refresh the

play40:40

application you can see now I get this

play40:42

404 not found now this is a problem that

play40:45

you probably gonna find in all of the

play40:48

main Frameworks the JavaScript framework

play40:50

so angular react.js and also a view

play40:53

because the navigation is done in the

play40:56

front end and not in the back end and

play40:58

what happens when we try to refresh the

play41:00

page and we go to forward slash profile

play41:02

or forward slash anything for that

play41:04

matter we get a 401 not found because

play41:06

the nginx server could not find this

play41:09

path on the server so what the browser

play41:11

did the browser sent this request all

play41:13

the way back to the server requesting a

play41:15

file by that name which doesn't exist

play41:18

because this is a single page

play41:19

application we only have one index file

play41:22

so it's angular with the browser that is

play41:24

managing this navigation or in other

play41:26

words just JavaScript that is managing

play41:28

the navigation it's looking at this path

play41:30

and then deciding what piece of UI to

play41:33

show in the application which is why it

play41:35

works uh like if I refresh the home page

play41:38

which is going to serve the index file

play41:40

by default and also if I click on a link

play41:42

which is being managed by the angular

play41:44

router so angular knows exactly what I'm

play41:47

trying to do so it takes me there but

play41:48

when I refresh the browser the browser

play41:50

actually send this request all the way

play41:52

back to the server so the nginx server

play41:54

requesting a file by that name profile

play41:57

which doesn't exist which is why when

play41:58

refresh not found so there are many ways

play42:01

that you can handle this but we're just

play42:02

gonna do it the simple way which is to

play42:05

always serve the index file no matter

play42:08

what path that is serve here so this is

play42:11

a problem that I had for a while and I

play42:13

was using the Apache server before and I

play42:16

fixed it on the Apache server and now

play42:18

I'm using the nginx server and I also

play42:20

fix it on the nginx server so you cannot

play42:22

deploy your application this way so for

play42:24

example if I look at this first customer

play42:25

here and then I refresh the page and

play42:27

then the page is broken so obviously you

play42:29

cannot have your application this way so

play42:31

that's what I'm gonna show you how to

play42:33

fix in the next lectures and if you want

play42:35

to go back to have the application

play42:36

running so that you can see something

play42:38

you just have to go back to the root so

play42:40

this route right here and then refresh

play42:42

it because in this case the browser is

play42:44

going to request the index file

play42:46

index.html which we do have on the nginx

play42:49

server which is really the only file

play42:51

that we have so if I refresh this you

play42:52

can see now I work so I'm going to show

play42:54

you how we can fix this problem it's

play42:55

really just a simple fix but it's really

play42:57

important because you can't have your

play42:59

application breaking like this so that's

play43:01

what I'm going to show you how to fix

play43:02

next and this fix is going to work for

play43:04

react.js and possibly for you I haven't

play43:07

worked with View at all so I'm not

play43:09

entirely sure but single page

play43:11

application JavaScript Frameworks will

play43:13

have this problem so this problem exists

play43:15

and angular it also exists in react.js

play43:17

and I'm going to show you how to fix it

play43:19

using just the nginx server for the

play43:21

Apache server it's a little bit

play43:23

different because the configuration is

play43:24

totally different but the solution is

play43:26

similar you just want to always serve

play43:28

that one index.html file because that's

play43:31

the only file that we have in the nginx

play43:33

server all the other files are

play43:34

Javascript file and the browser cannot

play43:36

serve these files the browser can read

play43:38

these files but it cannot serve them and

play43:41

then show them as the UI so that's what

play43:43

we need to fix so I'm gonna go back to

play43:45

the terminal and we're gonna go ahead

play43:48

and take a look at this so what we need

play43:50

to do we need to go inside of the

play43:52

container so if I go up a little more

play43:55

we're gonna grab this container so the

play43:58

secure Capital container press enter so

play44:00

you can see that we have this container

play44:02

running right so that's the application

play44:03

that we have running so now we need to

play44:05

go inside of this container and we can

play44:07

do that using the docker exec command

play44:10

and then we pass in the interactive mode

play44:12

and we pass in the name of the container

play44:14

so the secure Capital container and then

play44:17

we want to execute the bash shell so to

play44:19

do this we just do bin Dash bash which

play44:22

is the location of the shell and then

play44:23

we're going to press enter you can see

play44:25

now my prompt just changed because now

play44:27

I'm inside of the container so I'm going

play44:30

to clear this and if I loot LS you can

play44:32

see that we have some files in here and

play44:35

I'm also going to see if I can minimize

play44:37

this okay just so that we can see this a

play44:39

little better and then I need to go

play44:41

inside of the four slash

play44:44

Etsy and we want to go to the nginx and

play44:48

if I list everything in here you can see

play44:49

we have this conf.d so that first folder

play44:52

here right here and that's what we need

play44:55

to go into so I'm

play44:56

cdconf.d and then LS so you can see in

play44:59

here we have this default.configuration

play45:01

so that's a configuration that nginx is

play45:03

using and also if we go to the main

play45:06

configuration so this nginx config right

play45:09

here uh let's see if I have VM so nginx

play45:13

okay I don't have them let's do update

play45:16

so that we can well need to do apt

play45:19

update because I need to install them so

play45:22

otherwise we won't have any text editor

play45:24

so I'm gonna do apt install them you can

play45:28

install Nano if that's easier for you

play45:30

but at this point you're inside of a

play45:32

container so now you really will see why

play45:35

you need to uh to some level be able to

play45:38

use the terminal because I cannot use vs

play45:41

code inside of the dagger container so

play45:44

let's clear this in LS again so we need

play45:46

to go into this

play45:47

nginx configuration so this is the

play45:50

configuration and you can see at the

play45:53

very bottom if I scroll to the bottom

play45:55

you can see here here they're including

play45:57

everything that is inside of the conf.d

play46:00

folder okay so everything that we put

play46:03

inside of this folder will be included

play46:05

in this file so what this means is that

play46:07

we don't have to touch this file

play46:08

directly I mean we can but we don't have

play46:11

to so if I LS again so we don't have to

play46:13

touch this file we just have to put

play46:16

whatever configuration we want inside of

play46:18

this folder so if I list everything

play46:20

inside of this folder you can see it's

play46:22

gonna look for everything that ends with

play46:24

conf and then included inside of this

play46:27

file which is what I just showed you so

play46:28

if I do an L nginx if I don't know if I

play46:31

oh I have NL so you can see here at the

play46:33

very bottom on line 20 that's what it's

play46:35

doing say include everything inside of

play46:38

this itsy nginx conf.d everything that

play46:41

ends with cough in that case this file

play46:44

will be included inside of this

play46:46

configuration so let's see what's inside

play46:48

of this file so I'm gonna clear the

play46:50

screen again and then oops I'm gonna go

play46:53

up so LS we want to go inside

play46:56

D and then LS and then Vim go to this

play46:59

and I'm gonna go here well not here

play47:03

I'm gonna go down here and then I'm

play47:06

gonna say try underscore files and again

play47:09

I'm going to put a dollar sign I'm gonna

play47:11

say URI and I'm gonna say forward slash

play47:14

index.html and then put a semicolon so

play47:16

every time that it cannot find a file

play47:18

it's going to go ahead and try this

play47:20

index file so in this case that's always

play47:21

going to return the index file whenever

play47:24

it cannot find the file and then angular

play47:25

will handle the route that is present in

play47:29

the URL bar in the browser so that we

play47:31

don't have this problem anymore so just

play47:32

telling nginx to try the index file

play47:35

whenever you cannot find the file that

play47:36

is being requested by the browser so try

play47:39

files dollar sign URI and then forward

play47:41

slash index.html so now I can save and

play47:44

quit and I'm gonna exit out of here and

play47:47

then I'm gonna clear this and then we're

play47:49

gonna restart the container so I can see

play47:51

Docker restart and then we're gonna say

play47:53

secret copy and then press enter and

play47:55

then now we can do Docker PS and then

play47:58

grab that secure copy that again

play48:01

you can see now it's running so I'm

play48:03

gonna bring back the browser and I'm

play48:05

gonna move it over here and if I refresh

play48:08

this everything should work as expected

play48:10

but now if I for example go to my

play48:12

profile and I refresh the page you can

play48:15

see that it's not giving me this photo

play48:16

or not okay so if I can keep refreshing

play48:19

it you can see that it still works the

play48:20

same and I can update my information

play48:22

well let me just delete this part so

play48:25

that you can see an actual update so I

play48:27

can update that and it should work the

play48:28

same I can go to the customers again I

play48:31

can update them everything should work

play48:32

as expect okay and well if I go to this

play48:35

customer again and then refresh the page

play48:37

and can I can keep refreshing it it's

play48:38

not giving me this snap because it's

play48:40

returning the same index file and then

play48:42

angular is handling the route that is

play48:45

present here okay so that's what we have

play48:47

to do for this and the last thing that I

play48:49

want to show you is you saw that to fix

play48:52

this problem we have to go inside of the

play48:54

container and update a specific

play48:56

configuration file so that is definitely

play48:58

a lot of work so what I'm gonna show you

play49:00

is how you can just create that

play49:02

configuration and you can just copy that

play49:04

file over whenever you're going to build

play49:06

the docker image and then run the

play49:07

container so that you don't have to you

play49:09

know separately go inside of the

play49:10

container and then do that every time

play49:12

obviously that wouldn't be a good idea

play49:14

so that's what I'm going to show you how

play49:15

to do so that we don't have to do this

play49:16

manually I'm just going to show you how

play49:17

we're going to take that config file and

play49:19

then just copy it in that particular

play49:21

location so that we don't have to deal

play49:22

with this problem in the first place so

play49:24

that's what I'm going to show you how to

play49:25

do right now so I'm going to go back to

play49:27

the terminal and what I'm going to do is

play49:30

do condacker

play49:32

Dash compose down so this is going to

play49:35

destroy everything so it's going to stop

play49:36

the containers and then remove these

play49:38

containers now I'm also going to remove

play49:39

the image so I'm going to say Docker

play49:41

image RM and then I'm gonna say secure

play49:45

copy that version one and then remove it

play49:47

I think you can do Docker RMI for remove

play49:50

image that should work as well I'm gonna

play49:53

say Docker image rune so that we can

play49:57

remove any dangling image and then I'm

play49:59

gonna say Docker Network

play50:03

prune gonna do the same thing so clean

play50:05

any dangling image and networks that we

play50:08

weren't using and then clean this so at

play50:10

this point this application should be

play50:11

broken so if I go back and refresh the

play50:13

page you can see it's broken and we

play50:15

clean everything so back in the terminal

play50:17

I just need to go inside of the darker

play50:19

file so I'm going to say vim and then

play50:21

Docker file

play50:24

and then I'm gonna scroll down so

play50:26

whenever we get the nginx image I want

play50:29

to go ahead and then copy the

play50:31

configuration file so to do this I'm

play50:33

going to say copy and I'm going to copy

play50:35

a file name default dot conf okay and we

play50:38

need to copy this file in that same

play50:39

location so we're gonna say Etc forward

play50:42

slash nginx for slash conf.d okay so

play50:47

we're just gonna copy this file inside

play50:49

of this folder now we don't have this

play50:50

file yet but I'm just going to show you

play50:52

what that file will look so I'm going to

play50:53

save that so we're technically doing

play50:54

everything else but the only difference

play50:56

is after we get the nginx table image so

play51:00

that's happening on line eight as you

play51:01

can see I'm highlighting here then when

play51:03

I copy this configuration file that we

play51:05

don't have yet but we're gonna create it

play51:07

which is I'm gonna call default.conf and

play51:09

we're going to copy it over to that

play51:10

particular location because we know

play51:12

that's where it belongs so I'm going to

play51:13

save this and then I'm gonna quit and

play51:15

then I'm gonna create this file so I'm

play51:16

gonna say vim and I'm gonna say

play51:18

default.conf so this is the file you can

play51:20

see at the bottom that we just created

play51:22

this file and then I'm just gonna go

play51:23

ahead and paste it just to see what it

play51:25

looks like so this is what the file

play51:26

looks like it's literally the same

play51:28

configuration I just really copied it

play51:30

from inside of the container and then I

play51:31

just paste it here and then I just add

play51:33

this line on line 9. so just say try

play51:36

files that'll sign URI and then the

play51:38

index.html so that way we know that

play51:40

whenever we're gonna run this nginx

play51:42

container it's going to copy this

play51:44

configuration file and it's going to

play51:46

make that one change on line 9 so that

play51:48

we don't have to do it ourselves as you

play51:49

can see that I'm highlighting because

play51:51

it's going to override the existing file

play51:53

that is going to come with the container

play51:55

image itself so we're just overriding

play51:57

that one line as you can see here

play51:58

everything else is the same okay and I

play52:00

don't think we need that part here at

play52:02

the bottom because we don't have any 500

play52:05

HTML file that we return but I just left

play52:07

them here it doesn't really matter but

play52:08

if you want you can clean this up as

play52:10

well this is what's really important

play52:11

that location and all the way to the

play52:13

closing curly bracket here and we just

play52:15

added this line nine okay so hopefully

play52:17

that makes sense and also if you want

play52:19

you can remove this

play52:21

index.htm so I can just really remember

play52:24

of that because we only have the

play52:26

index.html we don't have any HDM file

play52:28

okay so always serve the index.html and

play52:31

if you can find anything just return the

play52:33

index.html again so that angular can

play52:36

handle the routing and the front end so

play52:37

I'm going to save that and quit and if I

play52:39

LS everything you can see now we have

play52:41

the configuration file so

play52:43

thedefault.conf and if I NL the docker

play52:46

file so Docker file you can see we're

play52:49

copying this file so the default.conf

play52:52

this file right here and its location

play52:53

which is the Etsy nginx and then the

play52:56

config so all we have to do now is to

play52:58

just run this command again and

play52:59

everything should work as expected but

play53:01

this time when we refresh the

play53:03

application on a particular route it's

play53:04

not going to give us this forward so I'm

play53:06

gonna go up and then run this command

play53:08

again okay so this is the command and

play53:10

then I'm just going to run it and then

play53:12

we're going to let it finish all right

play53:13

so let's just give it a second

play53:22

all right everything is completed I'm

play53:25

going to include this one more time I'm

play53:26

gonna do docker

play53:28

BS and then we're gonna grab

play53:32

here press enter you can see it's up and

play53:35

running so now let's bring the browser

play53:36

just gonna move it over here and I'm

play53:38

just gonna make it full screen and then

play53:40

reload you can see we're back in and if

play53:42

I go to my profile for example and then

play53:44

I reload you can see it's still working

play53:46

as expected because we pass in the

play53:48

configuration in so we didn't have to do

play53:50

it manually and that's typically what

play53:52

you want to do but I wanted to show you

play53:53

the solution because it's really

play53:54

important that you understand how all

play53:57

these things work so let's go back to

play53:58

the terminal and let's just go inside of

play54:01

the container again so that we can

play54:02

confirm so if I go up some more where we

play54:05

go inside of that container so right

play54:07

here and we want to go to Etsy

play54:10

see we want to go to nginx

play54:13

LS so you can see the cough so that

play54:16

folder right here that's why we need to

play54:18

go so path D clear that one more time

play54:21

now s so this is the file that we

play54:24

overwritten so I can do NL I don't know

play54:27

if I have that installed but let's see

play54:29

okay so you can see this is our file

play54:31

because we overrode this file when we

play54:33

copy it to that particular location in

play54:36

the docker file okay so this location

play54:38

right here that we have in the docker

play54:40

file which is where we are okay so we

play54:41

have this in there now so we don't have

play54:44

to worry about going in there and doing

play54:45

manual and if you want to know how to do

play54:47

the same thing in Apache I can probably

play54:50

give you the file because before I was

play54:52

using nginx I was using Apache for this

play54:54

I just recently started using nginx so

play54:57

if you want the configuration the same

play54:59

configuration for Apache just let me

play55:01

know I can just send you the

play55:02

configuration that you need to add and

play55:03

I'll tell you uh where you need to put

play55:05

it okay so that's all we have to do here

play55:07

and if you have any questions let me

play55:09

know I think that's everything that I

play55:11

wanted to cover when it comes to the

play55:13

deploying the front-end application and

play55:14

if I go back again you can see

play55:16

everything is working as expected that

play55:18

can save my information I can change my

play55:21

authorization I can save update

play55:24

everything should work as expected I'm

play55:26

gonna make me a super admin again okay

play55:28

so admin and update my profile I can go

play55:31

to the customers I can create a new

play55:33

invoice if I want it I can edit an

play55:35

invoice here and then select the

play55:36

customer I can go to the invoice I don't

play55:38

have an invoice but you guys feel free

play55:39

to test that but everything should work

play55:41

and then I can also access the customers

play55:43

I can update their information blah blah

play55:45

blah so everything is working as

play55:47

expected so if you just want to test

play55:49

this you can create an ec2 instance on

play55:51

AWS or Microsoft Azure just get some

play55:54

server in the cloud that you can use and

play55:56

then you can install Docker on it and

play55:58

then you can deploy your application I

play56:00

already showed you guys how to pass

play56:01

sensitive information to the docker

play56:03

compose in the docker file when we were

play56:05

deploying the backend so you can use the

play56:07

same logic and then pass insensitive

play56:09

information but you don't save them in

play56:11

any of the config file but that's all I

play56:12

want to to show you obviously that

play56:14

doesn't really have anything to do with

play56:16

the application that we built in this

play56:18

course but it's also important that you

play56:19

know how to work with Docker because

play56:21

Docker is like super popular and it

play56:24

solves a lot of problems that that

play56:26

developers used to have so it's a very

play56:28

important piece of technology that you

play56:30

should know in this day and age when it

play56:32

comes to software development so I hope

play56:33

this was useful to you and if you have

play56:35

any questions just ask me in the Discord

play56:37

and I should be able to help and I'll

play56:39

see you guys in the next one

Rate This

5.0 / 5 (0 votes)

Ähnliche Tags
Desarrollo AngularDockerizaciónGestión de ClientesGestión de PerfilIniciación DockerConfiguración NginxSingle Page ApplicationContenedores DockerAdministración de InvoicesDespliegue de AplicacionesProgramación Web
Benötigen Sie eine Zusammenfassung auf Englisch?