7. Deployment of Host and Remote App over Vercel | Microfrontend Communication | Amar Kumar Ram

Amar Kumar Ram
27 Jan 202409:55

Summary

TLDREn este video, Amar Kumar Ram guía a los espectadores a través del proceso de despliegue de una interfaz de usuario Angular en Versal, una plataforma que ofrece un servicio gratuito con ciertas limitaciones, como la ausencia de entornos ilimitados y la necesidad de conectar con un repositorio de GitHub para activar una tubería CI/CD. Se destaca la compatibilidad de Versal con más de 35 frameworks, incluyendo Angular, lo que es ideal para las aplicaciones desarrolladas en dicho lenguaje. La demostración incluye la creación de un proyecto en Versal, la conexión con repositorios de GitHub, la configuración de variables de entorno y la actualización de la URL de la aplicación remota para asegurar la comunicación entre la aplicación principal y la remota. Finalmente, se muestra la aplicación desplegada en producción y se invita a los espectadores a probarla y hacer preguntas en los comentarios.

Takeaways

  • 🚀 Amar Kumar Ram está enseñando cómo desplegar una interfaz de usuario Angular en Versal utilizando la versión gratuita.
  • 🔑 Versal ofrece un entorno de producción (prod) en su versión gratuita, sin entornos ilimitados que se encuentran en la versión Pro.
  • 🤖 Se necesita conectar Versal con un repositorio de GitHub para activar automáticamente la canalización CI/CD.
  • 🌐 Versal admite más de 35 frameworks, incluyendo Angular, lo cual es perfecto para las aplicaciones desarrolladas en este tutorial.
  • 📝 Durante el proceso de registro, Versal pedirá que elijas un plan (en este caso, la versión gratuita) y conectará con la cuenta de GitHub.
  • 🔄 Al hacer clic en el botón 'Import', Versal detectará automáticamente el framework y el nombre del proyecto.
  • 🛠️ Se pueden configurar ajustes de compilación y salida, y definir variables de entorno, pero en la versión gratuita, las variables de entorno se aplican solo a producción.
  • 🔄 Al hacer clic en 'Deploy', Versal mostrará el progreso de la implementación y, al finalizar, se puede ver una captura de pantalla de la aplicación desplegada.
  • 🔗 Es importante actualizar la URL del código de la aplicación host para apuntar a la URL del dominio en lugar de localhost para que la aplicación remota se cargue correctamente.
  • 📌 Al realizar cambios en la rama master de GitHub y empujarlos, Versal detectará automáticamente los cambios y desencadenará la canalización CI/CD para desplegarlos.
  • 🔍 Se puede inspeccionar la página y la pestaña de red para ver los errores y ajustes necesarios para la comunicación entre la aplicación host y la aplicación remota.
  • 🎉 Después de realizar los cambios y desplegar, se confirma que tanto la aplicación host como la aplicación remota están funcionando correctamente y se han desplegado en producción.

Q & A

  • ¿Qué plataforma se utiliza para desplegar la aplicación front-end mencionada en el script?

    -Versal se utiliza para desplegar la aplicación front-end.

  • ¿Cuál es la limitación principal de la versión gratuita de Versal en términos de entornos?

    -La versión gratuita de Versal no ofrece entornos ilimitados y solo proporciona el entorno de producción (prod).

  • ¿Cómo se desencadena la canalización CI/CD en Versal?

    -La canalización CI/CD se desencadena automáticamente cuando Versal detecta un cambio en la rama maestra del repositorio de GitHub conectado.

  • ¿Qué frameworks son compatibles con la versión gratuita de Versal?

    -La versión gratuita de Versal admite más de 35 frameworks, incluido Angular.

  • ¿Cómo se conecta Versal con el repositorio de GitHub?

    -Después de registrarse en Versal, se conecta con GitHub haciendo clic en 'Continuar con GitHub' y completando el proceso de autenticación.

  • ¿Qué información se proporciona para importar un proyecto desde GitHub?

    -Se hace clic en el botón 'Importar' y se seleccionan los repositorios deseados (host app y remote app) para importarlos a Versal.

  • ¿Cómo se pueden ajustar los ajustes de compilación y salida de un proyecto en Versal?

    -Se pueden ajustar los ajustes de compilación y salida habilitando el botón 'Anular' y realizando los cambios necesarios.

  • ¿Qué sucede si se agregan variables de entorno en la versión gratuita de Versal?

    -Las variables de entorno agregadas en la versión gratuita de Versal solo se agregarán para el entorno de producción.

  • ¿Cómo se resuelve el problema de la aplicación host al intentar cargar la aplicación remote desde 'Local Host'?

    -Se actualiza la URL en el código de la aplicación host para apuntar al dominio correcto de la aplicación remote en lugar de 'Local Host'.

  • ¿Qué sucede cuando se realiza un push de cambios a la rama maestra del repositorio de GitHub conectado a Versal?

    -Versal detecta automáticamente los cambios y desencadena la canalización CI/CD para desplegar los cambios nuevos.

  • ¿Cómo se puede verificar si la comunicación entre la aplicación host y la aplicación remote funciona correctamente?

    -Se pueden realizar pruebas interactuando con los botones y controles de ambas aplicaciones para verificar que los cambios se reflejen correctamente de una a otra.

  • ¿Dónde se proporcionará el enlace para probar la aplicación desplegada después del éxito del despliegue?

    -El enlace se proporcionará en la descripción del video para que los espectadores puedan probar la aplicación.

