Welcome to this series of hands on tutorials from the SAP HANA Academy
I'm Philip Mugglestone
in this series. We're covering the SAP Business Technology Platform
in this video tutorial will cover how to configure a
custom domain when you're using
SAP BTP, Cloud Foundry runtime.
And we'll do that using the SAP Custom Domain Service We'll also see how
we can build and deploy an
application built using
the SAP Cloud Application Programming Model framework
that uses our configured custom domain.
Now by default,
when you deploy an application to the SAP BTP, Cloud Foundry runtime,
it will use the standard SAP BTP domains.
So for example, SAP HANA dot on demand dot com.
But it may well be that for your application
you want to use your own custom domain Now,
of course you're gonna need to have a custom domain.
You're going to need to be able to manage that.
I'm gonna be showing that actually using AWS route 53
but this approach is valid for any way that you can
manage your DNS So let's go and have a look at
our hosted zone and see that we have the domain.
partnerengineering.info
So what we might want to do is have our applications use partnerengineering.info
probably the best way to do this is to use a wildcard domain.
So for example,
we might do star dot
partnerengineering.info or *.apps.partnerengineering.info what we're also
going to need to be able to do is to create certificates
and for that we'll be using
Let's enCrypt which is a Great free way that you
can get started is particularly good for doing prototypes.
Now, let's just have a quick look at the documentation.
If we search on the SAP Custom Domain Service we'll see that's a product,
this is where we can get lots of information about what we're going to be doing
and particularly you'll see there's a section
on working with the custom domain manager uI
and that's what we're going to be using primarily to do our configuration.
Now it's also possible to do it using the command line interface,
basically the plug into the
SAP BTP, Cloud Foundry runtime command line interface.
This is something you can do it, maybe you want to automate it,
but we're going to focus in this video tutorial of doing it with the UI.
So if we go to our sub account, we can see we've got a sub account created,
we've got SAP BTP, Cloud Foundry environment set up and working,
we've got a space defined and
also we've actually got SAP Business Application Studio up
and running and I've got the generators from the SAP HANA Academy set up,
we'll be using those later when we want
to actually build and deploy our example application.
So in order to access the SAP Custom Domain Service UI,
we will need to subscribe to it.
Now the first thing to do is to go to your entitlements and then configure
ad service plans and I'm going to search on
SAP Custom Domain Service and basically is the application that
we want to entitle ourselves to use.
So we're going to add that service plan and then we'll safe.
Now, once we've got the entitlement,
we can go to our instances and subscriptions and we can subscribe by hitting,
create and then selecting the service.
So it's the SAP Custom Domain Service
again, that plan that we
entitled ourselves to use
and we'll hit create
now before we can actually launch the application will need to
give ourselves the necessary roles and authorizations to use it.
So to do that, we'll go to role collections in the security area.
We're gonna create ourselves a role collection,
call it what you want
it create
and I'll select it
and choose to edit
Now what I need to do is add in a couple
of roles specifically it's the roles that relate to custom domain.
See there's one called admin one called viewer.
It's up to you how you manage your role collections which rolls you put in them,
I'm gonna put them both into a single role
collection and then I'm gonna add myself as a user
effectively to have this role collections assigned
and I can save it. So now I should be able to go ahead and use the application.
So let's go ahead and launch it
and you'll see we've got four areas we can look at, we can look at domains.
SaaS roots that's not really relevant to what we'll be doing here
TLS configurations and service certificates.
So the first thing we'll do is manage our reserved domains.
So you can see here that you've got one reserved domain already.
This is the default one that will get used.
What we're gonna do is reserve our domains, we'll add reserved domain,
then you put in your main domain name.
So in our case it's partnerengineering.info
so I'm going to copy and paste that in.
That's the high level domain within SAP BTP and
then we're going to actually create custom domain
And for that we'll use to create custom domain
and we'll do it for our SAP BTP, Cloud Foundry runtime
organization will select the landscape we're using
and we'll select the reserved domain we're using
and then I'm going to give it a sub domain for example, I'm going to do apps.
So it will be apps.partnerengineering.info info
and we'll hit finish
now once we've done that we're going to need to
activate it and that will involve getting a certificate created.
So we'll go back to our main menu, we can create a TLS configuration
let's just choose create TLS configuration.
We can call it apps dash TLS
Next next finish
of course you can do more configuration as
required but this default one will work for us
and then we need to go to service certificates
and this is where we're going to create
a server certificate for our wild card custom domain
so we can give it a name, we can call it
perhaps
dash cert hit next,
select the landscape that we're doing
that in that's our SAP BTP, Cloud Foundry runtime landscape
and then we select the alternate names and for
that one we want to take the wildcard *.apps.partnerengineering.info
and we see this created a certificate signing request.
So what we need to do is just select this item and then we will go to the option
which is to get certificate signing request so click that
and it will give us this certificate signing request.
So I'm going to copy that and then using some kind of editor.
So I'm going to use visual studio code,
I'm going to create a new file,
put that value in and I'm going to save it
has apps dot
but dot pem
Now,
what I'm going to need to do is to actually
make a certificate signing request to my certificate manager.
In this case we're using let's encrypt and for that we can use the command called cert
so we can check that we've got that up and running depending on your environment,
you have different ways of actually configuring and setting up sir.
But we're going to issue this command basically in case of sir,
but we're gonna create a certificate,
we're gonna use DNS challenges.
We're going to use it for our
domain which is *.apps.partnerengineering.info We specify our email
and then we'll give our file the one we just
save the pen file so that's our certificate signing request.
So let's go ahead and run that command.
So what he's asking us to do is to create a DNS text record with a certain name
and also a certain value so it can verify we really have ownership of this domain.
So you just pop back to route 53.
This is where we can create a record again, it's a text record that we would create
and we need to give the sub domain name
.partnerengineering.info and then the value is this item here.
We'll paste it in it, create
now. It can take a little while for that to be propagated through the DNS service.
What you can do here is you can actually view status so it's currently pending
and now we can see it's in sync so it's basically active.
So at that point we can go back to our command line and are certain
command
press enter
so we can see that our certificate has now been created
and actually in a pen file on our machine here.
So what I'm gonna do is have a look at these files so we can see here 001 chain pen.
I'm going to actually look at that. My text editor.
Now what we're going to need to do here is just make a little change.
We're gonna need to add in the root certificate
and that's going to use to go at the bottom.
So for that we'll need to go and find the root certificate
and that depends on who you're using as your provider.
So if we go to the documentation
and then scroll down we'll find that there's an
item called chain of trust Root and intermediate certificates.
And then if we scroll down we'll find this is where we can get our root certificates.
Now the one we're going to need is the srg Root X one and it's the PEM version.
So I'm gonna click there to download it.
So what I need to do is to open up that file in a text editor
and then I'm going to
copy the content and put it at the bottom of my
chain, pem Now you can save that or actually in this case simply just
copy all of it and then we can go back to our ui
and choose upload full certificate chain.
We can paste in
that value. We copied
hit next.
It will then try to decode it,
notice it's found the server certificate the intermediate and
the root certificate that we just added.
Hit next step
and hit finish
so we can see the certificate has been added
but it's currently inactive.
So what we now need to do is activate it to simply select it and choose activate,
choose the alternate name. You want to activate.
Hit next, choose the TLS configuration that you've created. Hit next
and then hit finish
So we can see the status was in progress and now it's set to active.
So we're looking good. We've basically activated our custom domain.
Now there's one final step we need to do and that
is actually to set up this custom domain within our DNS.
So if we just go back to where we're working with Route 53,
we can delete this challenge that we just created.
But what we need to do now is to add a record
and it can be a C name record that basically will be our wild card.
So *.apps.partnerengineering.info
and then we're going to need to give the value that it's going to redirect to
and this you're going to find in your cockpit
basically it's the API endpoint of your
SAP BTP, Cloud Foundry environment So in your sub account,
go to the overview and then you'll find your api
endpoint and it's basically this value without the https.
So this part here, I'm gonna copy that
and paste it in like that
and then we can create the record
again.
You may need to wait a few seconds or a minute
for that actually to propagate out to the DNS service.
So now we're ready to go ahead and actually build
and deploy an application that uses our custom domain.
So for that what we can do is
go to the SAP Business Application Studio I'm going to use the
SAP HANA Academy generator that will allow us to build
a full stack application
using the SAP Cloud Application Programming Model framework or CAP
So let's hit start,
we can give our app a name
and we'll keep it really simple.
So I'm not gonna bother with SAP HANA Cloud persistence
for the external API we'll try the nasa near earth object web service,
pretty much everything else we can leave as is except here, we can specify,
we're going to be using a wildcard custom domain.
So that's where we can put in apps.partnerengineering.info
we can leave all the rest of it the same,
we can hit next.
Now the project has been scaffold out so if you go and have a look, we can see the code
and particularly if we look at the mta.yaml file will notice
for each of our modules that are accessible from the internet,
we've got the domain parameters specified and it's using our custom domain.
So both for the approuter and also the back end srv service module.
So any of those modules that you want accessible use domain
Now if you want,
you can also specify the host option here if you want to
override the default host but in this case it's just a custom door
that I want to be focusing on.
Also if we go to the xs-security.json we'll see in here we've got our security setup,
we've also got our redirect URI for the ap router basically for when we
want to do the logging so it can redirect back from the authorization service
so you can see here it specifies our custom domain as part of that log in callback URI
so we should now be able to build
and deploy the application so we'll build the project
and once the build is completed we
can then deploy it to the SAP BTP, Cloud Foundry environment
so we'll find out MTA archive file
and we'll deploy
and if needed, we make sure that we actually
log into the SAP BTP, Cloud Foundry runtime environment,
make sure you're using the correct endpoint again,
you can find that we saw that a moment ago
here
for the api endpoint
I'm going to use the passcode option, click the pass code link
authenticate. I'll take my temporary authorization code,
paste it in here,
sign in
once I'm signed in, I'll choose my SAP BTP, Cloud Foundry runtime
and space
and apply
and now it will go ahead and deploy to that organization and space.
So the deployment is now finished.
What we'll need to do is authorize our business users to access the application
will go to security, choose business user
assign
role collections that were created as part of this application. So my app
admin interviewer
and then
if we go to the SAP BTP, Cloud Foundry runtime option two spaces
and our space where we deployed to
just notice here in the route section.
You see it's using our custom domain for the roots.
So if we go and look at our applications, we've got our approuter the main entry point
and we can see again it's using our custom domain in the route,
you can click it
and we've launched application,
you can see it's working
and we can get asteroid information from Nasa, you can see it all cases,
it's actually using our custom domain here.
So in this video tutorial we've seen how we can configure a custom domain in
the SAP BTP, Cloud Foundry runtime
using the SAP Custom Domain Service
we've done that using the custom domain,
application or uI
and we've also built and deployed an application using
studio so we can see how you would actually
implement using that custom domain from your application.
You can find more video tutorials on our Youtube channel
if you'd like to be informed as soon as new video tutorials are published,
then please subscribe.
Thanks for watching.