September 20242:53:193.3k views

Building a Fly.io driver for Laravel Sidecar (Part 2)

About

Working on a new open source driver for Fly.io and Laravel Sidecar.

Transcript

Everything I said

00:00

Here we go. Looks like I am live. What's up, party people? Let's see if anybody shows up. I'm live on kick.com for the first time.

00:30

Why not? There you are. People are here. That's good. Hello, friends. How we doing today? How are we doing?

01:00

All right, let's make sure... Hello, Samuel. I need to turn the brightness up on that monitor just a little bit. Gonna make sure I am live on YouTube. There we go. Um, progress on sidecar is pretty good so far.

01:26

Uh, we're in a little bit of a rehab state. So I need to dig out from some PRs, but also, uh... Do I have an update? No, I don't wanna see that. Also working on this fly driver. That's better.

01:54

Hey, friends. So, we'll get started here in a second, but I wanna show you something else I was doing. Uh, where does that live? Code, life. So, one of the things that I wanna-- One of the things that I'm trying to do is, like, automate a bunch of stuff, including my

02:25

own Restream replacement. And I've gotten real into, like, uh, browser automation orchestration. And so if I do, I think it's browser, not browser use, browser provide. There we go.

02:51

So, all right. So this is a remote, or this is a, a re- a remote-controlled browser. Um, let's see. Need to move that back over here and move you. It keeps wanting to move that one.

03:11

I don't want that one. Um, okay. So this is a remote-controlled browser that I just started, and let's open this URL as well. And the cool thing is, if you look, see if I can get it all on screen here. Watch this.

03:35

This is just Chrome's remote debugging tools. So if I type on the left side, it types on the right side. And if I visit a URL on the left side, aaronfrancis.com, it visits that URL in the browser. And of course, if, you know, the browser automated goes to, I don't know, google.com, it shows up in my remote dev tools here.

04:02

And then I can say, actually, let's just click, I'm feeling lucky. And then let's click Generate. And so on the right-hand side, this is the browser. This is the remote debugger. That's pretty cool. Um, um, so the plan with this is to have, uh, like, have this browser running on a remote server somewhere and then whenever I

04:32

wanna, like, see what's going on or, you know, solve a CAPTCHA or enter a password or do something that, like, a human would do, then I could just load up this remote dev tools thing. How can I hide this? I just, I want that to go away. Um, I can load up this remote dev tools and control this browser that's running on a remote server, do whatever I need to do, and then, like, log into Twitter, for example, and then it could keep doing its work.

05:02

So, pretty pumped about that. Because while these are both running on my local machine right now, that's not gonna be the case in the future. That's the goal. That's the neat thing. And I have it all wrapped up in this nice little Laravel command, provide a browser.

05:30

Mm. Look at that. It's actually going over the remote internet. So the remote debugger's an Ngrok tunnel that's tunneled back to my local machine. Pretty cool. Hey, Dale. Hey, Duncan. I think I saw Alex as well. Hey, Josh. Gotta love the remote internet.

05:54

Better, much better than the local internet. Yeah, so actually, technically, I think any of you could hit this URL right now. Oh, I closed the browser, so no, you can't. All right. I also have browser, uh, use, and I can use the provided one, or I can use one that is running on Fly.io.

06:18

Um, so I kinda have two sides of the, the system set up. I just gotta make it work. Um, what are we doing today? Sidecar. Somebody asked if I'm more productive while streaming. 50/50, because I definitely get less distracted 'cause I'm not, like, not, like, uh, popping open Twitter every two seconds.

06:46

But I'm also talking to y'all, so you tell me. I think what I wanna do today, um ... As long as you don't ask about my setup, yeah. Um, Dale, do you do anything special to make Chrome more private?

07:09

Um, no, not really. You mean like my local Chrome? Everybody makes fun of me 'cause I run, I run two ad blockers. Um, I have whatever this one is, uBlock Origin and AdBlock Plus. I don't know why everybody makes fun of me for that. Is that bad?

07:30

I just feel like some of them catch certain things that the other one doesn't catch. Seems fine to me. All right, I wanna move all of this. Well, let me show you what we're doing. That is true. I actually, um, I actually don't care about privacy very much. All I want is convenience.

07:53

So maybe I'm not, maybe I'm not a good person to ask. Um, what is this start? Oh, that's the Tired Proxy thing. Um, we also need to decide if Tired Proxy ... Kill Tired Proxy? Can you open Twitter real quick?

08:15

Um, I don't know. Give me... What, what should I be looking for? What's going on, what's going on with Taylor Otwell? Oh, man, you got me.

08:39

That was too easy. Why do I trust everybody? That's, uh, that's an interesting question. All right. What we have done thus far, let's, uh, let's get this guy into... We need to open Fly.io, make that guy, put him in the right spot, open the dashboard, Fly Sidecar.

09:05

So I've been thinking about this, um, and I do think I can get everybody's functions in the same Fly app, which is gonna be an interesting challenge. So here's what we're doing. Uh, Laravel Sidecar. No, don't call it that. Sidecar for Laravel is this. Ignore the open issues and pull requests.

09:28

We'll get there someday. Um, deploy, execute AWS Lambda from your Laravel application. We are going to, in fact, deploy and execute, uh, Fly.io functions. So there is, what is it?

09:50

Elixir Flame? Is that what it's called? Fleeting Lambda, Fleeting Lambda application for modular execution. So this is, um, this is like an Elixir-specific thing, I think, and it's very cool.

10:12

But what you can do, it's, it's kinda similar to Laravel's new concurrency thing. Um, but with, with Flame, you basically have multiple copies of your application. Yeah, you treat your entire application as a Lambda, and module parts can be extracted. Um, so the VPC PR.

10:33

I just don't know anything about VPCs. I'll just merge it and see what happens. Um, but with Flame, you can say, like, "Hey, this is gonna be expensive. This FFmpeg call is gonna be expensive. Um, why don't we run that on a different set of hardware, or, like, fan it out to more hardware?" Um, and Elixir makes that super easy, where it's not as easy in other languages.

11:00

But Sidecar kind of approximates that, except instead of it being your entire application, it can be just a single, like, node function or, uh... It could be your entire application, I suppose. But, um, this is a philosophically similar model. The Fly version, that's a good question.

11:25

Will it be separate? I can imagine ... I don't want it to be separate, frankly. Hey, Jow. Jow? Joe? Jow? Uh, I don't want it to be separate, but I can imagine ... What's a good example?

11:54

Yeah, see, I could imagine having to do something like this, where you have to install, you have to install the right driver package. I could, I could see that being a thing. We'll see. I'm not quite there yet. I don't know for sure. But there is precedent that Laravel does it, which is good So we'll see.

12:15

I don't know. What do you... Do you have an opinion, I guess is my next question, Duncan. Do you care? Um, I just closed the wrong thing. Okay. I wanna move it into a Laravel application. Hello, Khalid. So let's create a new Laravel application.

12:37

Um, where are we? Sorry, my eyes, my eyes like light mode. Tough. Um, let's do... I co- I'm not gonna integrate it into the sidecar package yet. Is that actually what that is?

12:59

Is that the sidecar package for real? Yeah, that's the actual sidecar package. I think the rest of this is just toys. Um, okay, so let's do Laravel new, uh, Fly demo. Uh, we don't need a starter kit.

13:21

Uh, uh, this is just a test, I don't need that. Yeah, I like light mode. Um, sorry. I don't know what to say about that. SQLite. Yes. SQLite. Use Turso. Um, uh, I think, um, I don't need default.

13:47

Who's, um, Brent gd light mode? What's his real name? I think that's, like, his Twitter handle. Stitcher, there we go. Brent, "Light color schemes are better." I don't know if I believe.

14:15

I actually, I don't care. I don't care if light color schemes are better, um, because I just like them more, and that counts for something. Um, so did we... Yep. Hey, look at that. That's new, I feel like. Check out our boot camp or in documentation.

14:36

Herd Pro. Ha. The Babaverse books are amazing. Um, yeah, I'll read the fifth one, well, rather I'll have them read it to me. One of the great things about the Babaverse books is the, uh, narration on Audible.

14:58

In fact, it's only available on Audible right now. Um, I think he said there's some sort of, uh, some sort of, like, legal thing where he has to make it on Audible for the next 180 days, I think. Um, they're so good to listen to.

15:21

Oh, maybe that's why I liked listening to Project Hail Mary so much, 'cause I loved listening to that too. Well, let's, uh, let's make a command. So here's, here's my thought process. Um, I'm gonna make, I'm gonna make a command...

15:43

I'm gonna make a few commands to try to, like, approximate what the sidecar package is doing. Um, because what I don't wanna do, what I don't wanna do is, like, try to integrate this into the sidecar package right now, uh, and fight with some of the decisions I made when it was Lambda only. I kinda wanna get as far as possible proving that this will work in Fly, and then from there, once I have that proven, I can observe

16:14

the architecture of this Fly demo, and I can observe the architecture of the actual sidecar package and figure out what the best abstraction is. In fact, in fact, I did this a while ago, two years ago, two and a half years ago.

16:37

Um, I think this is before I had... Let's see, April. This is before, definitely before we had our second set of twins. I think it's just right after we had our first set of twins, and so I think I just ran out of steam.

16:58

Um, but I did a lot of, like, uh, abstracting of the sidecar stuff in this PR. Um, so you see we have clients, a Lambda client, a configurator. That's a fun name. What's a configurator do? Oh, that's nice.

17:21

That's a good idea. Good idea, Aaron. Good job, Aaron. Um, looks like a fast client function as a service. Create new function. So I did abstract a lot of this stuff out. Um, yeah, two sets of twins. It's wild. I wish you guys could hear this music I'm listening to.

17:45

Sidecar service provider, region, Vercel. What does the Vercel client look like? So Vercel's all HTTP, which is nice. We have version aliases, domain per function. See, that'll be interesting.

18:05

I wonder if I can set the domain on Fly.io based on the function name. That'll be interesting. Function variables So this is the contract I think that I have to adhere to. And here's where we create the Vercel deployment.

18:28

Honestly, if I could get, if I could get Fly.io done, I bet, I bet shortly after that I could get Vercel done. Here's the thing. My-- Everything... The only way that my family eats is if I make money. So when Fly was like, "Hey, we'll help, you know, we'll sponsor the development of this thing," I was like, "Great.