Outlines

00:00

🚀 Despliegue de la aplicación Angular con Versal

Amar Kumar Ram, creador del canal, introduce el tema del video: el despliegue de una interfaz de usuario de Angular utilizando Versal. Se menciona que se utilizará la versión gratuita de Versal, la cual tiene limitaciones como la falta de entornos ilimitados y solo ofrece un entorno de producción (PRD). Además, se destaca la necesidad de conectar Versal con el repositorio de GitHub para activar una tubería de CI/CD que desencadene automáticamente el proceso de despliegue cuando se realicen cambios en la rama maestra. Finalmente, se menciona que Versal es compatible con más de 35 frameworks, incluyendo Angular, lo que es ideal para la aplicación desarrollada en el canal.

05:01

🔗 Conexión de GitHub con Versal y despliegue

Se describe el proceso de registro en Versal y la conexión del repositorio de GitHub. Se detalla cómo importar proyectos desde GitHub y seleccionar aquellos que se desean desplegar. Se destaca que Versal detecta automáticamente el framework de Angular y permite ajustes en la configuración de compilación y salida. También se menciona la posibilidad de definir variables de entorno, aunque en la versión gratuita solo se aplican al entorno de producción. Seguidamente, se muestra el progreso del despliegue y la verificación de que la aplicación se ha desplegado correctamente. Se resalta la necesidad de actualizar la URL en el código para que la aplicación host pueda cargar la aplicación remota desplegada. Finalmente, se muestra cómo Versal detecta automáticamente los cambios en la rama maestra y desencadena la tubería de CI/CD para desplegar las actualizaciones. Se concluye con una demostración de la comunicación entre la aplicación host y la aplicación remota, y se ofrece el enlace para que el espectador pueda probar la aplicación desplegada.

Mindmap

Keywords

💡Versal

Versal es una plataforma utilizada para desplegar aplicaciones web. En el video, se utiliza Versal para desplegar tanto la aplicación host como la aplicación remote, conectándose con el repositorio de GitHub para activar una canalización CI/CD que desencadena automáticamente el proceso de despliegue cuando se realizan cambios en el repositorio.

💡Despliegue

El despliegue es el proceso de implementar una aplicación o servicio en un entorno de producción. En el contexto del video, se refiere a la publicación de la aplicación front-end en Versal, donde la aplicación se pone disponible para su uso final.

💡GitHub

GitHub es una plataforma de desarrollo colaborativo de software que utiliza el sistema de control de versiones Git. En el video, GitHub se utiliza como el repositorio de código donde se almacenan y gestionan los cambios en la aplicación, y se conecta con Versal para el despliegue continuo.

💡CICD

CICD (Continuous Integration/Continuous Deployment) se refiere a la integración continua e implementación continua, prácticas que automatizan el proceso de despliegue de aplicaciones. En el video, la conexión entre GitHub y Versal permite que cualquier cambio en la rama master desencadene automáticamente la canalización CICD.

💡Framework

Un framework es un conjunto de herramientas o una estructura que proporciona soporte y funcionalidades predefinidas para el desarrollo de aplicaciones. En el video, se menciona que Versal admite más de 35 frameworks, incluyendo Angular, que es el framework utilizado para desarrollar las aplicaciones host y remote.

💡Angular

Angular es un framework de aplicaciones web de código abierto desarrollado y mantenido por Google. En el video, se utiliza Angular para desarrollar tanto la aplicación host como la aplicación remote, lo que permite aprovechar las características y las herramientas que ofrece el framework para la construcción de interfaces de usuario.

