Fetching configuration parameters for an existing config service - cloud-foundry

I'm looking to delete an app and all the binded services associated with it. And then create the app and recreate all the services and bind them back.
What is the ideal method to retrieve all the binded services to the app?
What is the best way to fetch the configuration parameters for the existing config services?
Ref:
Create App: http://cli.cloudfoundry.org/en-US/cf/push.html
Delete App: http://cli.cloudfoundry.org/en-US/cf/delete.html
Create Service: http://cli.cloudfoundry.org/en-US/cf/create-service.html
Delete Service: http://cli.cloudfoundry.org/en-US/cf/delete-service.html

If you deployed your application with using a manifest file then all the information you need will be in there.
It's possible though that services were bound/unbound from the application via API, CLI or a UI. You can retrieve a list of the services bound to an application by running cf env APP_NAME
Services bound to the application can be found under the VCAP_SERVICES object. You can then parse that object for all services, delete and then recreate them all.

Related

Use terraform with Azure or AWS and with custom UI definition

I am looking for a way to create a custom UI definition, which I will use with Terraform to create resources and the terraform arguments/parameters will be provided from the UI. Basically the requirement is like
Creating a customized UI and pass parameters from there ex: Name for Web App Service
Deploy a Web App using terraform which requires name argument and it'll come from the UI input
I'm thinking if that is possible with Azure or AWS.
I'm thinking if that is possible with Azure or AWS.
Yes, its possible with Azure and AWS, or any other cloud provider. Obviously you have to develop a fully custom web application for that with backend running and managing your TF. There is no read-made tools for that.

Is it possible to update service with a bound application

Is it possible for an app bound to a service to update this service? Or is it something only an admin Cf can do ?
For instance, I would like to execute the following command
cf update-service test_db -c '{​​​​​"data":{"serviceStopped":true}}'
What I have in mind: create an app bound to test_db to update the value of the dictionnary.
Is it possible for an app bound to a service to update this service? Or is it something only an admin Cf can do ?
Yes, but it requires credentials. The application on CF itself has no permissions, so you would need to supply the credentials of a user or client that has permissions that the application can use to update the service.
Any user or client that is in the same org and space as the service with the SpaceDev role will have access to update the service.
If you want to have an application make calls to the Cloud Controller, like to update a database, you can do that by embedding the cf CLI and invoking it, you can use a library like the cf-java-client, or you can use the REST API directly.

Do we really need to bind Oracle service in PCF , can't we just use credentials mentioned in service?

I have a question what is the difference if I just use a Oracle/MySQL service provided by PCF without binding it? What difference will it create. I can anyway access DB using the credentials
There are two differences that come to mind:
When you create a service through the Cloud Foundry marketplace, that will create backing resources for the service but in most cases it does not create credentials. The act of binding a service to your app, in most cases with most service brokers, will actually create service credentials for you. When you unbind, again with most brokers, the service credentials are destroyed. This makes it easy to regenerate your service credentials, just unbind/rebind the service and restart your app. The net result is that if you don't bind, there are no credentials.
Most people do not want to include credentials with the actual application (see https://12factor.net/ for details why). They want to be able to provide configuration external to the app. On Cloud Foundry this commonly amounts to binding a service.
Having said that, how do you want to provide the credentials to your application?
Service bindings are there to try and make life as a developer easier but you don't have to use them. If you want to pass in the configuration some other way, like via environment variables, a config file, or using a config service (Spring Cloud Config Server or Vault) those are fine options too.
If you do not want to bind a service to your app, the only thing you'll need to do is to create a service key instead. A service key is like a binding, but not associated with an application. It will also generate a set of unique credentials. You can then take the credentials from your service key and feed them to your app in the way that works best for you.
Ex:
cf create-service-key service-instance key-name
cf service-key service-instance key-name
The first command creates the service key, the second will display its credentials.

wso2 identity server: automate the deploy of policies, claims, and other configs

I have hundreds of different identity server configurations (policies, claims, service provider, etc)
And i need to repeat the same configuration on several environments: dev, test, prod
To do it by hands through export import in web console - it's a nightmare.
What is the best practice to do an automatic configuration deployment to wso2is?
I'm thinking about the following options:
create a script that will call admin services to import identity server configs
create custom deployer (like a synapse & dataservice deployers, etc) and call admin services or do in-memory api calls
find where and how it's stored in database and do sql script to fill database
Maybe there is something exists for config deployment and I can't find it?
You can create your own scripts or custom methods to manage the deployments. But you have to maintain those scripts by your self.
In that case, you can use deployment automation tools such as Puppet, Chef and etc..
You can use WSO2 Puppet modules to deploy your configuration in different environments.
just in case if somebody need the file-based deployer
created a groovy script deployer that could be used for different purposes.
service-provider deployer
policy deployer

Azure: Moving an App Service to another existing App Service Plan

I'm attempting to move an App Service from one service plan to another. When I use the portal to do so, the other App Service plan is not displaying.
Both App Services are in the same Location and Resource Group.
The two App Services Plans are in the same location and have the same pricing tier.
I use the "Change App Service Plan" option for the web app. The only App Service Plan that is displayed is the current one. There is also a "Create New" option.
So, in summary:
1) Why is the other App Service Plan not able to be selected.
2) How can I move the App Service (Web App) to the other App Service Plan.
The reason why you are not able to see the other App Service Plan when you try to change the App Service Plan is due to current limitations in moving the Azure web app resources.
The other App Service Plan which you intend to move your Web Apps to is in another resource group with existing Azure Web Apps, which is not supported currently
Azure Web Apps current move limitations updated 01/04/2016
Hope this answer your question.
Not sure if it is something recent, but it seems it is finally possible. The option is in the main resource menu as "Change App Service plan". See:
I was able to move an app service(website) and also its deployment slot to a different plan (with same parameters and location - but did not try if this is a requirement).
Yes, we can now move the App Service Plan using the Change App Service Plan.
But sometime you will get No App Service Plan Found as this is the known restriction for the moving App Service plan.
Restrictions
We can move the App service plan only if the new plan is in the same resource group and geographical location.- These two conditions is is to ensure the new plan is in same webspace
Webspace
Azure deploys each new App Service plan into a deployment unit, internally called a webspace. Each region can have many webspaces, but your app can only move between plans that are created in the same webspace. An App Service Environment is an isolated webspace, so apps can be moved between plans in the same App Service Environment, but not between plans in different App Service Environments.
You can’t specify the webspace you want when creating a plan, but it’s possible to ensure that a plan is created in the same webspace as an existing plan. In brief, all plans created with the same resource group and region combination are deployed into the same webspace. For example, if you created a plan in resource group A and region B, then any plan you subsequently create in resource group A and region B is deployed into the same webspace. Note that plans can’t move webspaces after they’re created, so you can’t move a plan into “the same webspace” as another plan by moving it to another resource group.
You can find this in the official doc here and here
You can also refer this SO
You can configure a backup and restore on the new App Service under the new APp Service Plan.
Backup an app: https://learn.microsoft.com/en-us/azure/app-service/manage-backup#:~:text=The%20Backup%20and%20Restore%20feature,or%20restoring%20to%20another%20app.
Put your code in DevOps and deploy it to the new service plan and point DNS.
thank you for the tips
i found a work around. you can move app service plan to the same resource group, and then you can move apps from one plan to another.
Move resource first will do a check, after that you can review and finally move.