18:50

Let's do it." Um, so I would love Vercel to do the same. Um, see, this is interesting. I might yoink this for what we're about to do, and I'll explain what it is later. This is very interesting. I did a lot of work on this.

19:14

Okay. This is gonna be helpful. This is gonna be very helpful. Let us create a command. Um, so are we in the right spot? I think we are. Um, IBM Plex Mono. I think I use, I think I use JetBrains Mono, and I don't know what my theme is.

19:36

I think it's Neon Light modified. How does one find that? Uh, that's, that's not the editor. No, like, that's the, that's not the code theme. Um, editor, color scheme, Neon Light custom. That's what I started with, and then I mucked around with it a bunch.

20:00

All right. Um, AR make command. What should we start with? Um, actually, let's just start by running it all in a single big command. Um, okay. See ya.

20:26

All right, so this is deploy a function to Fly.io. What do we need to do? Um, yeah, I like light mode. I like my office to be light with no dark, you know, neon lights. I like my setup to be light.

20:47

I like my desk to be light. In fact, if you look at, uh... Is this... Can we do this? Oh, man, why'd that camera not show up? Well, we'll have to figure that out later. Um, yeah, my whole space is really light, which I really like. So the first things we need to do is, um, create a Docker image on using Fly's builder.

21:17

So let's hop over here. Kill tired proxy. Move it into a Laravel application. That's where we're gonna start. We're gonna skip this one for now. Um, and we're just gonna do it in this order, and then we will say that that is a to-do.

21:45

I think that comes up here. Yeah, let's do it that way. Ah, thank you. On air Mark, what's going on? Oh, I appreciate that.

22:05

Thank you. My entire goal is to work really hard and do what's right, and I'm glad that that is hopefully an inspiration to some. Okay. So move into a Laravel application, kind of done. That's the whole... That's everything that we're doing right here.

22:27

All right. Let us create a function. Um, so we're gonna create a new directory called sidecar. One thing I definitely wanna do is I wanna mirror... Thank you, Abhishek. Um, there was a, there was a kid in my class when I was in...

22:47

I was a junior in high school, and I was in calculus. There was a kid in my class. No. Yeah, I think I was a senior or a junior, and I was in calculus. And there was a kid in my class that was bused over from the middle school. He was an eighth-grader, and his name was Abhishek, and he was the smartest kid I've ever known.

23:08

It was like me, a, a 12th-grader doing okay in calculus, and Abhishek was just crushing it. So I have a fond association with that name. You must be very smart, Abhishek. Um, I need to adhere to sidecar for Laravel. I need to adhere to the same function signature. I think that's gonna be pretty important.

23:30

So handlers, and honestly, I'm fine with, uh, I'm fine with the way that AWS does their handlers. So this is a handler for Python. I'm looking for a handler for AWS documentation, Node.js.

24:02

Yeah, event context, CommonJS. Let's start here. Okay. So here's, uh, here's what a handler is. So if we just put a new file in here and call this index.js. Um, I'm gonna speak in AWS terms for now, Lambda terms.

24:23

Um- When you create a Lambda function, you say, um, what your handler is. So, like, when it invokes it, it gives it, uh... It, it knows what function to go find, and it usually works like it's the index. Um, and then I don't think you put JS, you just put the handler's name.

24:44

So if your handler was called foobar, then you'd have exports.foobar, and this would be the, uh, path to, uh, file index.nodejsfoobar. I think that's right. So if we open the docs one more time. Naming async/await.

25:11

Uh, where is it? Like, I want .handler. There you go. Right, there it is. The default in the console and for examples is index.handler. This indicates the handler method that's exported from the index.js file. So that seems like a common enough, uh, a common enough pattern that we're just gonna use that.

25:41

No, I'm not using SST. Go tell Dax. Go tell Dax I'm not using it. Um, Mark, Sidecar is a way to package, deploy, and execute Lambda functions, and we're making it work with Fly.io as well. So I'm gonna remove, uh, that. I'm gonna say exports.handler equals that event. Um, let's return Hello World.

26:06

Okay, so this is the goal. So just so we're all on the same page, this is, uh, user-generated code or user-defined. It's not really generated. Uh, Sidecar is the name of the library that I wrote. I think it's a good catch-all term, um, but I don't know if it's, uh, standard or, like, real.

26:36

Um, this is an example of what the user would write/deploy. Okay? So this is where we're gonna start. That should honestly be plenty. Now, here is the challenge. How do we get that? How do we get that to Fly.io?

27:00

Um, so let's first look at all of this stuff. We need... So Fly.toml, we decided, was an application-level thing that I don't think we need necessarily, question mark. Um, so let's yoink all of this. Let's take all of that and come over here, and we're gonna make a little scratch directory called...

27:33

Actually, in fact, let's do it in here. So let's say that this is, uh... And then we'll put a support directory, and then we'll put a Node.js directory, and we're gonna put all that stuff there. Um, so this is kind of mirroring what I think the package structure is gonna look like.

27:57

So we're gonna have to have different handlers for... They're not quite stubs. We're gonna have to have different handlers for different, uh, languages. I can't write all those, but hopefully somebody will. Um, I think we're gonna kill Fly.toml. We'll just kill that for now. Notes, that's fine. I don't care if that gets deployed.

28:17

Fastify we need. Server, so this is where we gotta do something different. Um, hmm, there you go. Perfect. Kubernetes. You know, of all the things that I've avoided, Kubernetes is one of them.

28:39

Uh, Kubernetes, Docker until now, the first Angular, the second Angular, uh, React, TypeScript. What else have I avoided until it just went away? TypeScript hasn't gone away. Um, like Ansible, Puppet, all that stuff went away. GraphQL, I avoided that.

29:01

Um, I did do Grunt back when we had to do, like, Grunt and Gulp. I did those. Uh, yeah, I don't remember. I've avoid... I've successfully avoided a lot of stuff, which I'm very proud of. Um, all right.

29:25

So I think the open question is, uh, we need to get the user's code in here. That's what we need to do. So we need to... Uh, I think up here, we need to import the user's handler, and then call the user's handler

29:56

with request and reply. I don't... Is reply like a callback function? No, I can just return. Maybe that allows me to control headers or something. I don't know if I want that. Hey, Sam.

30:17

If y'all aren't following Sam, you need to follow Sam. Let's find Sam. Sam who? If you're not following Sam Hoo, you should follow Sam Hoo. He writes extremely, uh, high-quality in-depth guides on programming.

30:41

So go follow Sam Hoo. Sam Hoo, two O's. Um, I don't know if I need to give them access to the request. I think I'm gonna shim that or take over that. So I'll just call the user's code, um, and return the...

31:06

Is it a response? Return the result as a response. All right. If we can-- This is the thing we need to prove first. We always gotta prove the first things first, right? Um, so before we do anything more complicated, uh, you guys make me laugh.

31:27

Uh, before we do anything more complicated, we need to do the thing that is simple to see if it works. Don't try to prove 15 things at once. Try to prove one thing at once. Um, okay. So I think actually the first thing we need to do is, um, create a working directory.

31:53

So let's do that now. Um, oh, goodness. Which of the many files... I always get tripped up on the storage versus file facade. Does anyone else get s- get tripped up on that? 'Cause there's like, is it file system?

32:14

File system. There you go. See, do I need to do the whole... File system. See, where's Laravel Idea on that one? Why does that not work? Oh, probably need to call the right file system facades.

32:41

It's just file. There you go. Yeah. What's the deal with file versus storage? Why does that still exist? I'm sure it exists for a good reason, but I don't know what it is. Um, ensure directory exists. We are going to ensure that our working directory is, let's do app path.

33:06

Nah, that's wrong. Let's do base path, um, sidecar. All right. Let's ensure ar app. What is it called? Deploy. There we go.

33:27

Sidecar. Okay. Um, yeah, file's local file only. But yeah, but storage can be local too. That's what I, that's what I... I think that's where I get hung up. Um, and, like, all the methods are different. Um, okay, so we have a working directory.

33:50

We've ensured it exists. Um, we'll need to clean it up later. Clean it up later. Then what we need to do is we need to move everything from the support Node.js. Um, so file copy directory.

34:13

Um, so I hate it when PHP Storm does that. Um, copy directory from, to. Okay? So let's copy... Where is support? Support is in... So we're gonna copy app path, uh, sidecar.

34:34

All right. Look at that. That's Laravel Idea. That's pretty cool. And then we're gonna copy that into, uh, working. I think that's right. See if that works. Cool. That works. And then I think what I want to do is, um...

35:01

So we did that. Um, I wanna copy, I wanna copy the user's code, which will need to be, you know, it'll need to be a variable or a, yeah, configurable location, but I'm not worried about that. So the user's code lives in base path sidecar.

35:23

Uh, that's it, base path sidecar. That's what I want. That's the directory. And I wanna put this in... Should I type user or be awesome and type U-S-R? Like, that seems cool, right? Let's see if that works. So, hey, look at that.

35:47

Look at that. Mm. So now let's go in here. So what I'm doing is this is basically, this is basically the package that we're gonna turn into a fake Docker. Or it's, you know, real Docker, and then, uh, Fly transforms it into a lightweight VM. So if I'm in here at server, can I do this?

36:11

Y'all are gonna laugh so hard at how little I know about JavaScript. Import, uh, what did I call this? Handler. Import handler from... Or do I have to require it? User- Hmm.

36:35

Does that seem right? This is PhpStorm. Uh, handler. I feel like I should do, like, apply or call, but we'll just stick with this for now. Event and context. Um, I think I wanna, I wanna shim. Yeah, so import feels right.

36:59

They're doing require, which I feel like I should change later, but I'm not worried about that right now. Um, so we'll say that context and event are both empty, and we'll return... Yeah, I agree. It is deeply confusing. Um, return "Hello, world." I feel like that's a...

37:21

Yeah, it's PhpStorm. Um, okay. So then @todo context and handler, question mark. So theoretically, theoretically, I can deploy this, and it'll run the user's code.

37:47

Um, so what I'm gonna do, I'm gonna copy all of that and move it back to... 'cause that's gonna go away. I'm gonna move it back to sidecar-support-server. This is, uh, hard-coded. Okay.

