 So my name is Sousham and yeah, I do go What I'm going to show you today is I'm going to show you from building up a web service very very simple basic web service and Show it to you how it's done in a standalone Then I'm going to show how it's being published on hero cool And then I'm going to show how it's being published on Google App Engine like so I'm going to show these few things So let me just show you very quickly the web service You see Is that okay? Very simple one with a strut Main this is a web service. This is a Multiplex multiplexer that multiplexes The different methods so all the HTTP methods are getting so get post put and delete so you have a get You have a post you'll put and you have a delete right The database I'm using postgres on Elephant SQL and Basically, it's just plain SQL. There's no extra libraries that I'm using So the basically the only third-party library is the database driver Okay, so let's get into here. I Built this guy and then So what I did was I I just rebooted and Okay, never mind, it's not the first time this happened to me this week anyway, okay, so basically, I do that again I Build it and then I run this right and Let me just show you so I have a term test scripts here. This will create this will retrieve so let me create a post here running curl I'll create a post and returns 200k so let me go to There's a reason for that because I'm going to use the same database for hero cool and for not for hero cool So if it's easier, right? It's free. So you can actually Play around with it This was all seriously set up. So I'm just gonna dive it again. Where was it? Browser, right? So you just created a post 13 So now let me Do a get shit. Let me do a Get get 12 And you get the idea. So you get the idea basically is a very simple web service. So let me Step on to hero cool next hero cool, it's so hero cool, it's If for those of you who do not know is a platform as a service is one of the earliest past one of the Easiest past and I would say it's one of the better past around very independent And the other one that I'm going to show you later Google App Engine is also a pass But that has a different feel to it. So that's the reason why I'm showing you this too For hero cool, you don't really need to change much of the code. So as I will show you here Under server the only thing that I actually just need to do to change. It's basically this instead of previously. I was using 8080 Now I just use OS dot get nth pot basically I'm getting the environment variable the pot environment variable which is supplied by hero cool and then everything else is done okay, so I Can run it locally basically what it means is I can try to set up everything nicely locally first When it runs nicely what I'll go in I'll change the environment variable and everything else should work fine On hero cool once I push it up. Okay, the other thing that you need to set up is of course a profile Basically a profile sets up the executable that needs to be run. So when you push up the Files from here from your local What hero cool will do it will compile your files and once it has been compiled It will need to set it up to to run whichever one I think that you want to run So to run it as a web application you need to specify what app it is that you want to run So for me is that the blue s dash H. So I set up the profile as the blue s dash H Okay, so as you see here, there is no change as well. It also goes up to elephant SQL so What I need to do is I need to first add I need to push it up to hero cool. So I need to do a kid Sorry Get in it So I initialize this as a kid repository I need to add it as initial thing Sorry, I'm a wrong folder. Sorry. Let's just close the other one. Okay, I'll just leave it alone here So I added everything. Oops. Yeah, sorry. I knew there was something I forgot to say To add on the dependencies for hero cool hero cool uses something called a code go depth So you need to install go depth first. You need to go go get go depth and after that what you do is just say Go depth safe and what it will do is it will generate this directory go depths and It will automatically create this file and what it does is it will set up all these things for you including your dependencies you see here the only dependency I have is on postgres library so it will Do the import path for me and it would add the the source code here as well. So it adds the Postgres source code here It's quite a bit but Yeah, so everything is bundled into one and we are ready to go So with here you need to install the hero cool too bad to belt after you install the two belt. What you do is hero cool Create Yeah, so you will create a Hero cool app for you then after that hero cool push Get push Your cool master and then it will push the app up Just keep it short while It's deploying Magic magic 1.5 Okay, so it's deployed so what I'll do is I need to Of course, it is a web service. It doesn't have We so what I need to do is I need to use the same testing thing that I use early on So Let me now try to create this guy Where is it here? It should create a post with the IV 14. Yes, 200. Okay So I execute this again Yeah 214 right so basically what I've done is I've created use the same web service and I push it up to hero cool and it's this life now, right? So that's your crew is pretty simple the two main things you need to do is the more one you need to change the port and Number two you need to run go that in and that will actually bundle all your dependencies into a Sub directory and then after that you just push it up to hero cool and you're done This is now. I think maybe a couple of months ago. It wasn't as simple as this day. In fact Go sorry hero cool dinner support go directly now. It does previously you need to Get a hero cool build pack and then install it in the I think what they call a zero build pack and then go from scratch We go up. So now it's a lot easier Okay, so this is Hero cool with with Google App Engine. Sorry Google Is go with a hero cool now talk about go with Google App Engine. So I have this now Google App Engine is a little bit different from Any for many of the other pass around so here go the Google App Engine is kind of close past It is very powerful. It is very scalable, but you have to use everything from Google Or most things from Google. In fact, you can't actually use a network port outside of the Google App Engine, right? So some libraries that you intend to use Or some service external service you intend to use you actually cannot use it For example the elephant SQL database I was using early on. I cannot use it from Google App Engine So if you want use a relational database, you have to use Google's relational database, which they do provide But unfortunately is my SQL something which I don't use anymore. So Let me show you what it means. So a couple of things you need to do you need to actually change the code as well. So previously you will see my The code in the standalone as well as in the hero cool. I just do a quick comparison here Package main But now is package something else, right? package gwp Here and briefly I had a main function as you know Go applications need to have a main function But this doesn't need to have a main function. So it cannot have a main function What it in place of a main function use an edit function for those of you who know about go In it is basically the Function that will initialize whatever things that you run for your package. So in fact instead of deploying a Stannable independent application what you are deploying to Google App Engine is a package. It's a go package. That's why it's a Package called GWP, right? That's why it can't have main because the main is owned by Google the main is not owned by you, right? You are a tenant Really a tenant in the Google pass, which is unlike hero cool hero cool. You have the entire ecosystem Here you don't Basically, this is the only thing you need to change You need to do away with your your main you need to have in it and everything else can remain the same the other thing that I change here, of course is Sorry The other thing I need to the other thing I change is of course instead of using postgres. I'm using my SQL I'm using this Library for my SQL and I have to switch to using cloud SQL And of course everything else I need to change to using my SQL whereas most things are the same Of course the the syntax a little bit different instead of using dollar one dollar two. I've used question marks now small minor thing, but yeah, this is just some differences and just like in Hero cool where you have a profile you also have something similar is called app.yaml You have a YAML file that defines what the application is the version runtime and so on and so forth In reality, you don't change any of these things except the application Right, and you change application according to what you Need to run here Console right so basically what you need to do is you need to Create an application here. So I just have this one application. I won't create again because it's actually a bit Involved create everything and But basically what you need to do is you need to create the application after you create the application If you need to use a relational database, then you need to create a something in the cloud SQL So again, I created this cloud SQL database table And there are some other things as well, which is not as Straightforward you basically get some database but you don't have External IP address Well, you don't external IP for v4 address what you have is an external IP v6 address So if you want that IPv4 you can but you have to pay for it So there's some of the other smaller intricacies involving it. This is for the database So let's say you want to populate the database externally You have to create a IPv4 address and then after that you can do whatever you want with it okay, so this is a database and That was the application After you make the changes though everything else is relatively straightforward. Let's take a look at just now So once you have done that you can do I don't want to do two things you can either say go app surf which essentially runs your Service locally, but of course it doesn't work for me locally because I don't have my squirrel. Sorry. I am my squirrel installed locally I don't have all the configuration loaded locally. The other alternative is to deploy directly to the Google App Engine itself. So instead of doing good app surf where I do is go and deploy It will take a bit of time, but eventually you'll get there Scan you clone you do whatever things and then you will push all the things up So if I step one step back right you actually need to download an SDK from Google and the SDK actually has all these things I think the original SDK is based on Python. So I think the Go app itself is a Python script Yeah Yeah, it's Relatively fast because if it's a completely new app that I need to push it again, it will take some time But here is very fast and let me try that again So So instead of this so I have WS G-1234 By the way, my app is actually WS-G but somehow they just add one to three four for me and Because I think probably somebody else has WS-G already Okay, so I will now I can't remember what it is WS-GTP or HDPS They will Call this guy. It should create an ID 15 No, it has some additional stuff on this haters Let's take okay, you can't really see it but Because it's not elephant SQL. I don't have a browser into the cloud SQL. Let me run the other one mean do a curl get as WS-G dash 1234 dash So get 15 Yeah, it is. Oh, it's no Just one thing is two that was created just now, right? So It's not 15. It was because 15 was on elephant SQL. Yeah, so I think it was two because I created one early on Right. So this is the difference within Hiroku and Google Engine both are past but Hiroku is much more open and Google App Engine is quite close but Google App Engine has a lot of advantages It has a number of libraries that are built in and it has a lot of services that are available from Google Whereas Hiroku you don't have really have anything like you just basically have the plain vanilla server It manages a number of things for you and you're very independent You're very free to do anything you want but you have to do a lot of additional things if you want say a Service then you have to go at elephant SQL get something or postures or whatever service that you want Google provides a lot of things in the house, but you are restricted to using only Google stuff mostly So these are the big differences any questions If you try using libraries that party libraries which require you to compile to see like me for example In Google App Engine Google or Hiroku and your experience? I've not actually done that though. I believe in Hiroku it should be okay Basically, they give you the play field to compile whatever you want and even if you can't write You just create your own build pack and you push it up Google App Engine you can't There are some pitfalls though in both Hiroku and Google App Engine. I think the Google App Engine is pretty Evident sometimes we don't really think about it But really you cannot escape from Google App Engine ecosystem, right? Like we for example, you can't even Go talk to another database outside of Google App Engine. You can't talk to Many other things you would depend on a service as external from Google You cannot access it. There are exceptions though. So Google has something called Google compute engine, which is like IAS like we said of past is an IAS so you can deploy services in there and you are given the leeway to access those Hiroku also has some other issues One of the things with Hiroku is if you're deploying a web application Your web application must start up within 60 seconds All right, if your application needs a long time to load up It will never load up. Hiroku will just kill it because you are basically sharing infrastructure And if it takes too long to load up, you will be killed. The same thing with Google App Engine But Google App Engine is very apparent, right? You you behave or you die Hiroku, you think you have everything but you don't. So in case there are some pieces that you don't control as well I think the main disadvantage of Google App Engine If your customers are in China Yes, China won't be able to get to it I guess so. I've not tried that really. What about the pricing actually? between computer engine, app engine and Hiroku Hiroku, what are the same performance about? It's hard to say because Google App Engine actually automatically scales for you So that's a big advantage and some of the tools that will provide automatically scales as well like They have Google Store, kind of a store, store engine, whatever they call it Basically, it's a big data storage. It's not the SQL database Or the big table. Some big table things. So it scales very well. The data scales very well And the relational database, they also help you to scale and everything But the computation of how much it costs for you to run on it is so convoluted. It's like quite mind-boggling I didn't really try to sit down and figure out how much it costs to do what Hiroku is a lot more straightforward, right? Because it's based on dyno But I think they are also starting to be a little bit more complicated Now they have free dinos and then they have some other premium dinos or whatever Free dinos need to sleep for a minimum X number of hours in a day. Otherwise, you know, you'll be charged and things like that So it could be expensive as well. And then we start workers on Hiroku then The workers will also take up time and you will not You will not qualify for the free dino and then you'll be charged for those hidden costs So there are a lot of other smaller things that are hidden I think if you're using pass in general, right, it's Basically users beware because there are hidden charges that even though they say there are no hidden charges but you know, you normally don't read all the fine print and Yeah, after a while at the end of the month, you will suddenly get hit with a large amount And then you will know how much it really costs Yeah, lots of messes around OpenShift is from Red Hat There are lots of them Other questions, sorry for the mix-up early on. I still don't know why it did not work