💡Rama Master

La rama master, también conocida como main, es la rama principal de un repositorio de código en Git. En el video, se selecciona la rama master para ser desplegada en Versal, lo que significa que los cambios en esta rama son los que se implementan en la versión de producción de la aplicación.

💡Variables de entorno

Las variables de entorno son pares de valores que representan la configuración de una aplicación y que se utilizan para adaptar su comportamiento a diferentes entornos sin necesidad de cambiar el código. En el video, se menciona que en la versión gratuita de Versal, las variables de entorno se aplican solo para el entorno de producción.

💡Versión Gratuita

La versión gratuita de Versal ofrece ciertos límites en comparación con la versión de pago, como no contar con entornos ilimitados. En el video, se opta por la versión gratuita, conociendo sus limitaciones, para desplegar la aplicación en el entorno de producción.

💡Aplicación Host

La aplicación host es la aplicación principal que se despliegue y que puede contener o interactuar con otras aplicaciones, como la aplicación remote. En el video, la aplicación host se despliega en Versal y se actualiza para que pueda comunicarse con la aplicación remote desplegada.

💡Aplicación Remote

La aplicación remote es una aplicación que se despliega y que puede ser interactuada o gestionada por la aplicación host. En el video, se despliega la aplicación remote en Versal y se prueba su comunicación con la aplicación host a través de eventos y actualizaciones de datos.

Highlights

Amar Kumar Ram explains how to deploy a micro front end using Versal.

Versal's free version is used, which has limitations such as no unlimited environments.

Only the prod environment is available in the free package, meaning any deployment goes directly to production.

Versal needs to be connected with a GitHub repo to enable an automatic CI/CD pipeline.

Changes in the master branch of the connected GitHub repo will automatically trigger the CI/CD pipeline.

The free version of Versal supports over 35 frameworks, including Angular.

A step-by-step sign-up process is provided for connecting a GitHub repo with Versal.

Demonstration of deploying both a host application and a remote application on Versal.

The process includes selecting repos, importing projects, and configuring build and output settings.

Environment variables can be defined directly in Versal, but only for the production environment in the free version.

A successful deployment leads to a page showing the application screenshot and providing a link to the live site.

Testing the deployed remote application by increasing the counter value confirms its functionality.

Deployment of the host application involves creating a new project and importing the app into Versal.

An issue with loading the remote application from localhost is identified and resolved by updating the URL in the code.

After updating the URL and committing the changes, Versal automatically detects and deploys the new changes due to CI/CD.

The host application is tested to ensure that the communication between the host and remote applications is functioning correctly.

The video concludes with a demonstration that both applications have been successfully deployed on production.

Amar Kumar Ram provides the deployment URLs in the video description for viewers to test the applications.

The video encourages viewers to ask questions in the comments section if they have any queries.

Transcripts

play00:00

[Music]

play00:07

hello everyone this is Amar Kumar Ram

play00:09

welcome back to my Channel today we are

play00:11

going to understand how to deploy micr

play00:13

front end that we have created in the

play00:15

series before going into the repo let me

play00:17

tell you that we are going to use versal

play00:19

to deploy our code we are going to use

play00:21

the free version of it so let's go to

play00:23

the pricing

play00:25

section here we can see the limitations

play00:28

that we are not going to get un limited

play00:30

environments that is in the pro package

play00:32

so what environment we are going to get

play00:34

in the free package we are going to get

play00:36

only the prad environment so whatever we

play00:38

will Deploy on versal it will directly

play00:41

be deployed on prod second thing we need

play00:43

to understand that we need to connect

play00:45

versal with our GitHub repo so that

play00:49

automatic cicd pipeline can be triggered

play00:51

what I mean by that suppose we select

play00:54

our Master Branch to be deployed then

play00:56

versal will detect any change that will

play00:58

be made in the master branch of our

play01:00

connected repo and will trigger the cicd

play01:02

pipeline automatically I'll come to that

play01:04

when we'll do the deployment last thing

play01:06

we need to understand is the free

play01:08

version supports 35 Plus Frameworks

play01:11

which includes angular also as we

play01:13

developed our host application and

play01:15

remote application in angular only we

play01:17

are good to go with versel now let's go

play01:19

through the sign up process on how to

play01:21

connect our GitHub repo with versel but

play01:23

before that let's have a look on our

play01:25

GitHub repos so here I have an example