38:12

So now, um, if we run this again, it should generate the correct package. So user is "Hello, world," server. Let's change this to 3001 and just give it a go, see what happens. So where am I? I need to CD into sidecar NPM run dev maybe.

38:42

Oh, probably just, uh... Run this as a... Uh, what? Um, set type. Oh, do I have freaking, um...

39:10

I can use module to import. Dang. So that means I probably need to change. I should be doing this somewhere else. That means I need to change import Fastify. I don't care if it has a logger. Restream, stop doing that.

39:31

I don't care. Hate how it puts those messages in there. Like, I didn't ask you to do that. Okay, so it didn't really work. Oh. Is that it? Hmm.

40:12

We gotta, so we gotta simplify. Ooh, you might be right. There you go. Um, and then we gotta come in here, and we gotta say... I thought, I guess that's a CommonJS thing. See? Man.

40:49

See, I don't know, man. Export function handler. Uh, that's fine, but then it complains about something else. So Fastify.get is not a function. Did I import the wrong thing for Fastify?

41:14

Good thing we're doing this locally instead of trying to deploy it and test it over and over and over. Oh, export const is cool. I'm trying to figure out if I did this wrong, 'cause it seems to think that Fastify is not, Fastify.get is not a function.

41:40

That's a YOLO guess. Um, hmm. I do like a YOLO guess. Getting started. I just want, I just want to get started. Um. What the...? Wouldn't have gotten there, let's be honest.

42:07

Okay. Okay. Ta-da. It's okay to not know things. See how few things I know? I'm still doing just fine. You don't have to know things. That's not true. You don't have to know everything. You can learn anything.

42:29

Um, okay. So we are good here. We need to, uh, take all of this and put it in the right spot, 'cause I was doing it in this generated directory. Uh, I don't know the first thing about Web3. Sorry. Okay, so this should be correct now, and I think I need to take this package module.

42:59

That should be correct now. Did we change anything else? We changed the user code quite a bit, didn't we? Okay, so that should be right. Man, don't ask me about Fastify versus Express, for I do not know.

43:22

So if we get out of here, and then we run AR app deploy again. Now, if I change into sidecar NPM run... No, that wasn't it. It was, like, just node server, wasn't it? Okay, we have a package generated that should work. So the next step is, let's close that out.

43:49

We need to go back to, what's the name of that? It's called deploy. All right, so we, um, gonna move this to the bottom. Clean up temp dir. This is what we're doing right now.

44:11

Um, so we'll say, "This line, creating package for deployment," and that's these guys. And then we can say, um, "Building Docker image via," that's a good word, "via Fly.io." I feel like Docker should be big, right?

44:43

Ooh. I'm glad I give you confidence. Um, people talk about streaming being scary, 'cause it's like you're on camera. No, s- streaming is scary because when you're sitting alone, it doesn't matter if you're like, "I should know how to do this simple thing, but I don't." And then you turn on the stream, and you're like, "Hey everybody, I should know how to do this simple thing and I don't." And that sucks.

45:13

Okay. Um, we're gonna use the process facade. We're gonna use the process facade. Let's just start here. Um, we can now comment all of this out, 'cause we haven't done any cleaning up, so it's not like it's gonna go anywhere.

45:36

Um, let's look at process run. Let's just start there. Um, process equals process.dump process output.

46:00

So if we were to run that now, we gotta get out of here. We gotta go back here. If we were to run that. Cool. All right. Max, I have not muted you. I have not muted you anywhere, in fact. Yeah, making video courses is tough, man.

46:26

I wish this, um... I don't know why this overhead camera isn't working. Let's do video. Overhead. Oh, it's not on. There we go, 2160p.

46:50

That's why. So now, hey. Well, you can't see it, but all of my, uh, all of my course Post-it notes are over here. I'm on a path where I need to record, like, between six and 10 videos a day, um, to hit our deadline, which is, which is doable.

47:13

But boy, is it a lot. Um, so that's my life right now. My life is just record Postgres videos. So please, please go to masteringpostgres.com and sign up. Um, yeah, Travis, exactly. Exactly.

47:37

Um, that is my life. I've got, I've got stuff I gotta do, and then I've got stuff I gotta do. That's it. That's all. It's just stuff I gotta do, always. Hmm. Thank you. I'm glad you enjoyed the SQLite course. SQLite course was good. HighPerformancesqlite.com, sponsored by Turso, the same people that are, uh, helping me stream these days.

48:04

So we appreciate Turso. Those, those logos down in the bottom right, those are the people that are helping me have time, well, be able to justify streaming. Um, time is a separate question. Um, okay. So we... Can I show you what I bought for my mouse?

48:26

Um, how many coffees do I drink? Too many. I need to show you what I bought for my mouse after somebody on Twitter, I f- I'm sorry, I forget your name. We're gonna go to Amazon, and we're gonna look at my purchases. But I don't want you to see all my purchases, 'cause it's probably like- Well, paper towels, diapers, gloves.

48:47

Yeah, there you go. Okay, so y'all think I'm crazy, right? This only will further that notion because I bought this. It's $30. It's a write-off. Come on, it's a write-off. And look how silly this is. You put your Magic Mouse into it. You put your Magic Mouse into the base.

49:10

Not one with batteries. No batteries. Isn't this awesome? Exactly. Isn't this awesome? So right now, right now I have this. Where's the camera? It's kinda dirty. Um, yeah. See, it also falls off.

49:34

Um, that is a, uh, little silicone bump that they used to sell, uh, but they no longer sell it. Pity. So I bought that thing. We'll see. I think it, I think it does let you charge. I think it's like a- a, like a battery base.

50:01

I think. That looks like, like it's got... Oh, I wonder if that's just for alignment. Oh, that sucks. Um, yeah, vertical mouse. Vert- vertical mouse, and I'm the weirdo? Give me a break. Um, all right, we get process output, so we are ensured that the process is running.

50:29

I think we're gonna wanna do a bunch of other stuff, though. Laravel processes, um, must run, time out. Yeah. Forever run, time out, idle time out, forever. So you can do all this. Z- z- z- z...

50:52

Does that matter? I don't know. Uh, focus. So let's do, what is the command? Notes. So the command to create the image. This is why you always, this is this is why you always keep notes. Um, I think this is right.

51:22

That's not right. We need the command that creates the Docker image. There you go, fly deploy. All right, so we're getting close. I mean, close to what? Who knows? Uh, fly deploy. Oh, is fly an alias for fly CTL?

51:44

Do those both work? Cool. Um, so ensure that fly is available. Fly CLI is available. That's gonna be a trick, I think. That'll be... I- I'll probably, in fact, you know what would be a good idea?

52:07

Um, create a command to install the fly CLI, which is gonna be like, um, artisan sidecar. I hate that it's, I hate that it's that.

52:30

I don't like that. Um, but that's fine. Uh, yeah, we'll k- start keeping our notes over here. Yeah, which fly? That's probably what I will rely on. Um, I'm gonna delete these notes so that I don't think those are the ones that I'm referencing.

52:58

Um, yeah, and if it returns nothing, I can just bail out. Uh, PHP Storm does that for you so that you don't, you don't forget your to-dos, which is quite nice. All right, so I need to run this not in this directory. Um, directory path.

53:27

Look at that, freaking Laravel, man. Path, run, and the path is in fact the working directory, so that's nice. Um, now, how do I stream, how do I stream the output? Um, I think it's like function.

53:49

There you go. By passing a closure. Closure like hosier. Closure. Um, let's drop that down. We'll put you there. Uh, and I think, isn't must run... I thought must run was a thing.

54:14

Yeah, I guess not. Hmm. That's a good point about Windows. Don't use which, won't work on Windows.

54:36

Question? Don't use which. Um, so this, so this output is where the machine image Like the path to the machine image lives, so we are gonna need to parse that. But let's just see what happens. Ah, there you go.

55:01

So we got info. That's cool. Um, I have no idea. That's a good question, Josh. I have no idea. Um, somebody in chat the other day said that the creating of the Docker image stuff, like, created a, uh, WireGuard VPN tunnel or something, and that went way over my head, but they said it looked hard.

55:25

Um, so we need an app string, which is gonna be a to-do, uh, 'cause we have to figure out later how to do that. But what is our app name? Our app name is Fly Sidecar, so Fly Sidecar.

55:49

Let's see what that output gives us. A lot. Looks like it's building to me. Ta-da. Ta-da.

56:11

Um, so it's pushing up the layers that have changed. Um, I'm gonna have to parse through all of that. That's what I'm looking for. Um, I'm looking for this exact thing.

56:39

So you know what we do now. You guys know what we do now. We do some freaking regexes. Image space... Oh, is it just that? I don't need a, I don't need a regex at all, in fact. Um, ah, let's just keep going. Uh, A through Z, A through Z.

57:01

Actually, in fact, uh, the app name is simply not a colon multiple times, and then a colon, and then we wanna capture through the end of the line, um, multi-line. We wanna capture through the-- Uh, we wanna capture anything multiple times through the end of the line.

57:28

All right, let's take that, and I don't think we need to watch it necessarily anymore, so we can just run it, and then we'll get the process output. Output equals, and then, uh, our pattern equals that.

57:50

And then, boy, I'm rusty here. Um, PHP regex match. PregMatch, that's right. PregMatch. And in fact, I actually don't know how this is formatted. So if we just yoink that, and we come back here and we say that output is in fact this, and then we were to take all of this.

58:19

Yoink. That's mine now. Here we go. Return. PregMatch takes a pattern subject and then, uh, matches. So we'll do a pattern subject is output, and then we'll put our matches in here, and then we'll DD matches.

58:41

This is the ugliest... This is my least favorite thing to do in PHP. I hate it. Uh, ah, Miguel. Freaking Miguel. He's so smart. Seven years old. Oh, bummer.

59:02

Um, is this wrong? Delimiter is used in regular expression. Oh, in fact, that is correct. Uh, and I believe we can do start of line, so we might as well do that. I do not, um, like relying on the ...

59:25

I don't like relying on the output because I'm 100% positive that that is not covered under any backwards compati-compatibility anything. Um, so this may be... We need, we may need to find a more robust way to do this, but for now it's okay. So if we were to run no matches, so what did we do wrong?

