Deploying on Day 1 as a Waypoint User

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
welcome to deploying on day one as a waypoint user my name is jamie and i'm an engineer on the waypoint team here at hashicorp where i work alongside ray whose talk on using waypoint with oidc you may have seen yesterday i'm coming to you from my mum's house in the east of england so if you hear the sound of children running around in the background you'll have to endeavor to take it in stride as will i for the purposes of this talk we're going to step back into the world that ray created yesterday and i'm going to adopt the role of jamie intern at cranscorp as an intern i've been given the traditional task of creating the company's intranet i've been told that i need to deploy it to the company's kubernetes production cluster the only little problem is that i don't really know what kubernetes is i don't know where the production cluster lives i don't know how to access it and if we're being honest i'm not sure i even should have access to it what i do have though is this email from ray telling me that when i'm ready to start shipping i should check out waypoints well i think i'm ready to start shipping so first check out waypoint it looks like i can authenticate using the cranscorp identity provider that i'm already familiar with so let's try that the familiar blue the familiar green login screen i'll put in my credentials and we're authenticated okay i mean that was easy before we deploy anything let me show you the app first i know how to boot it up locally so let's let's see that yarn dev and it looks like it's built so let's go visit it in the browser what do you think quite handsome i think i mean granted i pulled most of it from tailwind ui but as a starting point i think this will do nicely so let's see about deploying it create your first project here okay uh project name let's call it cransnet grants.net and we're all about get ops at cranscorp so i'll connect to repo for sure okay create git source url okay i guess i can go to the repo and grab this so let's do that okay i'll copy that i'll take it back over here paste it in okay git ref uh let's go with main rather than head and i've already set up an ssh key for this purpose so let's use that username get and paste it in just here okay waypoint hcl config location well i know i don't have it in the project repository so i suppose let's go with the waypoint server okay i think now is probably a good time to go read the documentation let's see waypoint hcl overview okay rather than watching me read all this let's jump forward in time to the point where i figured out the minimal config and let's talk through it so i've called the project transnet i've declared a couple of variables here docker username and docker password these are variables that we'll use further down inside this config file so then i've declared an app called web and i want to build it using pac which is the cloud native build packs plugin apparently doesn't require any configuration i want to push it to the docker hub registry using this other built-in plug-in docker i will label it jg white krantzner i'm going to tag it with this get ref pretty helper function and then i'm going to make use of those two variables i declared above and then once things are built we will deploy and release using kubernetes which also apparently needs no configuration okay i can't believe this will work right off the bat but let's try initializing you know okay yeah there was no way so let's see um unset variable docker username a variable must be set i have a default value oh of course i declared the variables but i forgot to give them any values let's let's go do that input variables okay let's add our docker username in here docker username jd white save that and then let's add docket password to go along with that please don't steal my token okay let's see what kind of effect that had initializing again and the web app has appeared i i guess that worked let's take a look what's inside it okay nothing so far but there is a big inviting blue button in the corner so let's let's press it all thing with ssh as we said building web maybe if i have a look in that builds tab i can see what's going on building with pack that's right get some output data okay well this is going to take a couple of minutes so let's skip forward into the future again by which time waypoint has released the app web deployed it having deployed it having built it and emitted copious build output from cloud native build packs let's go and take a look at that deployment deployment v1 deployed by kubernetes it says it's available all two resources are reporting ready and dare i click on that url cranston it lives it's all there present and correct and even better i've got a real url that i can share with my manager the designers my colleagues ray herself this is wonderful what next um well if we know that waypoint hcl works i guess i could now commit it to the repository let's do that so if we go back to project settings let me go copy this waypoint hcl and let's go now back to my editor and stop that dev process let's make a waypoint hcl file paste that in there yeah it's all there okay let's commit that add waypoint hcl and push okay now let's uh flip back over to the waypoint ui and we can flip over to [Music] pulling the config from the project repository and now we might as well turn on automated deploys i don't see any reason why not i feel like i'm getting pretty comfy with the waypoint ui here but i imagine there's even more power to be unlocked by using the cli so let me let me do that i've seen that button in the top right this whole time luring me in looks like it's a one-liner i'll copy that go back over here paste it in okay that's all looked like it worked how will i try this out maybe the project list command there's my project um how about waypoint status status that's looking good let's zoom out a little bit great we've got that running so um now i'm kind of curious what does my deployment actually consist of inside of kubernetes let's go and see if waypoint can tell me so here's my deployment let's click on in here so deployed by kubernetes it's available we've already seen some of this it's telling me what image it used and that get get ref pretty uh and the commit that triggered this um this build as well and then below we've got some resources so the resources created by this deployment a deployment kubernetes deployment kubernetes pod and then for the release of kubernetes service let's take a look inside the pod i assume that's where the action will be so now i can see the health specifically for the pod and some labels and lots and lots of state chase on and i imagine if i knew anything about kubernetes then i'd know what some of this meant let's take a look at the service just for comparison similar kind of thing okay well how about let's take a look at it in the cli i know happens to know if you pass the app flag then you get a bit more info and so here we can see application summary deployment summary resources for the deployment and for the release great i feel like i'm really building up some momentum with waypoint next challenge let's change the app a bit and deploy again so let's do something simple really really simple we'll add in a new announcement to the list over on the right here's the data in turn deploys app so let's commit this say like add announcement and then push and then we will magically jump forward in time again at which point we find a second deployment has automatically appeared it's available do we there click the link again and there's the new announcement okay let's check the resources for this new deployment see what that's all about so webv2 deployment webv2 pod looks like it's sharing its release with the the previous one so just that one service called web but that makes sense what do i do next what's the next challenge this is going too quickly um i know let's um let's try loading data from a real database so let's see what do we need to do in here let's take away these statically defined announcements and then we'll need to send them in as a as a prop that should be all the changes we need to make here now let's jump up to the next thing above okay and let's paste in some data loading logic right here okay so i'm importing the client library implementing this get server-side props function connecting to the database and then performing the sql statement and then returning the response next i think i'll need my main like page function i don't know very much about this framework but i'm led to believe that i need to then plumb these props into this right here and then i guess i need to send them further on down into that home component okay i think that's everything let's try it out locally seems to have compiled let's go visit in the browser this is just using a local database at this point and there's my announcement okay well this works locally so let's commit those changes git commit say like load data from database or load announcements from database okay and then let's let's now figure out how to get that to work on waypoint so let's read the docs again i basically want to set up that environment variable so let's have a look into how you do config variables in environment variables so we go app configuration dynamic values internal values let's start with the overview and as we've done before let's jump forward in time to where i've read enough of the docs to understand what i need to do let's add a config stanza to my project now i've been told by the sra team that there is a database for me to use in this production cluster and there is a kubernetes secret that helm puts in place which i can pull the password from my app has permission to do that so let's first set up a variable it just pulls that password so this is a an internal um variable that we can use elsewhere it's going to dynamically pull its value from kubernetes a secret called db postgresql and the key within the secret postgresql password now what we'll do is define the nvars we want waypoint to manage we've got one called dburl which you saw earlier when we did this locally we're going to uh interpolate config internal db password in there into this overall url and i know the database url because again i've been i've been told it by sre okay let's make those changes add db url conflicts at waypoint and let's push okay well again this will take a little while to rebuild and redeploy so let's skip to the future where i've got a new deployment it's available dare i click the url i dare there it is it's live with my one announcement from the database in the production cluster hooked up to my app all managed by waypoint i'm feeling quite proud of myself at this point um what might be interesting to see is if my if my app has access to that data voice database data voice that database maybe i can access it from within the context of the app let's try that so if i want waypoint exec bash that will give me a shell in the context of my deployment note heroku in there that's because we're using cloud native build packs which you've built on heroku tech um so now i can use that db url that waypoint is managing and i can see my announcements table and i can select the announcements from that table and there it is so let's recap what we've managed to achieve i went from an app that i only knew how to run locally to deploying it in a way that gave me publicly available urls uh to deploying the next version and getting two distinct deployments which i can both of which i could view um to hooking up a real database and having waypoint manage the config variable that makes that database available to the app all in a completely declarative way without having to know anything about kubernetes along the way i mean ultimately i probably would like to learn kubernetes but for right now my main concern is deploying the application so um i hope you enjoyed everything you saw so far uh that's all from me the the that's all from me and it's also all from transcorp the fictional company for this demo the eagle-eyed amongst you will have spotted numerous places throughout the talk where timestamps in the ui betrayed me and gave away the fact that this wasn't really a continuous recording um but i hope that the impression was that the fiction was upheld anyway um so thank you so much enjoy the rest of hashi talks deploy and i hope you check out waypoint soon oh one other note some of the things you saw in this demo are from the the main branch of waypoint not necessarily in the current release version but they will be in a released version very very soon so uh with without further ado i hope you enjoy the next talks and see you very soon bye
Info
Channel: HashiCorp
Views: 90
Rating: undefined out of 5
Keywords: HashiCorp
Id: nX9GYl8SAIE
Channel Id: undefined
Length: 20min 24sec (1224 seconds)
Published: Wed Dec 08 2021
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.