Grails App with Multi Tenant Single DB plugin URL implementation in Cloudfoundry - cloud-foundry

I am currently creating a web app using Grails implementing Multi Tenant Single DB plugin. The plugin allows me to have multiple tenants on a single db using a tenantID to differentiate between tenants. The plugin detects witch tenant will deal the current request that is made on my app by resolving using different domains/subdomains for each tenant.
For example:
Tenant 1 = companyA.myapp.com
Tenant 2 = companyB.myapp.com
On my local machine running Grails development mode I was able to implement the different hosts by changing my /etc/hosts and each tenant would have their own subdomain.
I am currently interested in using cloud foundry as my cloud platform but when I deploy my app to cloud foundry it is already using my app name as the subdomain for cloud foundry.
For example:
- myapp.cloudfoundry.com
Is it possible to change or control the domain name resolver in
cloud foundry?
Does anybody know how to handle multi-tenant subdomains as explained above in cloud foundry? Probably provide the steps in implementing this using cloud foundry?
What is the best approach to implement this using cloud foundry?
My App is using Grails 2.0.4 and Multi Tenant Single DB plugin 0.8.2.
Thanks

Unfortunately the current beta version CloudFoundry does not allow modification of the cloudfoundry subdomain. The plan is to have the GA towards the end of this year with a private preview of the version of the site available sooner in the fall. At that time you could be able to customize the subdomain.
Therefore you might need to change a little in your TenantResolver to only check the subdomain that varies.
To implement your requirement, did you try installing the grails cf plugin? If not you can start from here.
If you are using cli, installing the plugin just needs command in your project workspace:
grails install-plugin cloud-foundry
When your app is ready for deployment, push it to cloudfoundry:
grails cf-push
Note that you will have to have your cf credentials configured in the grails config file.
After that you can map multiple URLs you want using:
grails cf-map user1.yourapp.cloudfoundry.com
If you have already known about vmc which is the client command line interface for cf, you can see the urls mapped with your app by
vmc apps
If not you can refer to the installation guide to start if you would like to do that.
If you are using STS/eclipse, things will be even easier. First you need to have grails-support extension as well as the cloud foundry integration installed. For detailed docs of the cf integration please refer here.
After your app is deployed, right click the project and choose "Grails Tools" -> "Open Grails Command Prompt". This will enable you to have same grails cf plugin commands as the CLI does.
Hope this can help your move forward in the cloudfoundry world. Let me know if you have more questions.
Thanks,
William

Related

Deploy Python apps to Azure App Service on Windows Server

I can't find any proper guideline how to deploy a Django web application on Windows Server, almost all tutorials talk about Linux. Can someone explain or give a link?
I now we need an IIS. What about DNS and AD, or any other services? I would like to know the relationship among IIS, DNS and AD, or any other services.
One simple way to deploy a Python app to Windows app service is to use the Devops Projects
Step 1: Create a Python Project
Step 2: Choose an application framework as Django
Step 3: Select the Windows Web App
Step 4: Fill the rest of the settings.
Once the project is created you can pass the custom code and do the deployment from the Azure Devops pipelines.
EDIT
if you want to deploy the app on VM follow the steps as mentioned here.

Why does pivotal cloud foundry does not remove a route when a corresponding app is deleted?

I have been exploring Pivotal Cloud Foundry - Public Cloud Version by setting up an Pivotal Web Services account.
While exploring the CF CLI I followed the below tutorial.
https://pivotal.io/platform/pcf-tutorials/getting-started-with-pivotal-cloud-foundry/introduction
I was able to successfully push the sample spring boot app to PCF Cloud and follow the tutorial.
When I started to play around with it, I tried deleting the app using the below command. cf-spring is my app name.
cf delete cf-spring
When navigated to my Pivotal Web Service account, I could see the app has been deleted. The route still displays the name of the route which was created when an app was created using the cf push command.
So I tried to delete the route using the below command.
It does not allow me to delete using CLI ? Does the app delete command should have taken care to remove the related routes associated with the application ?
Try cf delete-route -h to see the syntax of the delete-route command.
You probably want to run cf delete-route cfapps.io --hostname cf-spring-rested-platypus.
In recent versions of cf-cli you can also run cf delete-orphaned-routes.
I think the reason CF doesn't completely delete the route when you delete an app is so that it kind of keeps the hostname reserved for your use, ie: someone else can't reuse it in another org or space if you've just taken down your app for a refresh. It's kind of annoying when you actually want to reuse the hostname in another space, but considering the multi-tenancy capabilities it kind of makes sense to keep them intact/reserved.
cf delete APP_NAME will not delete the route bound to the Apps and this should not happen first-of-all. Because the router-concept in Cloud foundry is that
One App can have Multiple Routes and Multiple Routes can be configured to one App.
Its Many-to-One mapping. So there is a possibility that the routes you created would still be mapped to another App and it would be as Orphaned-route, only when there are no apps for that routes..
So its a cautious decision and a wise decision too !!