59:52

Let's narrow this down a little bit. Let's say that PregMatch, oh, all. PregMatch all. String subject matches. Yeah, nothing. Docker, Docker, Docker. Chris, I'm not gonna do it.

1:00:13

You can't make me do it. I don't need to do it, and I don't wanna make other people do it. Um, so let's do this. We're gonna simplify. Okay, that worked. So then the next question is, does beginning of line work?

1:00:38

No. So I think we need flags. Int flags. Preg, Preg, Preg. All right, let's try this. Oh, goodness. What are we trying to do? Um, the flag is PregMulti Reg.

1:01:01

Let's just go look at these. Maybe the beginning of line is not what I'm actually after. Not there. All right.

1:01:23

PHP, PHP regex multi-line beginning of line. That's not an answer to his question. I hate it when people are like, "I have a question," and other people are like, "Nah, you shouldn't do that." Like, come on, man.

1:01:50

Uh, ah, that's what it is. It's the G. I think it's like GM. There you go. Global. We'll just start with multi-line. Okay, that worked, and I think GI is probably fine, too.

1:02:12

G is not real. I guess that's pretty much all handles that part. Okay. Thank you. That was the correct thing, and then we got a yoink. That's out. Look at that. We captured it.

1:02:33

Here's our match. That's our full match. Here is the capture, although that's not quite right. I gotta capture that as well, so my regex is wrong. Um, isn't it? Yeah. I need... In fact, I need this entire thing.

1:02:56

That was very silly, Aaron. I need from you all the way over to you. That's what I need. All right. There's the full match, and there's the captured match. So that's our, uh, that's our registry URL. Cool? Cool. Um, so now we can get rid of you.

1:03:25

We can take you and put you back where you belong, which is down here. Uh, I don't need a temporary variable for that. Uh, what was the structure here? It was an array.

1:03:47

I hate how they do this, and I think there's a flag to switch it, but that's fine. The matches end up in the second array, um, or the captures. So captures equal, we're gonna use r get matches one. We're gonna default it to an empty array.

1:04:07

Is that the right order? Array key default. Um, and then registry equals r get captures zero with no default. If not registry, throw new exception, uh, no Docker image created.

1:04:36

All right. Let's, in fact, let's go back up to the top. We're gonna take that, just make sure that we did that right. Oh, I don't need a return after a DD. Take this pattern, come back up to the top, and then we're gonna put this guy back.

1:05:02

Oh, F. That's fine. Okay. Does that work now? I DD'd the wrong thing. DD registry. That's not a very good name. There you go.

1:05:24

Cool. That worked. Um, that totally worked. Oh, somebody asked how many cups of coffee I drink. Start with an iced coffee, uh, rather a cold brew from White Rock Coffee, local. And then sometimes I'll move on to just a, just a Keurig.

1:05:49

Don't, don't tell the Terminal boys, but I just, I just drink Keurig. Oh, you know, you just can't optimize everything in your life. Sometimes you just gotta do what's easy. Mm. Okay.

1:06:20

Uh, Josh, I'm off Diet Cokes, to my great shame. I used to drink three to s- six Diet Cokes a day every single day, and it was awesome.

1:06:40

I was alive, man. Just that crisp, cold bubble. Um, and then I got diagnosed with rheumatoid arthritis just, like, out of the blue, um, after we had our second set of twins, so December of last year So we had these twins, like, November 22nd, and then in December, I, I think was so tired, so stressed, just

1:07:12

maxed out that I got rheumatoid arthritis. I already have type one diabetes, which is unlucky, and rheumatoid arthritis is a, is a autoimmune disease as well. And so it's, it's more common to get it, uh, when you... to get a second one when you have a first one. So lucky me. And, uh, so I started, you know, trying to find all the medicines that would work, and I've been able to cut back on every medicine except one for the arthritis.

1:07:42

But as a part of that process, Ian convinced me drinking six Diet Cokes a day was not a good idea. Um, so now it is one to two cups of coffee a day and no caffeine past, past noon. Um, and I will sometimes, like when I go out to lunch or out to...

1:08:05

not dinner, 'cause it's too late, but if I go out to lunch with somebody, um, I'll sometimes get a Diet Coke, and boy, just hits right. Feels good. Um, do I need anything in this clipboard? I do not. So I'm off Diet Cokes, unfortunately, like a big old dummy. So then once we have the registry, what do we do?

1:08:30

I think we can... Let's just go ahead and do this part as well. Okay, so now we're going to create a machine but not start it. Is that right? I think that's right.

1:08:52

To create and run a machine. What? Why didn't you write anything? Nothing, nothing was written there. That's not helpful. Um, okay. That's fine. Create a machine, but not start it. So now that we have this, I don't think it matters what directory we're in, but we'll stay where we are.

1:09:18

Uh, this is hard-coded. Um, s- s- s- this whole thing got dorked up. There we go.

1:09:41

Create machine registry. Need double quotes. Swap. Not, not to a now doc. Replace quotes. There we go. Uh, the registry, and let's just go ahead and make that a variable 'cause it's going to need to be at some point.

1:10:06

App equals Fly Sidecar. Um, and I can replace that. Replace quotes. Fly app. Mm, mm, mm, mm. Uh, Squark, tell me what those commands are.

1:10:35

Give me somewhere to look. Man, drinking a, drinking a ice-cold Diet Coke when you're out, is there anything better? This is quite a long line, so in fact, what we're gonna do is we're gonna do it that way. Fly machine create this image.

1:10:59

I don't like it being called registry. That makes no sense to me. Um, that's better. What am, what am I, what am I missing, Squark?

1:11:35

Is it a sub command? See, see what I'm missing, 'cause I think I'm missing something. Um, all right. Create. Yep, yep, yep. I probably wanna watch this output for now, which I don't remember. Signature there.

1:12:00

What did I copy? Copied from there to there. All right. Um, okay. So let's give ourselves a little heads-up. So that'll throw, um, Docker image built at image.

1:12:35

Oh, yeah, it does taste metallic. It's so awesome. Um, auto stop, suspend. That all seems right. That all seems right. Uh, it's gonna give me the output. All right, let's try it. We already did that. This is what we're doing right now.

1:12:57

Deploy the machine into the app. So if we run Fly... not Fly. Uh, AR app deploy. Building Docker image. See? Now it's starting to get awesome You see that now, like, we've committed, um, we've committed the process to code.

1:13:18

Well, didn't work, but that's okay. We've committed the process to code, and now we just get to, like, hopefully run it over and over and over. Let's see what happened. Um, let's dump this out. I think it was type output maybe. Uh, let's get this little chaotic formatting going.

1:13:47

Um, let's go ahead and dump captures as well. In fact, uh, let's just dump it all out at once. Building, maybe.

1:14:20

No Docker image created. Huh. Oh. It's the exact same image, so it looks like the, uh... It looks like the output is different.

1:14:41

That's why I don't wanna rely on the output. So let's see what that output actually looks like. If we go to CD sidecar, and then Fly deploy app app build only push. So I think what we're running into is a different output.

1:15:14

Huh. Huh, that doesn't look right. Fly image? What? Is there not, um...

1:15:40

Hmm. I don't see a list yet. This is about apps, not about specific images, which I don't think... Or, you know, even machines, which I don't think is right. And it takes forever. GraphQL.

1:16:03

So, why... This does seem like the output is the same. So what were we getting from... Hmm, maybe I need to remove the start and end of line thing.

1:16:35

Geez, come on, man. Let's go. Push, push, push, push. Let's go, let's go, let's go. We got stuff we gotta do. Oh, man. Hmm. There we go. Yeah, what i- what is this? Okay, that's fine. It's

1:17:05

a lot of output I don't understand, I'm gonna be honest. Um, see, but it still says... All right. Let's, uh, let's do it this way. Let's get out of here. Let's clear that, and let's in fact, um, well, let's do Fly update.

1:17:26

Is that right? Upgrade? Oh well. If you want me to update, tell me how to update. Um, okay. We should stream this output so we can see exactly what we're looking at.

1:17:51

Type and output, echo output. Figure out why our regex isn't working. Ah, hello, Florian. We are indeed back. See,

1:18:28

I feel like that is the string that we're looking for. Maybe my, um, maybe my regex is all funked up. See, what is this? What is that? Where does that come from?

1:19:01

Oh, Twitch isn't showing up? That's frustrating. I'm sorry. I didn't know that. I appreciate you coming over here to say that. I'm sorry Twitch isn't showing up. Yet another reason Restream- Is the worst. Um, I don't understand this output difference.

1:19:27

I'm gonna remove the start of line, end of line. 'Cause this looks-- that looks like what I want. Let's do fly image again. Yeah.

1:20:03

I don't think that works. Um, all right, we're gonna try this. We're gonna remove... You know what? Actually, I just want that. We're gonna remove end of line. We can remove that dump. Um, I think I can-- This may be helpful.

1:20:28

I think I can look for the app name. We'll do that in a second. I think I'm guaranteed that that'll be there, so I think we can do that. All right, let's try this again. There's a bunch of stuff, bunch of stuff, bunch of stuff. Oh, you're right.

1:20:58

If I turned off multi-line. Yep, there you go. Um, so I want everything, I want everything followed by a space. Oh, it tried to run the command.

1:21:28

Wasn't ready for that. Um, okay, we're getting closer. So if we do this now. Daniel's correct about the dot over-matching, greedy. I guess I need, like, not space here.

1:21:51

Here's what I can do. I think I can replace... Let's just get rid of that. We're gonna get rid of that. And then I can put the app name here. I can just, like... That will be good. And then I want, what is that? Not space. Not space multiple times.

1:22:18

That seems right. Good. All right, so if we take that... Yeah, yeah. Do I-- I think I just want space though, right? I don't want white space. I just want space, space. I think. Tell me if I'm wrong. And I do wanna capture the whole thing.

1:22:44

And this, that needs to be escaped. These quotes need to be replaced, and this needs to be variablized. Is that real? Is that a real word? What if they switch it up and... Ugh.

1:23:06

I guess, um... It's fine. Let's try this now. All right, come on, baby. Got it.

1:23:34

Freaking nailed it. Um, okay, cool. So that works. Oh, that's interesting. What do you do? Um, huh. Big S. Ah, look at that.