play01:28

of multi repo where remote app and host

play01:31

app are in separated repos now we will

play01:33

deploy this host app and remote app over

play01:36

versal and these are the same code that

play01:38

we have done in this series till now now

play01:41

let's connect this remote app and host

play01:43

app repo with versal for that we'll

play01:45

click on the signup button then the

play01:47

portal will ask us to choose the plan

play01:49

type and we will go with the free

play01:51

version that is Hobby one also it will

play01:54

ask to put our name so let's put our

play01:57

name in my case it is Amar Kumar Ram

play02:01

and we'll click on

play02:02

continue on the next step it will ask to

play02:05

connect our GitHub gitlab or bit bucket

play02:08

whatever you use I'm using GitHub so

play02:10

I'll click on continue with GitHub after

play02:13

connecting with GitHub it will

play02:14

authenticate you if you have enabled the

play02:17

two steps verification in your GitHub

play02:19

account after successful sign up it will

play02:21

automatically redirect you to the

play02:23

dashboard page where you can click on

play02:26

the import button to import your project

play02:28

as the description is ADD a repo from

play02:30

your git provider so let's click on

play02:32

import button on the next step it will

play02:34

show all repos that I have over GitHub

play02:37

among all I need to select only host app

play02:39

and remote app because we are going to

play02:41

work with those repo only I'll provide

play02:43

the link of remote app and host app repo

play02:46

Link in the description of this video so

play02:48

that you can clone those project and

play02:50

practice the deployment process now

play02:52

let's click on the import button of host

play02:54

app and remote app we'll start with

play02:56

remote app

play02:58

first after clicking on import button we

play03:01

can see that versal has automatically

play03:04

detected the framework that is angular

play03:06

and our project name that is remote

play03:08

iPhone app we also have an option to

play03:11

change the root directory if needed by

play03:13

clicking on the edit button in our case

play03:15

it is not required so we'll proceed

play03:17

further in the next step we have build

play03:19

and output settings which we can change

play03:21

by enabling the override button but in

play03:23

our case we'll go with the default

play03:25

settings that has been picked by versal

play03:27

also if you have some environment

play03:28

variables you can just directly defined

play03:30

in this environment variable accordion

play03:33

by putting the key and the value and

play03:35

clicking on the add button please note

play03:37

that since it's a free version so

play03:39

whatever environment variables you will

play03:40

add it will be added for the production

play03:43

only but if you want to add environment

play03:45

variables for different environments

play03:47

such as Dave QA uat perf Etc then you

play03:51

need to go and upgrade your plan on

play03:54

versus I do not have any environment

play03:55

variable so I'll just minimize this and

play03:58

click on deploy so it will show us that

play03:59

the deployment progress status currently

play04:01

project is in the build phase after

play04:03

successful deployment we will land on

play04:05

this page where a screenshot of our

play04:07

application will be shown here and we

play04:09

can also check this website by clicking

play04:12

on the image itself so let's click on

play04:16

this and we can see that our remote

play04:18

application has been successfully

play04:20

deployed I'll provide this link in the

play04:22

description of the video so that you can

play04:24

also test it as we know that in our

play04:26

remote application if I click on the

play04:28

counter button then the counter value

play04:29

will increase so let's test it if I

play04:31

click on the counter it is increasing

play04:33

the counter value so everything is

play04:36

working fine here now let's deploy the

play04:38

host application for that we'll go to

play04:39

the versal we'll click on continue to

play04:42

dashboard or we can click on this arrow

play04:45

button and hover on Amar Kumar Ram's

play04:47

project then it will show me the

play04:49

projects that have been deployed

play04:51

currently I have only one project that

play04:53

is remote app which is deployed our

play04:54

production now we will create another

play04:56

project so let's click on create project

play05:00

now we'll import the host application

play05:04

here and keeping the default settings

play05:06

we'll click on deploy button again now

play05:09

deployment process has been started we

play05:11

can see the logs by opening the building

play05:13

phase we can see the logs

play05:17

here so our host application is

play05:20

successfully deployed however the

play05:21

screenshot is not available maybe

play05:24

because it is loading the remote

play05:26

application ad hoc so let's click on the

play05:28

screenshot of it

play05:32

as we can see our host application is

play05:34

rendering successfully where we have

play05:36

this button control MF counter value but

play05:39

we are not able to load the remote

play05:41

application that has been deployed here

play05:43

on remote hyphen app hyph ior doval

play05:46

doapp it is because we are trying to

