CloudFoundry - How to understand the operating system(OS) environment of an app?

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-13 05:30:34

问题


We push a java app on cloud foundry using cf push with below manifest file

    applications: 
       - name: xyz-api 
         instances: 1 
         memory: 1G 
         buildpack: java_buildpack_offline 
         path: target/xyz-api-0.1-SNAPSHOT.jar

I understand that, PAAS (ex: cloud foundry) is a layer on top of IAAS(ex:vcenter hosting linux and windows VM's).

In manifest file, buildpack just talks about userspace runtime libraries required to run an app.


Coming from non-cloud background, and reading this manifest file, I would like to understand...

1) How to understand the operating system(OS) environment, that an app is running? On which operating system...

2) How app running on bosh instance different from docker container?


回答1:


1) How to understand the operating system(OS) environment, that an app is running? On which operating system...

The stack determines the operating system on which your app will run. There is a stack attribute in the manifest or you can use cf push -s to indicate the stack.

You can run cf stacks to see all available stacks.

In most environments at the time of writing, you will have cflinuxfs2. This is Ubuntu Trusty 14.04. It will be replaced by cflinuxfs3 which is Ubuntu Bionic 18.04, because Trusty is only supported through April of 2019. You will always have some cflinuxfs* stack though, the number will just vary depending on when you read this.

In some environments you might also have a Windows based stack. The original Windows based stack is windows2012r2. This is quite old as I write this so you probably won't see it any more. What you're likely to see is windows2016 or possibly something even newer depending on when you read this.

If you need more control than that, you can always push a docker container. That would let you pick the full OS image for your app.

2) How app running on bosh instance different from docker container?

Apps running on Cloud Foundry aren't deployed by BOSH directly. The app runs in a container. The container is scheduled and run by Diego. Diego is a BOSH deployed VM. So there's an extra layer in there.

At the core, the difference between running your app on Cloud Foundry and running an app in a docker container is minimal. They both run in a Linux "container" which has limitations put on it by kernel namespaces & cgroups.

The difference comes in a.) how you build the container and b.) how the container is deployed.

With Cloud Foundry, you don't build the container. You provide your app to CF & CF builds the container image based on the selected stack and the additional software added by buildpacks. The output in CF terminology is called a "droplet", but it basically an OCI image (this will be even more so with buildpacks v3). When you need to upgrade or add new code, you just repeat the process and push again. The stack and buildpacks, which are automatically updated by the platform, will in turn provide you with a patched & up-to-date app image.

With Docker, you manually create your image building it up from scratch or from some trusted base image. You add you own runtimes & application code. When you need to upgrade, that's on you to pull in updates from the base image & runtimes or worse to update your from-scratch image.

When it comes to deployment, CF handles this all for you automatically. It can run any number of instance of your app that you'd like & it will automatically place those so that your app is resilient to failures in the infrastructure & in CF.

With Docker, that's on you or increasingly often on some other tool like Kubernetes.

Hope that helps!



来源:https://stackoverflow.com/questions/54599886/cloudfoundry-how-to-understand-the-operating-systemos-environment-of-an-app

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!