What happens to a CF manifest after a successful deployment? - deployment

I am currently tinkering with Cloud Foundry. I understand the basic principles of the tool but can't find what cf push actually does to a manifest file.
Does it read the file just once or is it stored as a static file with the application?
Also, is it possible to retrieve a manifest from a deployed app?

The cf push command reads the manifest file and uses the attribute values (instances, memory, disk etc) for the current deployment. The manifest helps to automate the app deployment. It can also be used for deploying multiple applications at once. As stated here: https://docs.cloudfoundry.org/devguide/deploy-apps/manifest.html, when you deploy an application for the first time, Cloud Foundry reads the variables described in the environment block of the manifest, and adds them to the environment of the container where the application is deployed. When your app is running, your environment variables can change depending on your setting. For example, if you have an auto-scaler, it could have increased/decreased your no. of instances/memory/disk (environment variables). If that is the case, when you stop and then restart an application, its environment variables persist.
The manifest file is read only when the "cf push" command is executed. As stated in the Cloud Foundry Documentation (https://docs.cloudfoundry.org/devguide/deploy-apps/prepare-to-deploy.html#exclude), the manifest file is just read and not actually stored as a file, hence it could not be accessed for a deployed app. However, if the purpose for accessing your manifest is to read your current environment setting, it can be accessed through the Cloud Foundry API's Get App Summary (or) Get detailed stats for a STARTED App: https://apidocs.cloudfoundry.org/234/

Related

appsettings.json copied, passed or published to Azure App Service configuration?

I have been trying to understand the appsettings.json method of use for some time now as I am building an ASP.NET Core 3.1 API that is to be published to Azure.
When I'm publishing the project to my web app my settings don't seem to get copied to the App Service configurations list in the Azure App Service resource.
Is this how it is supposed to work or am I missing something here?
I've read about appconfigurationbuilder and such, but as I understand it it's for telling the application which appsettings.json file to use depending on what environment is defined in the environment variable (ASPNETCORE_ENVIRONMENT) for example.
Though having a bunch of Key Vault references in my config, this doesn't work as my references of type:
#Microsoft.Keyvault(SecretUri=[KEY VAULT SECRET URL])
Can't fetch the secret from keyvault by only being the the appsettings.env.json file and not being copied to the app service configurations where they connect to keyvault through identity principal.
What am I missing or have I misunderstood the whole thing with appsettings.json?
So short recap: what I'm trying to do is understand if app settings can work like this:
appSettings.Env.json --> publish project to Azure app service --> settings are set automatically in app service configuration.
As mentioned in the comment, the app settings will not be copied to the azure app service when published, you need to specify the values in it manually.
Follow this doc - https://learn.microsoft.com/en-us/aspnet/core/fundamentals/environments?view=aspnetcore-5.0#azure-app-service

How do I verify my cf app configuration items

I'm just starting to play with the IBM cloud offering. I've built a simple flask app and am trying to deployt it via a toolchain. When I run my toolchain the app deploys successfully, however I can't access the url.
I am looking at the deployment logs and have a couple of questions.
First, I see this:
2020-12-24T15:00:39.66+0000 [APP/PROC/WEB/0] OUT * Environment: production
But the environment I thought I was deploying to was dev. How do I change the environment I expect the toolchain to deploy to?
I'm assuming that the url that shows up in the log output should be accessible, but it isn't.
My manifest has random-route: true defined. How do I check that the url in the logs is available and pointing to my deployed cf app??
Thanks for any help and Happy Holidays!
Have you checked the app using the cloud console ui at https://cloud.ibm.com There should be a link to the app url.
It is possible to differentiate between def and prod via environment variables. I believe you can pass environment variables via the manifest file. You can sent via ibmcloud cf set-env and then ibmcloud cf restage.
So the reason my app was failing was I was missing a couple of items/components
First, from the code I needed these lines in my python.
port = int(os.getenv('PORT', 5000))
if __name__ == '__main__':
app.run(debug=True, host='0.0.0.0', port=port)
The cloud foundry deployment maps the external facing url to your app.
In order to do that it needs to know what port to use and that first snippet sets it to the port defined as an environment variable (IBM Cloud defines this) or port 5000 if the variable is not set.
The second snippet is the standard script special variable evaluation and execution control mechanism.
I didn't have this or the app.run call.
adding these allowed me to get the app running by pushing it from my machine locally. Now that i have it deploying successfully, I'll start working on getting it to deploy via a toolchain.
I figured all of this out by reviewing this tutorial I found on github and comparing what they were doing and what I was doing.
https://github.com/IBM-Cloud/get-started-python
Lastly, to see how the app has been mapped go the cloud foundry section of the ui and select the app. From there you can look at the logs and they show how the app maps in the url resource access history. That being said, fundamentally this wasn't going to help me solve my problem as it was related to my source code, not the actual route mapping.
Seems your toolchain has environment variable set which you can change by setting the following:
ibmcloud cf env-set flask_app Environment development
It can also be set via mainfest.yml file as shown below:
env:
env_name: development
URL is given on the UI that you may refer. Other way to check the URL is to look for the route so you may use
ibmcloud cf app flask_app
If you see any issues in accessing the app using route so it means there is some problem with the app causing this to happen.

Making Registry changes during startup of stateless service in Service Fabric

I am using a library which searches in registry for a dll. That dll can be installed by running MSI in the Service Fabric cluster and this path will be set.
But I wanted to avoid the installation of MSI in the cluster, and provided the required dlls in the package itself. During start up of the service, I am creating the registry entry and giving the location of the dll in my package. Everything is working as expected.
Is this approach ideal? Are we allowed to make changes to registry? If not, how do we solve this problem? Any pointers are appreciated.
If the library has to use the registry, there is nothing you can do about it other than register the values. If you could change the DLL to retrieve this information from the configuration file would be the ideal solution.
You can do it in SF, the right way to do it is using the SetupEntryPoint option of the ServiceManifest to do these management tasks, and from the Application manifest you can set the policies to specify which user you should run these policies. it is described here with more details
The main issue you have on SF with this approach is that you application might move around the cluster and you have to register it on every node, and maybe also remove it when the application is not running there anymore to avoid garbage in the registry.

Custome developer environment variables for local service fabric clusters?

When debugging service fabric applications locally it would be nice if developers could have some custom private configuration settings. The application parameters and publish profiles allow per environment configuration but not per developer configuration (unless I've missed something).
I need a way to have service fabric applications running in local clusters to get local configuration values. So each engineer can have their applications running locally point to a private database, IoT Hub, external web service instance and other private resources. Environment variables would work as overrides but the local cluster doesn't pick them up from the host machine.
Is there some way to provide this type of local configuration?
Environment variables are mapped to something else with SF dev cluster, just like %temp% folder is. Since that would be a static info, perhaps it should come from static configuration that is not checked into repository.
There's another question with an answer you were looking for, but it still requires to update SF manifest file.
Update: environment variables scoped to User won't be available. System scoped environment variables will be accessible. VS needs to be restarted to see values of system scoped env variables if those are updated.

Build number not available to running app?

I've got a Liberty Profile app that I am building/deploying with the devops pipeline, and I don't see any mechanism for determining the current build that is running. I've dumped all the environment vars, and nothing appears to indicate the build number.
Is the value someplace I am just not finding or is it really just not available?
Build and Deploy Jobs in Bluemix DevOps Services offer and environment variable called: BUILD_NUMBER. This variable is not propagated automatically to Bluemix runtimes.
Perhaps in the deploy script, you can add a Cloud Foundry environment variable associated to your app. Something like:
cf set-env "${CF_APP}" BUILD_NUMBER "${BUILD_NUMBER}"
so you will have such info accessible from the running code.
Hope it helps!