 Okay, good afternoon. Thanks for coming to my talk. I know there's other great options and so I appreciate you stopping by and Watching with me the live migration of a Java EE application based on web sphere to a cloud foundry environment As you can see also here there are two names listed So one is myself the other one is my colleague Torsten unfortunately, he had to cancel his trip in the night before the flight he had to go to the hospital in an emergency and This I don't know He's doing better now, but it was unable to travel so Quick shout out from my side and I know if this is recorded in later on on YouTube But you'll be missed my friend and it's not the same to stand up on the stage here on my own Wish your speedy recovery This also had of course a bit of an effect on the on the things that I want to show because we had kind of split the individual demo step, so I had to align it a little bit and Now we're gonna see how things go So as I said, it is kind of a live demo. So there are almost no slides. I have a few slides just as a like a Visual representation of the things that I that I try to do and try to show and what is that a thing is coming from I should probably say we have done an initial Presentation of this talk last year at the cloud foundry summit in in Basel However, this was more on a talk in a conceptual way why we did the individual things and how we approach it and so on and More about the technical backgrounds the one today is more about how we actually did it So showing the steps that we that we tried to do in order to get the job done So more on a hands-on kind of thing So if you have any further questions about why we came to that conclusion or why I did certain things that way I'm happy to answer any questions in the end Also, there will be a couple of like Times where I deploy things and we have to wait a little bit and I can have I'm happy to answer questions there as well so this is basically how the The high-level overview of how things started so initially we had a web or we still have that an application running on a clustered web sphere in a local data center and our the desire of our client was basically to modernize this application stack and Run this run the software in on a cloud-based platform potentially develop in in towards a microservice architecture So it's pretty much like here is our monolith running on the cloud for us. We don't care how all right and So well This was new for us as well This is the we have done it a couple of times in the meantime, but this was like the experience report from the first time We did it The steps we're going to show first of all web sphere was not we found web to not to be the suitable application like the application server runtime for for microservices So the first step would be to migrate from web sphere to web celebrity profile. This is like a lightweight application server also with its roots in IBM After that if this step goes fine and it most likely will go fine Trying the cloud foundry approach cloud foundry does have a community build pack for Liberty profile So that's was an initial decision for us to take that direction And then the first thing we did was trying to run it on a local development environment like a PCF dev still having it connected to the same back-end services that we had at the time and Then the final step to get it running in the cloud was using a solution to run on PCF on Azure And this case of course also involved not only the migration of the application side, but also of the back-end services so initially the The web sphere landscape was connected to it to DB to DB to most likely not available on Azure as a managed service So we did a migration to to postgres at the time Okay, so About the application it's a big Ear file it has about two hundred fifty thousand lines of code So it's not not the largest of all monoliths, but it's definitely pick on in a microservice and it's it's more it's in it's a back-end application from an automotive client that we serve and Most of the incoming calls are being done through rest There's also a bit of a web interface that I'm gonna show for validation, but it's not like a fancy UI application It's mostly about data processing. So it does about a million requests in an hour or so So it's con on the constant load which also had an effect on our decisions in in the migration so the first step as I said is basically trying to take web sphere out and Bring liberty in as a validation to say if this is running on a lot on a much lighter Java EE infrastructure than web sphere is and this is also like the recommended solution From both IBM and Pivotal to to to run those workloads in in cloud foundry or in containers in general And that's the thing we tried to do so Is that big enough for the people in the background to read? If you cannot see it raise your hands, please, okay, I'll Getting better Okay So I have a couple of photos here with the individual demo steps So I'm not going to show anything how the application is running in web sphere So I'm really starting at the point where I say Here is the ear file and we gonna look at that So the ear file is basically this one here. It has about 14 megabytes in size So I should probably say this is like the real world code The only thing that we did was completely scramble it and take all the references out From the internal project names and and custom name and so on In order to use it as for such demo purposes But it's not something we set up in a fake way to do a demo on that So this is the the real code of that application The first thing we did is their IBM provides a tool called The binary app scanner and with this one will basically scan the ear file To check what kind of technologies we're internally using and if they are compliant with a liberty runtime And what you need to basically do to enable them So this is a Java application. I Provide the I think It works like that Okay, so it's we're gonna go over that list and that feature list command will will actually trigger an Xml configuration to use later on with with liberty and it can also bring up a Migration report file. This is something that I have done in advance in order to save some time here So after executing this file, we're gonna get this one And if I look into that these are like the features that it has detected from a Java e technology perspective which we would then in turn need to to run it in a To run in a liberty profile now looking at that web page real quick This is a long website that you're going to get this application migration report So it will basically check If it finds certain platforms to be compliant to run it with This will also evaluate the individual technologies that you use and it will also Describe a couple of things that it found that you say well this runs on a web sphere But it's not running on a liberty. So please have a look into that to to update your code I'm just gonna close that section. It also I mean this shows the content of the file I think it would be pointless for you to throw you something in the code but just to give you an impression of what the complexity of the application kind of is and It's a good analysis tool for the application in general but very helpful also for the migration in the end It will come up with these features and these are the features that we basically use them to for the application migration So I'm trying to show that now What you what you're gonna have to come up with in the end is a so-called server XML file and that on the top of the Server XML file you expressively these list those features like each ab is Chandy I what kind of security things and so on basically everything your application needs and what you can take from the From the scanning what you can't take from the scanning are your application specific properties Like if you set change the i entries for yourself or if you connect to a database, so right here you get like the reference to the db2 That your application can connect in the same way It would be kind of dangerous if the application scanner could read out the passwords and so on so these are the things that you have To set by yourself, so it's a combination basically your features and configuration after this one is done You can basically Run the thing so that we have I have written a little script to To do that so the important command is basically Liberty's bin server run and then uses that file in the beginning We just copy a few file because I've done a bit of local development here to adapt for this demo That's why I put it into the script file so I should probably also mention I have a db2 running in a Docker container, I hope it is running in a darker content. Yes, it is This one I will try to connect to the only thing I have to validate quickly is The network connection Because this this is how the application connects and this IP is different from the one in my hotel and at home But that looks like it hasn't changed again. So this is good that means I can run this and And now Liberty will basically come up You will see the the output of the locked files. It's probably not gonna tell you much or not as much as it as it tells me So in the meantime, I can give a bit of an idea of why we did things that way as I said before the the application is on the Very heavy load and it was not a good not not an easy thing for us Can I just Need to have an eye on that a little bit So it says initialization successful, I'm gonna continue with that story later Because now I can I should be good to show it I just need to scroll back a little and see it will basically say at some point where the application is running And what port is it bound to so this is the one right here And if I go to my browser again and put the URL in Then I'm basically getting the the UI of that application. So It basically is a registry for the vehicles users partners and so on I mean, we're not really interested in what the application does internally just to show that things up can be run that way So that means the first part of the migration has then finished So we know we can run the application on Liberty now and Have a look at the further steps. So the next thing would be to make it run on cloud foundry And we used PCF death a lot for like local development That means what what we did was running PCF death on the local environment. Just leave the database as it is and Not run it with the Liberty profile in that way But using that Liberty build pack and run the application on top of that so I should probably also mention we didn't connect to db2 as as a User-provided service as cloud foundry would probably as it would be a best practice in cloud foundry We basically just connected straight over the network just to see if the application service Or the application can connect successfully All right, so To save some Memory if this work, okay, I'm gonna stop this application and Go over to the PCF now From a configuration perspective We left pretty much the server XML unchanged as it was connecting to the same database on the same host I'm on the same port. I mean the only thing we really had to set up is the money the manifest file and So what we specified was about two gigs of RAM One one gig of disk Specified that that zip file where the application is contained and explicitly Pick the build pack that we need to run So as you can see this is take coming from github from the cloud foundry from the cloud foundry space Is is is a community thing what you can see in the bottom here? It's just like IBM licensing information that you have to put in for making your liberty work okay, so Now as you are all here on the cloud foundry summit, I'm pretty sure you're familiar with this command Before I do it I just want to check if I'm connected to the right platform at the moment. So this is PCF depth. Yeah, this is good So I'm going to execute a CF push This will probably take a bit of time. I still have 18 minutes left for my overall migration. So that's looking good What will be happening now is first of all the The liberty container or like the instance will be created then it will have to detect what kind of features are required Those features are going to be installed then and in the end it will come up with a droplet They're holding the liberty application runtime and the application on top. So As it is quite heavy as you have seen before we We specified two gigs of RAM which we found to be sufficient for that purpose now as we wait on that I Can still come finish on the thing that I tried to explain before Lot of people have asked us why did we do this approach and not like try to rewrite things either in spring boot or create microservices and so on and The primary reason for that is as I said before we The application is live in production and is on the constant and heavy load so Rewriting stuff as microservice would have meant for us To have like a split development team for like maintaining the the legacy application and and running and creating the new one on the other hand We said if you can come to a way that we have the same code base that we run on on web sphere and on liberty Then we already know we have like a proper tested code because like this code base is always running in production and live and So we can't we shouldn't expect too many difficulties in that on the cloud side So the overall goal was still like to get it running on the cloud as a monolith And once we're there starting to take benefits of of a cloud platform like automatic restart scaling and so on But the first intention was to really get it there in the same shape Also, what we found is that especially running those tests and making it compliant for liberty liberty is It's kind of stricter in enforcing Java e or like Java in general policies and Webs like the same code Sometimes liberty would complain about something that webs for tolerated So in the end we we actually this helped us to make our code a little cleaner so once we got it running for liberty it was absolutely running fine on web sphere and This is basically The point where once you go to Now I can see Well as we wait on this are there any questions I can answer right now. Are you all good to follow? I Did it normally takes around four or five minutes on the first run And then once you once you start on stop the individual instance later on. It's like in a time frame of about 30 seconds to a minute and which is a lot of big improvement to what we had compared to the original web spin Moment where the startup time was about five minutes or so Now if this should for some whatever reason not come up In the desired time frame. I also have a Yes Okay, so repeating the question if I understood it correctly It's like if you find out during the migration process if the application is too big that you can't migrate it I mean in general We know we have to find out what too big means. I mean there's no size limitations so on I mean technically you can run everything in a container you can run web sooner container. It just doesn't make any sense. So This is the thing you need to really be careful of is Trying to comply with the 12 factor app guidelines and in particular to get in memory state out of the application This is basically one thing. We took us a bit of time to validate that we have the same instances Scaled that they prefer like they're doing this the same thing in the same way But from a from a size perspective in terms of lines of code or whatsoever There is no limitation if you're if this application runs on web sphere and doesn't really use any particular Libraries which don't exist there then it will run on Liberty as well in case if you get in such a scenario that it's really something Very I don't know legacy prone and you can't run it anywhere else then this approach will not work but we have done it for a couple of applications so far and Then the more the main effect we normally had was really just it helped us clean up our monolith code in the first place And once we had it migrated then it was kind of easy to kick off new Development and write new microservices alongside of it and deployed on the same platform or cut out microservices from the existing monolith so It says here waiting for the app to start I'm going to Yeah So it actually this one already says it has started let me just check the locks So this is still saying it is starting container became healthy Well, this one will actually say it has failed I think it runs in a timeout or something because it takes longer than the 300 seconds or whatever it has But as you can see on the locks on the right hand side, it is still in the process of of doing that and Will eventually become healthy, so I can already prepare for that and say I have CF apps then my link will be and the link local dot PC and Opening that here This our right is in need to specify The other port Right, so there it is I just this is the same application that you have seen before and as the URL reveals This is not a fake it is running on my local PCF environment now Which which basically tells me okay now have validated. It's not only Liberty compliant It's also the Cloud Foundry compliant and the next step would then be how I'm gonna get this Into like a enterprise level cloud so Looking at my windows, so that means we try to Stay on a platform level with with pivotal Cloud Foundry but we should remove the dev and switch it to a proper installation of pivotal Cloud Foundry running on Microsoft Azure and Tie it then to a Postgres database So what that basically means what we have to do is Do that database migration, I mean this is a part that I cannot show here completely I can just tell you what the steps you need to do from platform side in order to get there so I'm going to close this I can let the other one run Now I'm going to change the target This is an environment that I Got provided from our friends at at Pivotal to to demonstrate that and I hope the network is good enough right that looks good. So it says PCF Azure This is my endpoint and where I am connected so Basically what you need to do is Get yourself a database service and this is basically something we found really helpful running on that platform So I can open up the apps manager here. I'm sure most of you have seen something like that and You can also make this Sorry make this bigger and if you go to services here and you basically want to add a service you get all the the Azure Provided back end services directly like as native cloud founder services you can just invoke them with a simple CF create command and The in in the back end the the services will be created for you And once you once you're tied to the application all the connection information and credentials are going to be injected So this this one made it really really smooth for us to get there. So It's just that service creation That was one too many Takes a bit of time. I mean this I think in the background They will probably spin up a VM and put the database there. So for this case. I have already created one Which I called the psql test It and and now basically we need to access it from the outside and run our initial Configuration scripts for that database to make sure it will be running together with that application. So I have also on the application side. I think I can take this one out Well, I can actually use it. So I'm gonna save us the time of the CF push again That would be a similar thing. So the thing you should do in the first place then Do a CF push with a no start option. So that will basically just create the application and push the code But it's not gonna start any instances yet Just basically as the one you can see here, which I called anti-link backup and Then you can do a bind service This I guess it's the app name and then it's the service name and the service name was PSql test So it will probably tell me that I had they need to restage Did I oh it's back up? It's not so So yeah, it tells me to restage. This is something. I don't really care about what I really care about is I can now check the environment variables of my application and With that It will tell me all the connection information That got injected to the application from From Azure so I can see up here This is basically the URL where the application where the database back in is really running I got the configuration for username password and so on This is basically what is generated internally by the platform and injected to the application So from an application perspective the end user will never have to deal with that and I'm just Going to change the directory here and this will have a bit of an effect on the on the server XML so In the server XML you can then say the database name is just like cloud services and then PSql backup or psql test or whatever you name your your database connection is and all of that will be Injected to the application and will don't have to be configured out of there also what it means for us is We can we can leverage that to Connect to the database and configure it in the first place So I have a another script to do that. I think it's called restore psql Okay, so I need to split my screen here real quick and This So this is something I will most likely not get done until the end of this talk And it was probably a bit too challenging idea to do a micron I'm one of the migration in 30 minutes, but I just want to make sure I show you all the steps that that we did in there and Now I have I will execute this call And psql minus you the username which has just been created is this one the the Database is Forgetting I should be a host name as well Give me a second. I need to minus database. This is the Database name This is the host name. So normally you do that only once, right? and So I got user host name and maybe the port 5 4 3 2 and If things if I didn't do a typo that is asked me for the password and I also find the password here somewhere. Yeah, I got it. Thanks Yeah, and entering that now should hopefully give me the access and Well, I mean just trust me that this will normally work It's a bit too too much comma command line tweaking right here I'll try it later on before I do that I just want to show you that this actually works as you as you might have noticed I've already deployed an application there to show you that this is actually running this is this is the one right here and Going back to my browser Putting this in and say app to admin And then you see it's the same application now running on PCF on Azure connecting to that database If I mean you could actually validate this is a public URL you would be able to access it on from your mobile phone, so this is this is not a setup and From that point on this was a very effective means also for for the customer So when we when we wanted to show like the state We just send them an email with the link and say here access your application, please It's them the migration has been done to that point It was also very good to like test the application now having it running on on cloud foundry And we could it to like on a continuous way Work out if there were any problems trying to do scaling doing blue green deployments and all that the the typical Benefits that you would have from such a platform All right. I'm getting down with I'm with a time. I think so I Just wanted to recap the couple of steps what we did first to liberty then to PCF death using liberty then the PCF PCF on actually using liberty If you're interested more in the backgrounds why we did this the talk from tors than I from Basel last year you can find on YouTube. You can also catch me later I will I'll be happy to answer any questions. I'm just have another target four o'clock So that I might be busy then the only thing I want to say thanks to my colleagues to be as vicious and Constantine because they have been helping me to set up the To set up the the mocked code and one thing I would just really quickly Could everybody raised their hand who wishes tors in a speedy recovery because then I'll I send this photo to him And I'm pretty sure Thanks. That was very very kind He was yeah, he was very disappointed that he couldn't make it here And I'm sure like all your sympathy will then make him recover a lot faster. So I Don't know what the timing looks like Yeah, so I think maybe two questions in here would be fine and then we could definitely take some more time The lady was first Okay, the question was that we initially used db2 and where it then went when we migrated to cloud foundry. So Okay, this is my timer tells me I'm done We we lost db2 at the PCF dev step So initially websphere was connecting to db2 Liberty was connecting to db2 and the initial version running on PCF dev was also connected to db2 at that point we were already able to like spin up the the postgres sequel in parallel and I mean this one of course required some modification in the application this step I couldn't demo here, but it's like We we did that POC on on PCF dev to validate it it works against psql 2 and then I created the psql instance on Azure running that initial configuration script and that would be the same way as you can load the data into it Make sense now. Well Yes, so that like the data migration part is not Content of this talk. So I mean I the way I'm that what I did here was just basically initializing the database That the application can connect to it and work with it, but it didn't It I didn't migrate the data. Yeah, that's that's a pretty tough thing to do That yes, this might might be stuff for another talk Okay, you had a question too. I Mean it was a bit that as the things were not running in the same networks So this had of course an impact on well the question basically was About the performance differences between initial web sphere and then running on the cloud later on Well, this was kind kind of hard to measure because we had like a direct data center access on the web sphere side and then For the POC we were running on a public Azure. I can only say we didn't notice any Significant degradation or something like that. So the application responded in a similar way as it did before we We we did some comparisons running it by like locally on a web sphere and then on a Liberty and Yeah, that didn't do any harm to that Yes Well this The reason why I showed it that way is that it would work this way all the time. I mean IBM provides additional tooling Well, the one I showed was command line generating the news report There is not a tooling where you can plug in into an eclipse and it will highlight the pieces in the code that you actually have to migrate So that would be somewhat more visual But well the CF thing you can of course start an application through the apps manager and upload it this way But I wanted to have it in a generic way. So a couple of things can definitely be done different. Yeah They're always yeah There is just no like end-to-end migration tooling yet Which basically takes a monolith and then comes back with something which already running and connect to different database If if I had that that would be very good, but it would take me out of my job then okay, so thanks all for listening and As you are all experienced cloud foundries already I have another talk which is in the one-on-one section at 430 if you're interested But I expect most of you to know that already. Okay. Thanks a lot