1:24:01

Doing this 20 years. That's cleaner. We dig. We love it. You know what? I don't think this-- I think this is silly. Could I, could I do matches one dot zero?

1:24:25

That's legit, right? I think that's legit. So if, uh, matches is an array, and item zero is also an array, and item one is an array with a match in there, that works, right?

1:24:51

Yeah, that works. And then if there's nothing in there, yep, that's right. And if that doesn't exist, yeah, that's right. Cool. We did it. Um, so we can simplify that thanks to Laravel's, we don't need double quotes. We can simplify that thanks to Laravel's, uh, array gett-getter.

1:25:17

Um- Okay. If not image, throw new. That's fine. Is null's better, but I don't care. Um, all right. So now Docker image. Now we can say, creating new machine. I have, uh...

1:25:38

And I don't think it does, so Fly, um, I don't think any of them have a JSON output. That's actually JSON, so, um, that is valid JSON, so maybe that's not true. Um, what if we, what if we just tried this?

1:26:02

What if we went into Sidecar, and we did Fly deploy? Does that do JSON? Unknown flag. Yeah, I thought so. Um, creating machine. What is nice here is to show, um, what the actual command is.

1:26:34

Running command. One, two. Ah, F. What's the, um, Unicode box characters?

1:27:01

Which one do I want? I want you. Uh, no, I want it over here. All right. Let's see if this works. So what are we running?

1:27:22

We're running Artisan app deploy. Ah, F. I left that on. I don't need that. Ignore all this. That's very, uh, extra. I don't need all of that. Hey. Okay.

1:27:44

Um, I probably wanna parse that out, so let's just take this. Uh, create a machine but not start it. Yeah. We can get rid of you because I don't need you anymore. Condolences. Also you, we can make you more normal-looking.

1:28:06

You're still quite long, so we'll leave that as is. Um, let's just YOLO it and see if we can get it right the first time. Output. We're gonna take, uh... Yep, yep, yep, yep. And then I will need to figure out how to roll machines, like destroy the old one and activate the new one.

1:28:29

Hey, focus, man. You're not doing that right now. Uh. All right, so that is the output. So I probably want... You know where we're going now. You know where we're going. I want machine ID, colon, space, capture.

1:28:52

Uh, can I just do... That's wrong. Am I guaranteed they're alphanumeric?

1:29:14

That's a good question. Think I'm probably guaranteed they're alphanumeric, but we should probably go... Can we just do that again? Let's see if... 'Cause that'll match new line and space, and I think we're just gonna go with that.

1:29:42

So if we say that the pattern... I don't think I need multi-line there, but that's fine. Then we're matching, and we'll say that the machine equals... I think that's gonna be the same.

1:30:03

But while we're here, let's dump matches. Don't need you anymore. And let's dump machine. We can DD machine. All right. So if that's the output, I think we'll be close. Um. Hey, Linus.

1:30:32

Building Docker image. This is... I think this is close to what the user of Sidecar would see. The reason I'm, uh, the reason I'm deploying and then... God, that looks good. Um, creating the machine and then waiting to build it later. Bonk. Yeah. Is I need people to be able to build these machines when time is not of the essence.

1:31:00

So either build it locally, build it in GitHub actions, build it wherever they want, 'cause you can see it, it might take a while. And then when they, uh, deploy their new code or they activate their new release, I need it to be, I need it to switch over super quick. Um, and so I have to separate it into a two-legged process So let's look in our Fly account, 'cause I bet we're all over the place.

1:31:36

Hello, wake up. So here's something interesting. Here's something interesting. This is not gonna sound interesting when I say it, but you have to believe me, it's interesting. You can give it a vanity name, or let me rephrase, I don't know that that is true.

1:32:02

A vanity name has been assigned to this machine. Is that a good way to keep track of state of my functions? We don't know. We do not know. Um, what about Fly machine?

1:32:25

What do you do? List. Guys. Fly machine list. Uh, app is Fly sidecar. Okay. Uh, how about this?

1:32:47

JSON. Get out of here. Oh. Um, easier? I don't know. Easier, I don't think so. Better, maybe.

1:33:10

Maybe. So here's one thing that we've learned. Um, we can list the machines. However, I don't think we can list the images unless there's... unless I'm just, like, being dense.

1:33:33

Fly image, there's no list. There's just show, and image detail, and update. I mean, yeah. So we're kind of hosed there. But this is interesting. I think this might, this might potentially be useful. Um, yeah, Dan, that is correct.

1:34:02

Um, it does have the image in the machine list, but that's because I have created a machine with the image. Like, I can't find... Unless I can just, like... I don't know what a registry is. What if I just, like... Seems like that would be bad, yeah. Might be better off using Fly deploy with the image so it handles replacing machines and/or different strategies and health checks.

1:34:29

Yeah. Yeah, yeah, yeah, yeah, yeah, yeah, yeah. Um, Fly releases. What? What? Um,

1:35:01

I don't think that's right. That's a release, not a, not a new image that was created. Um, yeah, Mac. We're, we're one step before machines, though. I'm at images. So, like, if we look at right here, we create an image, and then I pull the image out of the logs.

1:35:28

Is there a way to list images that are not associated with a machine? 'Cause everything that's associated with a machine comes from here, where I do Fly machine create, but I need that image first, if that makes sense. So unless they give me a listing on the registry, I don't know how I get it without parsing the output.

1:35:52

There may be a way. I don't, I don't know. Um, I know very little, but that's what I'm, that's what I'm struggling with. Um, let's make this, um, create an image. This'll be cleaned up later.

1:36:15

But I just wanna do, um, create a machine based on the new image. Get all that. Mm-hmm. So now the machine is created, and then this is not necessarily how we will do it, because it'll have to still, it'll still have to be

1:36:45

a two-legged process. Um, but I want to activate the new machine, kill the old machines. And so that machines list thing might come in handy right here. 'Cause that'll give me, that'll give me all of the machines and tell

1:37:16

me which ones I can stop. Uh, yeah, that's what we're doing right now. Let's go to the notes. What have we done? Uh, yep, yep, yep. Yes. No, no, no. All right, so if we come up here, and we say...

1:37:40

Yep, did that. We say return, um. Let's try this. If we did Flymachine list, output equals process run. How does that look?

1:38:23

See, it's not real. I don't think the JSON's gonna be valid. Yeah. I, uh-- How do I get rid of that? I don't know where that is coming from, but I gotta get rid of it 'cause that's not JSON.

1:38:50

That ain't gonna work. Hmm. Why is it doing that? If we CD into sidecar and we run Fly machine list... Okay, so it's not doing that here. I wonder...

1:39:20

No. I don't know where that is coming from. Does anybody know where this would be coming from? 'Cause when I run it through the Laravel process facade, I get these two debug lines. But when I don't, I don't get them.

1:39:44

I wonder... See, I'll-- Here's another thing I don't know very much about, and that's, uh, terminal formatting and stuff. Is that invisible? It is possible that, OT, it's adding debug. Yeah.

1:40:10

How do I... So if I were to run it, do I-- Can I replicate? So if I were to run this manually with debug on, is that what we're getting?

1:40:37

See, even then we're not getting that. It's weird, right? What if we added, like... Is verbose a thing? Didn't complain. What do I not know? Why would that be, why would that be running?

1:41:06

Yeah. Where do, where do you come from? Um, where do you come from? Where... Why would you do that? Where do you come from, my friend?

1:41:36

Log level equals debug. So if I do that, can I replicate it? Boy, we're figuring it out together, aren't we? Um, if I do log level debug... Actually, let's get you on the screen first, then log level debug.

1:42:04

Kind of? Yeah, there's the GraphQL, there's the... That's nice. That's, that's kind of, that's kind of nice. Um, I think it is setting log level to debug. Oh, it's passing in, it's passing in my Laravel.

1:42:37

Um. So I got clean... If I change it to info, I got clean, uh, JSON there. So is it ENV log level?

1:43:05

Is that gonna do it? Funk yeah. Good call, Ahmed. I think you are absolutely right. Oh, man.

1:43:27

Y'all look I think, I think, uh, X.com is, is changing a little bit. Look at all these people going live. That's, that's a lot. I think that is a lot of people going live on Twitter. Um, that feels new.

1:43:49

I think whatever they're doing is, is working in that regard. All right, so what did we learn? It's always important. What did we learn? Um, we learned that log level info silences a lot of the junk. Um, I wish pr- process had like a no op that you could chain off of it.

1:44:12

Does it not? It doesn't matter. Oh, hello, Adrian. Let's go ahead and just put that on there as well. That feels better. All right, now we're getting closer.

1:44:40

Uh, we in fact do not need to create... Do we? What am I even trying to do? I'm trying to start the new machine. Oh, hey, Leah. Nice to see you here. Okay, so this will get all of the machines.

1:45:03

Uh, let's take this back to the top. We need to do some JSON parsing on this. So now that we have real JSON, output equals process. Oh, that's where must run is. Um, I knew that, I knew that I had heard or written that in fact before.

1:45:27

Uh, JSON decode output, JSON object as array. Is there like a... That's kind of surprising. So now if we run this, hey, much better than parsing through a bunch of logs.

1:46:04

This is getting... We're, we're actually getting somewhere I think. Um, all right, so what is our structure here? IDs, vanity names, which I think is something we'll want to control, which is fine. I do wonder if you can add like meta information, um, just like a key value store.

1:46:26

That'd be kind of nice. We'll see. Um, DNS, interesting. Machines have KV? Shut up. That's gonna be huge.

1:46:59

Metadata. Holy crap. That's exactly what I need. That's gonna be freaking awesome. Um, because then what I can do is...

1:47:19

Because part of the problem here, part of the problem with Sidecar is you have to coordinate across multiple environments. Like you want to, uh, you wanna build and deploy from CI 'cause it's kind of slow, and then, uh, you wanna activate from production as you are flipping, flipping the switch to your new active, uh, deployment basically.

1:47:46

And so coordinating across machines, across... In completely different environments, it's tough to store state because the state in your CI kind of has to link up with the state in prod, which is not ideal. Um, you don't super want those two touching each other. But if you can have remote state on the, on the provider to which you are deploying, then

1:48:18