Parse Dashboard on AWS and adding cloud code

I configured a parse server on my AWS elastic beanstalk using this guid I've tested it and it all works fine
Now I can't find a way to deploy parse dashboard on my server.
I did deployed parse dashboard on my local host and connected it to the application on server, But this way I cannot manage (Add and remove) my apps.
Another problem is that parse dashboard missing cloud code on default, I found this on git, but I cant understand where do I add the requested endpoints, is it something like adding app.use('/scripts', express.static(path.join(__dirname, '/scripts'))); on the index.js file?
in order to deploy parse-dashboard to your EC2 you need to follow the Deploying Parse Dashboard section in parse-dashboard github page
parse-dashbard github page
Please make sure that when you deploy parse-dashboard you are using https and also basic authentication (it is also part of the guide)
Now regarding the cloud code: the ability to deploy cloud code via parse CLI and to view the nodejs code in parse dashboard are not available in parse-server but those are parse.com features. Cloud code in parse-server is handled by modifying the main.js file which exist under the cloud folder and deployment should be done manually by you but the big advantage in parse-server cloud code is that you can use any NodeJS module that you want from there and you are not restricted to the modules that were used by parse.com .
Another point about the dashboard. What you can do is to create an express application and then add parse-server and parse-dashboard as a middleware to your express application and deploy the whole application to AWS and then you can enjoy both parse-server (that will be available under the /parse path, unless you changed it to something else) and parse dashboard that will be available under the /dashboard path
Enjoy :)

WSO2 P.PaaS : Accessing the AS and other WSO2 products

So I have got WSO2 P.PaaS installed and running. I want to deploy .war file to the Application Server. It seems the AS on P.PaaS does not accept .war file; but the stand-alone one does. See here. Also, I want to use the WSO2 products deployed into the PaaS. I am not sure what URL or port I should use. Is there a tutorial that I can use to experiment?
Sorry for the brevity, but, I am new to WSO2.
What PPaaS version you have installed, 4.0.0 or from current master branch which is 4.1.0 milestone 1 version?
Here is the quick start guide Quick start guide .
You can access the management console as https://STRATOS_DOMAIN:9443/console.
Assuming you are using PP 4.0.0 version,
Log into management console
Go to cartridges page. There you can find the available cartridges, you should find Application Server as a cartridge.
Click on AS cartridge in order to subscribe for it. At subscribing process you would be asked a GIT repository URL.
After you subscribe, PP will clone what is in your GIT repository url in to Application server. So if you provide a url which has your web application, those application would be automatically deployed into the Application server. Here is a sample GIT repository , you can include your web apps under "webapps" folder.
There after if you modify your web apps (say web app version 2) and commit the changes to your repository, Stratos/PP automatically update Application server with the new web apps.
Since you have already deployed PP, you can have a loot at this screencast to see how you can deploy a web app

Can we have Ui for cloudfoundry deployed on AWS

Iam new to Cloudfoundry on AWS. I have deployed cloudfoundry on AWS, but when i want to push an application into cf which i have deployed i was using command line tool (cf). Is there any way we have UI like Cloudfoundry where we can check our app running on UI , and even on Bluemix we can have ace.ng.bluemix.net to login and check our apps.
I want to know if i can check my appp deployed in my custom cloudfoundry deployed on AWS in UI where i can see other applications as well running.
It would be very helpful if i get this.
Thanks & regards,
Srilatha K.
There is the admin-ui, which is a bit more detailed than the Pivotal WS/CF interface but will provide you a BUI as an alternative to cf cli:
https://github.com/cloudfoundry-incubator/admin-ui
You can make use of BOSH.
It takes care of deployment & life cycles managements...
Reference - http://www.slideshare.net/ManuelGarcia122/cloud-foundry-handson-deployment-workshop
Slide 29 onwards
Useful link - http://blog.altoros.com/tag/cloud-foundry