 My name is Jake. I'm with Compose. And today I'm going to show you how to migrate your Heroku app over to IBM's cloud HA PostgreSQL. Before we talk about how to do that, I want to talk about how we actually attain high availability. And the way we do that is with an app we created called Governor. Governor sits on top of SCD, which is our distribution coordinator. SCD is connected to two PostgreSQL nodes in leader follower format. SCD is the one that's maintaining its leader in follower format. And we use Wall Stream replication to keep the nodes in sync. In front of the two nodes, we have an HA proxy load balancer. This load balancer is connected to both nodes and to the governor. So it knows which one is the leader and which one is the follower. If any changes happen to the nodes, the proxy will hold the request until the new leader is shown. So your app won't have any idea that a failover just happened. That's how we keep you with zero downtime. Your app actually connects to the HA proxy node. And so we released this into open source a while ago. And it's been forked a couple of times. And one of the newest forks that came out is Petroni. Petroni adds to governor by allowing you to use ZooKeeper and Console as your distribution coordinator. And it's very stable and quite good. Now we actually use Petroni for all our PG deployments. So that's how we actually attain high availability. So let me show you the demo that we created to migrate over. This demo that I created is an artificial intelligence that's totally real and not made up at all. And what this intelligence does is it will take an image and stick it into one of four Star Trek captain posters. So it takes your image and puts it in there. So let's take a look at what this looks like. So I'll go ahead and upload an image here. Bam. That's Picard as me, obviously. I'm more of a Cisco guy, but this one's not that bad. That one is way better. I'm going to keep that one as my wallpaper, actually. And then obviously we have the other two captains, Kirk. I'm not that fond of. OK, I do like the hairline, though. It's a lot nicer. But then we go to Janeway and clearly the AI needs tweaks. So that's our app. Luckily, we don't have to do anything about the tweak in the AI for what we want to show you today. So for today, we're going to migrate over the data from production, captainly, over to compose cloud, PostgreSQL. So the way we're going to do that is first thing we're going to do is pull a backup from Heroku and capture that down. So go ahead and capture that. And then we'll download it. Hopefully it doesn't take too long. The awesome images that I showed you before? No, that's totally real. It was made by an artificial intelligence, for sure. And not by one of our awesome designers. All right, so now we'll pull the download here real quick. And so now we got the export downloaded. And I'm going to take you over to our Postgre configuration details page. Let me get there real quick. So here's the details page for the Postgre deployment that we set up under IBM Cloud. Here's the connection string for you. One thing I would like to point out, our deployments come with the entire server. So you can put as many databases as you want to on it. We load all the PG deployments with a default database called compose. This has a couple of things in it, like your admin and some other things in it. And then I've already created the captainly staging and the captainly production databases. So we'll go ahead and use PG restore to restore that. So right here, we have the standard PG restore, a couple of options for no owners. Here's the host from the connection string. All of our deployments use non-standard ports for security reasons. So you're going to need to use the minus P option. Then you'll have the admin as the username. And then we're going to import into captainly staging and the dump that we want to import into. Let me go ahead and copy and paste the password, because it's going to ask me for that. Cool. So now that's importing. One thing we're going to need to do on staging is we're going to need to drop the Heroku Postgre add-on. The reason for this is because the database underscore URL config variable is automatically attached to any add-on that uses it. So you can't actually reconfigure it with the add-on. So we have to remove the add-on. And we'll go ahead and remove that real quick. Cool. Now let's double check that. All right, so the database URL is gone. Now we can go ahead and set the database URL. And everyone can see how badly I type. And we'll use basically the exact same connection string, except we're going to change this last part to captainly staging. And let's see here. All right, still processing the data. Almost done. Cool, we're on the sequence. So now we can go ahead and set this. I'm going to do set, not st. Cool, so let's double check that. All right, so the database is already set. So let's also go into the console and make sure the connection is up and running. Cool, imports done. Perfect. So now we got data. Everything is connected. So last check, we're going to go to captainly staging. And refresh, make sure we get no errors. Perfect. So staging, our staging test is done. So now all we have to do is pull the stuff into production. That's going to be pretty easy since we already did staging. All we have to do is change this part right here to production. And let that import, oops, got to get password. And we'll do the exact same thing with the captainly production Hiroku instance. Cool, let's double check that. All right, database URL is gone. Now we can set it. And again, we're going to basically use the exact same thing we did before, except we're going to change minus r to production. And we're going to change this to production. Perfect. Now let's go ahead and run the console. How far have we gotten here? So now let's double check with the console. Perfect. So now we've gotten production pulled over. Now let's just double check one more time in the app. And that's it. We just migrated all the data over to the new deployment. That's all we had to do, without downtime to which app. Right. You have to do the config variable switch. So that's going to give you some downtime. But filling up the databases, you don't have to switch over at that point. So you can just wait until everything's done. And then switch over. I don't know how fast your big Heroku app will switch over all the config variables to all the servers. It should be zero downtime from what I remember of Heroku. But I can't. OK, yeah. So you can, I think you can sync one of our deployments into another deployment. I have to double check on that. Because the way we set up the configuration, I don't know if that will actually work that well. Because one will be a leader, one will be a follower. And then coming in from another leader, it might throw everything off. So I'm not too sure about that. But hit me up at the booth. And I can ask one of the tech guys when we get there. OK, yeah. So this is done. And so you see up here where it says search. Nothing, there's nothing really to search right now in this app. But let's say I wanted to add a search. If it was super simple, I would just scan across the Postgre tables. But if it's anything more difficult than that, I'm probably going to want my own indexer. And you can come into Cloud here and just create a resource, and let's say Elasticsearch. And we'll put in US South, latest preferred. And then we just click Create. I'm not going to click Create right now, because I don't want to provision another Elasticsearch. But you would just click Create, and then it would look something like this once it was done. And this would be the overview of your Elasticsearch deployment, which would have the connection strings for you to put into ES underscore URL or Elasticsearch URL, whatever the config variable is for your app. And yeah. So that's basically all there is to migrating your app over. That's it. So if any of you all have any questions, let me know. Yeah, that's it for this. So we tried to keep it really short since it was sponsored. And we didn't want to just sell you and pitch everything. So we just decided to show you what it can do. That's it. All right. Thanks, guys.