you're good. So I can write, I can write versions, I can write, uh, function names. This rules. Um, it's a little beyond what we need to do right now. Um, I do wonder if apps have key value.

1:48:48

Do apps have... The app name, the build section, checks, concurrency. Mm.

1:49:13

I don't know that I need it. I don't know that it has it, but I don't know that I need it. What I need to do is focus. So, um, let's collect this and map it by ID to start. So we're going to collect the JSON map with keys.

1:49:34

Is that right? Item, DD item. I think map with keys is what I want. There's the item, and I'm going to return the item ID. I think you have to do it this way, item. So then, is that right?

1:50:04

Did we do it? Did we do it? Did we do it? Yes. Machine ID is now the key. Um, and then all the other stuff is in here, which is fine. Um, this is a naive approach, but I am sometimes a naive boy, so that's okay. Then we want to...

1:50:27

I don't even know that I need to map with keys, TBH with you. Um, uh, okay. So, uh, machines equals that. Ah. Machines equals that, and then kill equals machines, except the machine, the new machine ID.

1:50:57

Map, actually, each is fine. Function, uh, need to kill. Do I get item key? Do I get key? Need to kill key.

1:51:18

Let's just pick a machine ID that we don't wanna kill. We'll just say we don't wanna kill that one. So... Cool. Need to kill the other one. Um, and then we can say machines only need to start that one.

1:51:48

Is that gonna be good? Ah. Got 'em. Key by ID. That's much better. It's much, much better. Um, Navaneeth, tell me what you would want out of a Discord server, because I don't wanna start one, uh,

1:52:19

because I don't join them. Like, I don't like opening Discord, but tell me why you ask, because I'm, I am willing to be moved. Is it just, like, a sweet hang or what? Filter machines by metadata.

1:52:47

That rules. See, I like Telegram. Telegram's awesome. I'm on Telegram all the time. How do you start a machine? That's the next question. Um, Fly machines.

1:53:13

Huh. Feel like that should've been harder. Fly machines start. What do you need? A machine ID or app name. Honored to be the first. It's part of the reason I do it, honestly. Um, if everybody zigs, sometimes you gotta zag. All right, so if we come down here, and we'll-- Let's just put this out, this line, new machine ID is...

1:53:46

Let's do some interpolation. Machine. Gotta get our little arrow guys in there. Um, all right, so we have new machine is that. Then we're gonna find out what all the machines are. I don't like this.

1:54:16

What does ENV return? Returns this, and this is a pending process. Does pending process have a clone? It does not. That's too bad. Mm-mm, mm-hmm, mm-hmm, mm-hmm, mm-hmm, mm-hmm.

1:54:41

So my thought on... I, uh, I believe that. That sounds like a good reason, Navaneeth. Um, my thought is it would be a distraction, and if I just, like, said, "Nah, I'm just gonna ignore it," I would feel guilty.

1:55:02

And I don't... Like, that's not necessarily right and/or healthy, but I would feel guilty being like, "Hey, come, come join my, come join my Discord," and then I'm just not there. That's just... I don't like that, and I also don't like to capture the... Like, I don't wanna say, like, "Join my Discord," and not...

1:55:25

I know everybody's in, like, 50 Discords, but I don't know. Because I don't personally like it, um, I have a hard time getting there mentally. Uh, it's a lack of dark theme. It's nighttime. My eyes are melting. All right. So long, Charlie That's, that's my loss, but you know what?

1:55:48

It's also my life, so. Oh, well. What are we optimizing for? That's the question. In your life, what are you optimizing for? That's a good question. Machine. Machine. Um, find all the machines that are old.

1:56:15

Find start the brand-new machine. Um, that's a good question. I think it's, um, I think it's just compute time. I just read on their forum that they are gonna cap the build minutes at 300 build minutes, so this, like, remote builder stuff that we're doing, they're gonna cap that at 300 minutes,

1:56:45

and then after that, I think it's like five cents an hour or something. Um, so I think it should be fine, but we'll find that out later. Um, okay, so need to kill. At this point I, I don't, I don't like doing all of this through the CLI, but we're gonna keep going on that for now, and we'll switch to API for stuff later.

1:57:11

Um, there's... That's a great follow-up question. Uh, there is no Telegram group. That I could see myself starting, um, but I'll have to keep you posted on that. Start ID dot dot dot. So we can start multiple. Hey. Right on.

1:57:32

Um, which means, which means we don't need to do an each. We can, uh, implode, uh...

1:57:53

Let's do keys. So we're gonna take all the keys from the machines that are old, we're gonna implode them with a space. That'll give us all the machine IDs that we need to kill, which I think at this point is just one. Um, and we can run, uh, we can run this again.

1:58:25

I just don't like that. I wish there was a better way to do that. It's just not aesthetic. Uh, Flymachine. I think it's probably Flymachine stop, if I had to guess, and that accepts variadic IDs, so we're good there. Flymachine stop. Uh, in fact, I think these are already stopped, so maybe that's silly.

1:58:50

We're just gonna power through. Uh, Flymachine stop, replace quotes, yep, yep, yep. And then let's do, let's just output this so we can see what's happening. I bet it's gonna complain that it's already stopped, which we can filter those out. Um, hopefully it's just idempotent.

1:59:14

Idempotent? And they just say, "Well, it's stopped. It doesn't matter. We'll just carry on." That would be ideal. Um, okay. So this line, stopping old machines. This line, starting new machine.

1:59:37

And in fact, I think there's gonna be only one machine, so I don't think we need this at all. What we need is this right here. Start the machine. Should probably name that ID or something.

2:00:00

Oh, look, our comment is way down here. Silly guy. Mm, mm, mm. New machine. Boom. Activate the new machine, kill the old machine. Okay. You should be a variable.

2:00:23

You should be an app variable. I just hate that that's so ugly. Um. I joined the Laravel Discord for, like, a second. I was like, "This is so overwhelming." Y'all also have to remember that I'm 35 years old.

2:00:54

Basically have to wake up and put all my bones back in place every morning. Um, I think this is just gonna work. Yeah, that Laracon Telegram group, I, I... It's still going.

2:01:14

It's still popping off, and I just had to be like, "Guys, I can't, I can't do this." Um. Hm, hm, hm. Boy, that's not important, but I do not like how that looks. Okay. I think... So what's gonna happen, we're gonna create a new machine. We're just, we're just barely saving any time whatsoever

2:01:45

by not doing that, but that's fine. Uh- Let's just give it a go. Who even remembers what we're doing here? AR app deploy. Okay, building. Good. Thirty-five. I doesn't feel so young anymore.

2:02:06

I don't know if it's the kids or the mortgage or whatever. I just feel like I'm 1,000 years old. Could not start machine. Unable to start machine from current state created. I don't know, man, created feels like a pretty good state to start from.

2:02:28

Uh, what's your problem? You know what? We should do it manually first. That's obvious. I don't think we need that anymore, which means we don't need that. We should try to do this manually.

2:02:53

So let's do, um... Let's clear this out. Do Fly machine list app Fly sidecar. Lots of machines. Let's look in the UI. Come on, come on, come on. I got stuff I gotta do. Come on, man.

2:03:16

Um, okay, one minute ago, Smallpaper, which is E7, E7 Smallpaper stopped. So Y Fly machine start. What do you do? You accept IDs. Okay, that's what I thought. Fly machine start.

2:03:37

Nope, stupid. Uh, Smallpaper's the one I want. Okay. Well, that's stupid. What do you mean it just worked? Maybe I have to wait until it's in a state, pardon the rhyme, of stopped instead of created.

2:04:08

I buy that. I will allow such things. But why does it not show? It's still stopped. That's not great.

2:04:40

Why is it still stopped? Machine is still active, refusing to start. Okay. Um, we need to get the logs out of Smallpaper. Why do you, why are you refusing to start?

2:05:07

Can I do, um, Fly machine logs? See, what is even that? What is... Establish a proxy to the machine API through a WireGuard tunnel. What does any of that mean? Um, Fly machine status.

2:05:36

Not that one. Fly machine status of this guy. Permission denied. So our, our script is not working. So it tried to start, and then it died.

2:05:59

Okay. Um, what is used for front end? I don't understand the question. Do I need to, um... Permission denied. I'ma be honest, I don't know. I don't know what that means.

2:06:30

Let's see if that did it. I might have to do, like, the, the... I might have to claim that file or claim the whole directory as the correct user. Uh, I don't know. Um, AR app deploy. Okay, so we made it executable.

2:06:51

Maybe that, maybe it wasn't executable when I copied it over or something. Wonder if I should stream the output here, but constrain it to, like, a scrolling window.

2:07:14

Like, it just shows the last, uh, five logs or something. I feel like I need Joe Tannenbaum to tell me how to do that. Docker image built. Creating a new machine. This is working. Could not start. Failed to start. Starting from created. All right, same issue, which is fine, so we'll wait a second.

2:07:37

So I need to do a little bit of polling there to see that it goes from created to stopped. Uh, yeah. Hey, Dax, this is a sponsored stream. Thanks for asking. Uh, Turso, Fly, and Sentry. Y'all should go check 'em out. Um, okay, so now- It just reloaded on me for fun.

2:08:02

Um, come on. So now, uh, doo, doo, doo, doo, doo, I should be able to... Boy, it's a slow dashboard, isn't it? Um, give me... What is it? I want broken C, so I want the E2 one. Now, if I run Fly machine start.

2:08:28

Actually, let's run Fly machine status first. Fly machine status, and see that we're in... Oh, that's nice. State is stopped. Do I get JSON for that? F, why is it so ah!

2:08:51

It should give me JSON everywhere. Um, tss, tss, tss, tss, tss, tss, tss. Yeah. Uh, how to crowdsource a way to sponsor you instead of ads for products. We just have sponsor breaks to tell us good things. Um, I don't know.

2:09:12

I would rather take money from companies than friends. That's, that's kinda my... I don't know, maybe I'm being a rube about that. Start that machine. Machine has started. Is it true, though? Is it true? Did it really start, or is it doing that thing?

2:09:33

Broken C looks like it started. Okay. Which means, does it mean? It doesn't mean. Damn. Oh, Dax, I don't know if that's true.

2:09:53