play05:49

face the remote application from The

play05:51

Local Host so we need to update the URL

play05:53

in the code and commit it again let me

play05:55

show you how it is failing for that I'll

play05:58

inspect this page P we'll go to the

play06:01

network Tab and then if I reload the

play06:04

page we can see that there is a remote

play06:07

application.js

play06:08

file which is hitting on Local Host 4300

play06:12

but it should hit this domain that is

play06:14

remote hyph app hyph i.v. app and after

play06:18

that we can have forward slash remote

play06:23

entry. JS if I press enter we can see

play06:26

that remote entry has been successfully

play06:28

created at the remote side so we need to

play06:31

point to this URL inad of Local Host so

play06:34

let's go to the host app code and do the

play06:36

necessary change and see if that is

play06:38

working fine or not so this is our host

play06:40

application here we'll go to the source

play06:42

folder then app folder then app hyph

play06:45

routing. module. TS file here we are

play06:47

pointing to Local Host 4300 and we can

play06:50

also see that we are on the master

play06:52

branch of our host app repo that is in

play06:54

the GitHub now let's update this remote

play06:57

entry URL for that we'll copy this UR

play06:59

URL and paste it here in the remote

play07:01

entry value now we'll save the file now

play07:03

we'll open the G bash and in the changes

play07:06

section we can see that there is a

play07:08

change in the app routing module file

play07:10

which will add and put in the staged

play07:12

changes after that we'll commit

play07:15

it remote app URL changed now before

play07:20

pushing the new changes into the master

play07:22

branch of this host app repo I just want

play07:24

you to recall one important feature of

play07:26

versal that is as soon as we'll push

play07:29

changes in the master Branch it will be

play07:32

detected by versal and automatic cicd

play07:34

pipeline will be triggered to deploy the

play07:36

new changes to observe that let's go to

play07:39

the versal portal here we'll click on

play07:41

the continue to dashboard button in the

play07:43

production deployment section I can see

play07:45

that the last deployment is done on host

play07:48

app repo and to trigger the automatic

play07:50

cicd pipeline it is saying that to

play07:52

update your production deployment push

play07:54

to the master Branch so let's try it

play07:56

I'll push the code

play07:58

now

play08:02

code has been pushed and we can see on

play08:04

versal that it has detected the changes

play08:06

and the comment that I have made is

play08:08

remote app URL change is now picked by

play08:10

versal and it is building the changes

play08:12

now so I do not need to do anything

play08:14

versal will take care everything if your

play08:16

GitHub repo is connected with the versal

play08:19

so new changes has been deployed

play08:20

successfully let's check over the portal

play08:22

now I'll refresh the

play08:24

page and we can see that we are able to

play08:27

load the remote application and remote

play08:29

entry. JS file is coming from remote

play08:31

hyphen appy

play08:33

i.v. apppp SL remote entry. JS now we

play08:37

will test the host application and

play08:38

remote application whether it is working

play08:40

as expected or not as we know from our

play08:43

development Journey if I click on the

play08:44

counter button it will increase the

play08:46

counter value so let's click on the

play08:47

counter button and it is increasing the

play08:49

value of counter so I have increased

play08:51

till three now if I click on control MF

play08:54

counter value it should increase the

play08:55

counter value to four and it is working

play08:58

fine see if I clicking again and again

play09:01

it is increasing the counter value so

play09:02

that is the event trigger from the host

play09:04

application to the remote application

play09:06

now we'll do the vice versa so if I type

play09:08

anything and click outside the same text

play09:10

will appear in place of this text that

play09:13

is this is host application so I'll

play09:15

write here we have

play09:17

successfully deployed the code and I'll

play09:20

click outside so the text in the host

play09:22

application has been changed now and by

play09:24

this we can confirm that the

play09:26

communication between the host

play09:28

application and the remote application

play09:29

is working perfectly fine and we have

play09:31

successfully deployed the host

play09:33

application and the remote application

play09:35

on production now I will paste this URL

play09:37

in the description of the video so that

play09:39

you can also test it and if you have any

play09:41

query then please do ask in the comment

play09:43

section so let's meet in the next video

play09:45

till that be happy take care signing

play09:50

[Music]

play09:54

off

Rate This

5.0 / 5 (0 votes)

Related Tags
Despliegue de aplicacionesAngularVersalCI/CDGitHubDesarrollo webIntegración continuaPlan gratuitoAutomatizaciónProceso de despliegueAplicaciones web
Do you need a summary in English?