You'd have at least $2 or $3. Um, yeah, if someone from Fly is watching, help me. Um, okay. I would've thought we got the machine started. What is it saying? Is it saying 502?

2:10:14

Um, why don't we go back to this, and instead... Well, let's see if we can get logs. Slow down, slow down, slow down. We don't need the Regex tester. We don't need the process facade. We might still need the Vercel thing. Connection refused, proxy error, connect...

2:10:38

Oh, you big old goofus. You changed the port for local testing. Hey, everybody messes up. All right. Do it again. Ah, F, I didn't poll and wait for, uh, wait for it to go from created to started or created to stopped, so it's gonna fail, but we're gonna get close.

2:11:08

How hard was it to find, uh... No, I don't care. You can ask questions. Um, I may not see them, but you're always welcome to ask questions. How hard was it to find sponsors? Um, impossible followed by easy, um, which I think is a lot of life.

2:11:29

It just feels impossible forever to, like, do the things you wanna do, and then after doing it for, like, 10 years, then it just becomes very easy. So I don't know if that's helpful. But, um, you know, Turso we did the course with, and then they were like, "Hey, can you build the, the Laravel driver for Turso and do it on stream?" And I was like, "Sure." So I'm gonna start that soon.

2:11:55

I'm waiting on, uh, a call with Turso to figure out their PHP driver. Um, Sentry was cool. They were just like, "Hey, you already use Sentry," which I do. "You already use Sentry. Um, do you just wanna talk about us whenever you use us?" I was like, "Yeah, that sounds great." And then, uh, I think we reached out to Fly, I think.

2:12:18

We reached out to Vercel and Fly and Cloudflare and were like, "Hey, we could do this thing for Sidecar." And Fly was like, "Heck yeah, let's do it." Um, so here we are. Being worthy of sponsorship. Um, yeah, I think that's true. I think you have to, I think you have to prove that you can already do the thing.

2:12:45

Yeah. Yeah, yeah, yeah, yeah, yeah, yeah. Um, so we need to stop... Oh, wow, did it actually work? I think the timing worked out already, or the time, the, uh, race condition worked in my favor this time. Load the machines.

2:13:09

Ah! Yeah, exactly. Doing stuff like, doing stuff like Laracon, you know, emceeing it, but also speaking at Laracon, speaking at online meetups, like, all of that, all of that stuff counts and it all, it all matters. You can just do things. That is correct. Um, okay, so no, it didn't just work.

2:13:33

I think it actually killed the old machine, which is good. So we're gonna start that machine, and then God willing... Small Sky is running. Fly Sidecar. F that. Um, we don't need the Regex tester.

2:13:58

Why do you not work? Why do you not work, friendo? Proxy error, connection refused again? Again? Still listening at 3001.

2:14:32

Oh, man. Guys, I am so sorry. I'm so sorry. I messed that up. Please accept my sincerest apologies. I need to stop... Okay, this is silly. I need to stop mucking around in the working directory, um, and just turn on the copy again. My bad.

2:14:54

Sorry, y'all. Um, doo, doo, doo, doo, doo, roop. Need to turn you back on, 'cause I'm, like, trying to work in these two different directories, and it, it's, it's a very, it's very fraught, as you've seen. Um, so let's change into CD app sidecar LS, uh, CD support node LS.

2:15:23

Okay, so start is executable there. Never hard code ports. Maybe. Maybe. Probably. Probably.

2:15:46

Um, all right, while that builds, y'all watch that, and I'm gonna go get a coffee. Just two minutes. Don't go anywhere. How'd

2:17:58

we do? Fly machine status has display config. All right, we need to... I've gotta fix that error.

2:18:20

Um, so if I go back to machines, we're gonna have to kill all those eventually. I don't know why it's not killing them, in fact. Oh, they're stopped. I didn't, uh, I did not destroy them. And let's start young paper. Gah.

2:18:48

Yes. Ahhh. Feels good, man. Not gonna lie. Feels good, man. Um, feels good. Feels good, man.

2:19:15

Uh, we need to fix, we need to fix... So apparently, apparently you can't start a s- start a created machine. Um, so if we did, let's clear this out, fly.

2:19:37

Guys, we're getting close, which is good, 'cause it's been, you know, two and a half hours. Uh, somebody said, um, oh, I would kill someone, I won't say who, but I would kill someone for a McDonald's Diet Coke right now. Display config. Um, let's see if that actually works.

2:20:03

Display, I think it was just display config Uh, the McDonald's ratio is unparalleled. It is unparalleled. Thank you, Navaneeth, for the display config. Why that isn't just called JSON is beyond me. Um, but yeah, the, uh, the ratio at McDonald's, the temperature, the amount of-- Not only the ratio of, uh, syrup to soda, which is correct, but also the ice

2:20:34

is correct. It's just unbeatable. It's just literally the best Diet Coke out there. In fact, I think... Best fountain Diet Cokes. McDonald's, true. Chipotle, true. Chick-fil-A. I, I am internally consistent.

2:20:57

I still believe that to this day. I still believe that. Um, all right. So I think we are in a good spot because... Please tell me it shows the status here. No.

2:21:23

Uh, display config is not right. It, for some reason, just tacks on this JSON at the bottom, but I still gotta work with this. Adding custom emotes? Guys. Max. Here's the thing, Max. I don't know if I like custom emotes.

2:21:48

You'll find I am pretty basic. I don't know if it'll become... Um, I guess we're just gonna have to parse this out, which is absurd. How do you not give me...

2:22:14

How do you not give me a JSON? I, I don't-- Am I not supposed to be using the CLI like this? Um, probably not. I bet I should be using the API for this. And I bet, I bet I will. I bet I will. Step one is make it work.

2:22:38

So we're gonna continue to make it work, and then we'll make it right. Uh, state equals stopped. You never close Regex, pal. You just, you never close Regex, pal. Uh, we want state. We want a little bit, uh, a little bit of S at the beginning with some state, then a lot of S, as many as you want, followed by as many as you want, followed by an equal, followed by...

2:23:08

Somebody calling me? Did I do something silly? That's always the fear when I'm on stream and it seems like somebody's calling me. It's like, "Hey, you're exposing your secrets or something." Um, and then we want to capture, uh, not S as many times as you want.

2:23:32

Hmm. Yeah. And I think the machines have a great API. I think the machines API is quite good, which is the whole point of, like, the machines. See, just that...

2:23:56

You can use the apps resource to... I think potentially... I'm trying to figure out potentially what, um... Yeah,

2:24:26

exactly, Josh. That's what I'm terrified of. Um, the only thing I think I need to use the CLI for is the part where we send all the files up to the remote builder. Unless I'm, unless I'm wrong, which I've, I have been wrong one time before. It was just the one time. Um, apps, create app.

2:24:54

So I can create an app, which is fine. That's good. I need to do that. Um, and a machine... Request can fail and you're responsible. Um, a machine requires an app and where's the image?

2:25:22

The Docker image to run. Uh-huh. I think Chris did have a blog on that. Um, I've added some context to the little scroll bar at the bottom today, building a Fly.io driver for Laravel Sidecar.

2:25:51

That's some context. So I think, um, we should add this to the to-dos. We should say... What's in my clipboard right now? Ooh, I want that. Um, I think, I think use the REST API for everything except creating the Docker image Uh,

2:26:28

yeah, I'm on Twitch, or I should be on Twitch. I'm on, uh, Twitter, Twitch, YouTube, LinkedIn for all the professionals, and kick.com. Never heard of it. Um, all right, so we can put that on hold for now.

2:26:51

We're gonna continue to muck about down in the logs. We need to do a little bit of... Little bit, a little, just a little, little infinite loop for fun here. Um, the new machine. We need to do a little bit, a little bit of parsing.

2:27:13

Let's come up here and return. We'll say that a pattern, pattern equals that. Case insensitive. I don't think we need multi-line. Let's do a process.

2:27:39

I don't think we need the path because we're not... Yep, fly. What is our command? Um, we'll just take that command. We'll have to make it a variable later. Machine ID is a variable. That's fine. Output, I can just chain it on.

2:28:01

In fact, let's, uh, throw. Should probably add throw to all of them, honestly. Oh, hey, Michael. We were just talking about Turso. Um, Michael works at...

2:28:26

Ah, shoot. Not Fly.io. The next one. Um, and that's the, uh, Laravel driver that I'll be building next time. Um, so let's see. Let's just take this output and dump it just to make sure we're getting something right. DD output. Um, let's clear this out.

2:28:50

What is it? App deploy. Okay, that's what we were looking for. Then we want to... Where's my preg_match_all? So we'll take that guy, we'll come up here, we'll say that you go there, that you go there, matches, and then we'll DD the matches. See if we got anything.

2:29:14

Ah, perfect. That's what we're looking for, that state right there. Um, okay. So then, um, in fact, I think that's right. Let's DD some state. Is that right? Stopped, that's what we were looking for. Um, oh, a little, a little string.

2:29:34

A little string helper. That's curious. Str of output match. Well, well, well. Well, well, well, if it isn't Laravel to the rescue. What do you do?

2:29:55

What do you do, dear friend? Shut up. Adrian, this is at least three times better. At least three times better, if not four. It's many multiples better.

2:30:17

That m- that much we know. This is so much better. All right, so you're dead. Ya dead. Pattern, why we don't need you out there. Shut up.

2:30:41

Ah. That's so much better. Bless you, Adrian. Nuremberg. What's your last name? Nurmberger. We got some cleaning up to do, my friends. All right, so we're gonna come down here, and after the machine...

2:31:05

We gotta clean that up, for sure. Uh, preference only. Str versus str of. Um, why don't we do this? New machine ID, and then we'll say, "This line waiting for machine to be in state stopped." Uh, okay.

2:31:33

While false. You big dummy. While true. Um, it'd be nice if... Process result.

2:31:53

Who does process result belong to? It belongs to Laravel. It would be nice if that was macro-able, wouldn't it? Um, what does throw return? Shoot, that's also a process result. Dang, that's too bad. I wish this was macro-able. Is, um...

2:32:21

Does run return the process result? Run, run, run.

2:32:43

Process run, what do you return? You return a process result. Dang, that's too bad. If somebody wants to PR that, that would rule. Chris, what does all that do?

2:33:05

What does all that do? What does, what does all of that do, Christopher? Um, we're just gonna do it the gross way, and then we'll do it the nice way later. Um, state equals if state equal, equal, equal stopped, break.

2:33:29

What are the machine states? Oh, we need to find out machine's state. State of the machine. Yeah. Yes. Good. What are the possible states? Started, created, wait for a machine.

2:33:54

Whoa. Is that, is that Chris? Is that what you were just showing me? Create a machine. Wait for a machine to reach a certain state. There are the valid ones. Started, stopped, suspended, destroyed. Um, hello, where's created? 'Cause created is valid.

2:34:16

Um, this is cool. This is super cool. That's a nice quality of life. At to-do when we switch to... That's super cool. When we switch to the API, use this wait endpoint instead.

2:34:44

Good job, Fly. Crystal cool. Um, all right. State equal, equal stopped. Let's do a little echo. And then, in fact, we probably need, uh, uh, uh, uh, uh.

2:35:11

Yeah, we need that there too. Stopping old machines. I don't know why that... Oh, 'cause we didn't kill them. You've already answered that question, Aaron. Um, all right. Let's change... So let's pretend I'm the user. Hello world two.

2:35:34

Now, if I run, you know, in the future it will be sidecar deploy, but if I run AR app deploy, um, output stringable true would be fine. I think I would be fine with that.

2:35:58

Uh, oh, I started one. Let's see. Creating new machine. I do... I gotta admit, I'm very proud of this. I think this is great. I think we should get away from the CLI. Um, unable to start machine from created. Yeah, that's the whole point.

2:36:22

What do you think I've been doing here? Um, we need a little bit more. Um, yeah, that didn't work at all. But I am proud of this, I will say.

2:36:45

Uh, where is that? Yeah, I don't need... Let's just kill that one. I just kinda wanna watch the, uh... Having a return as the last line, that's classic. Um, I kinda just wanna watch just the state change thing.

2:37:13

Guys, it's almost noon. I've got so many videos to record. I should probably start doing that. Okay. What, what, what, what are you, what are you complaining to me for? It says it's in state stopped.

2:37:38

Gotta kill some of these machines. Um, less than a minute ago is started, so if I hit it... Okay, so it worked. What's your problem, man? It just worked. Let's do it again.

2:38:00

I think we just solved the whole pipeline. Three, deploy. If this works, uh, the good thing... Okay, so here's the good thing. There are many good things. Here's a good thing. Um, if this works, we can begin to refactor to the API instead of the CLI, knowing that, like, the fundamental process works.

2:38:29

Um, yeah, I, I do talk at 1X speed, that is true. All right, so stopping old machines, starting new machines. So in theory, I think lingering star should be dead. And I think that should say three.

2:38:51

No, it didn't start it. Why is small sky alive? Man. Patient surf. Patient surf should be the one that came alive.

2:39:14

Did I do something wrong here? Did I hard code? Oopsies. Oopsie-doopsies. We call that an oopsie-doopsie. That's what we call that. All right, let's see if it works now.

2:39:44

We should see state created a couple of times. Cool. Hell yeah. Yes. Yes.

2:40:06

Very good. Very good job, Aaron. Okay. It's a lot of machines, man. Um, but we did it. We, we freaking did it, if I may. Um, we have just deployed user code...

2:40:38

We have just deployed user code to Fly, um, inside of our own little wrapper. Yeah, yeah, this is good. So the, um, the user experience will be such that...

2:41:04

Let me get rid of all this. They just have to-- This is all they had to write, and then there will be, there will be a corresponding PHP class that says, "This is node version whatever with this much memory." Uh, timeout, that's interesting.

2:41:26

Do I need to do a timeout? That's interesting. Um, but either way, this, this is good. This is the beginning. Um, I think this could actually work. I think this could actually work. Um, yeah, it's not PHP code.

2:41:52

I feel great about this. So what else do we need to do? Let's, before we, before we log off, um... I still don't know if tired proxy needs to be killed. Um, I need to find out... I need to call or talk to Fly.

2:42:15

Um, I need to find out from Fly employee if you can build, use their remote builder without the CLI. That, if it can all be done over HTTP, that would vastly simplify and

2:42:46

improve the user experience. Um, so I need to call Fly or email them and find out. What else did we do? Or what else do we need to do? Um, see, now one of the good things is we've committed all of this. Not like Git committed, but like cemented. We have cemented all of this stuff, um, into code.

2:43:08

And so like, well, don't need that. I think the Dockerfile needs an entry. Chris is not convinced. A simple command might work. Um, yep, yep, yep, yep, yep. Do I care? Do I care if we need an entry? I feel like Memento, the, the Memento guy right now.

2:43:30

Like, do I care? Do I want to remember this? Because if I delete this, I won't remember it. The question is, do I care? Do I want to tattoo this on my arm so I don't forget it, or delete it so that I never think about it again? It works with an entry point, so I don't care.

2:43:52

Um, that feels like something to remember. Cool. I dig. Mm-hmm.

2:44:20

So these things I definitely still need to do. This one's kind of subordinate to that one, 'cause if I find out that you don't need, if you don't need it, then that would be awesome. I would be fine bundling them and sending them to Tigris Um, that is what I do, in fact, for, uh, Lambda, is I use, I use this great PHP library, um, that

2:44:51

lets you create a zip file, a streaming zip file, so you don't have to, like, create the file on the local... the zip on the local system and then push it. You can create the zip on S3 and then stream files into that remote zip and then close it on S3, and that's exactly what I do.

2:45:14

Um, that's exactly what I do for Lambda. And Tigris, Tigris? Tigris is, uh, S3 API compatible, as far as I understand, so that would work for this. Um, that's what I really wanna do. I don't wanna use the CLI for all of this. But I feel great about all this. I feel like this super rules.

2:45:38

Um, so what else do we have to do? I mean, at some point we're gonna have to integrate it into Sidecar proper, which is gonna take a lot. Um, I think what we probably need to do next, and that this is for not today, um, is create an auth middleware that the support directory plus Laravel app...

2:46:06

Not that. Uh, such that the support directory Laravel app share a secret. I think I need to do that. Tigris or Tigris. Tigris or Tigris. Um, yeah, so the idea here is that, like, um, so the Docker bundle, I don't know if that's right.

2:46:34

The, the bundle of files that will be Dockerized is created from user, user code plus support, um, plus Sidecar support code. And in this process, we bake, bake in a secret key from the Laravel side.

2:47:03

Then when Laravel calls the function over HTTP, it must provide the secret key. This is not necessary on Lambda because we don't hit it over HTTP. We just hit it from the AWS SDK. Um, but so we just kind of hit it under the covers, and it's all authenticated anyway.

2:47:27

But because that's not an option here, which is fine, I don't really care. But because that's not an option here, we need to have some sort of built-in authentication such that the user, the user can still call, like, my function execute with some data and get the result back.

2:47:49

But this is secured through a shared token. And since we, as Sidecar, since we are in control of creating this bundle, we can bake a secret in, and as long as it's from the Laravel side, then we can call it from the Laravel side too. So we'll need to do that.

2:48:11

And unfortunately, that will have to be a shared key/secret. Oh, that'll have to be a shared secret across CI and production, which is not ideal. That's interesting. There might be a way around that. There might be a key value store on the machine pattern that we could use there.

2:48:38

Hmm, much to consider. Much to consider. All right, I think we're done. Um, let's just watch it. Let's just do it one more time. I don't know why W is capitalized. Let's just watch it one last time. If this doesn't work, it's gonna be really embarrassing. But all right, creating a package, building a Docker image.

2:49:03

Come on, baby. Go, go, go, go, go. Go, go, go, go, go. Faster. I think building that Docker image does take a long time. Okay, there's your Docker image. Creating a new machine. Show me waiting. Show me status. Checking status.

2:49:24

Show me. Waiting for machine. Ah, too many line breaks. What are you doing, Aaron? Too many line breaks. Cool. Let's take care of that hideous line break. Um, and then... Hey, we did it.

2:49:50

We did it. We did it. Very... That took two days. That took, uh, what are we at? Two hou- three hours today. This took, I think, maybe six hours while talking to y'all. That's not bad. Of course, the first 80% takes half the time, and the second 20% takes half the time, but still, I'm super-duper pumped

2:50:20

about that. Uh, yeah, this is cool. Here's the middleware that I was talking about, authorization. And then that's... Yeah, we're gonna use all of this. We're gonna use all of that. Some tests. That's nice.

2:50:47

Where's the Vercel client? There you go. Yeah. Cool. This is gonna work. This is gonna freaking work. Okay. All right, y'all. I gotta go record a million videos, um, for Postgres.

2:51:11

So if you want to learn about SQLite, high-performance SQLite, if you wanna learn about Postgres, mastering Postgres, uh, that's probably good enough. So I'm gonna try to keep doing this Tuesday, Thursday, pretty early, Central Standard Time or Daylight Time, who knows?

2:51:32

Central Time. Uh, and we'll just keep going. At some point after I talk to, uh, the SDK guy at Turso, we'll get the, uh, Turso driver going, and so we'll be mucking around with some database stuff. It's a good life, man. It's a good life. As Michael Scott would say, "You got a good life." I gotta delete some of those machines.

2:51:53

All right. I'll give it, like, 30 seconds because of the delay. Any more questions or anything you wanna know? Which I guess that falls under questions as well. Okay.

2:52:14

Running out of time. See, this is another reason I hate Restream. The delay is immense. Uh, make Turso work with Herd. Open question. I'll figure that out. Um, thanks for the stream. Thank you for stopping by, Florian. Thanks for your help, Navaneeth.

2:52:36

Dan, so long. Good night, Samuel. I do have work to do, Dan. Hi, Brandon. A little late, but hi, Brandon. Um, all right. Y'all are the best. Streaming is fun, primarily because y'all show up and hang out. So thank you. And thank you to Sentry. Thank you to Turso, and thank you to Fly.io.

2:52:58

So long, Josh, Samuel, Pixel. Probably Gilbert, but yeah. Uh, can you run Fly Machine exec via API? Hmm. Don't know. We'll find out next time. All right, y'all. Later

Laravel & PHP

More videos on Laravel & PHP

All videos

Get the next one by email

I’ll send you some more. Not too many.

Join 7,500+ other readers.

Read past issues