Insights Hub Downloading an application droplet in Cloud Foundry and updating it to use cflinuxfs4

2024-05-17T20:43:42.000-0400
Developer Tools

Summary

Steps to help with downloading a copy of a deployed application droplet hosted Cloud Foundry and using it to update the CF stack from cflinuxfs3 to cflinuxfs4.


Details

This guide provides step by step instructions how to:

  • Determining which CF stack an application is using.
  • Generating a manifest file from an existing application.
  • Downloading an application droplet.
  • Pushing an application droplet to Cloud Foundry using a different stack.

These steps are helpful if the original application source code is no longer available to make an application update and the application stack needs to be updated. E.g., cflinuxfs3 to cflinuxfs4. 

The following example will show how to update your application stack from the deprecated Cloud Foundry stack cflinuxfs3 to cflinuxfs4 without the original source code.

May 1, 2024, applications using cflinuxfs3 stack will stop working.

 

 

Prerequisites:

 

 

Check which Cloud Foundry stack your application is using:

  1. Sign in to the org and space of the app you want a manifest file from. E.g., cf target -o <ORG_NAME> -s <SPACE_NAME>

  2. Use command cf app <APP_NAME> and you will see similar output:
    C:\> cf app <APP_NAME>
    Showing health and status for app <APP_NAME> in org <ORG_NAME> / space <SPACE_NAME> as user@company.com...

    name:              <APP_NAME>
    requested state:   started
    routes:            appname.apps.eu1.mindsphere.io
    last uploaded:     Tue 12 Oct 09:16:25 PDT 2021
    stack:             cflinuxfs3
    buildpacks:
            name            version   detect output   buildpack name
            php_buildpack   4.4.41    php             php

    type:           web
    sidecars:
    instances:      1/1
    memory usage:   128M
         state     since                  cpu    memory          disk             details
    #0   running   2024-04-29T16:37:12Z   0.5%   28.2M of 128M   234.6M of 512M
  3. The stack field will show which version is in use. This example shows cflinuxfs3 is in use.

  4. If your org has multiple spaces and applications, you will need to check them.

  5. Repeat step 2 as needed for any other spaces and applications and components.

 

 

Generating a manifest file from an existing application:

  1. Sign in to the org and space of the app you want a manifest file from. E.g., cf target -o <ORG_NAME> -s <SPACE_NAME>

  2. Use command cf create-app-manifest <APP_NAME> and you will see similar output:
    C:\> cf create-app-manifest <APP_NAME>
    Creating an app manifest from current settings of app <APP_NAME> in org <ORG_NAME> / space <SPACE_NAME> as user@company.com...
    Manifest file created successfully at C:\<APP_NAME>_manifest.yml
    OK
  3. The manifest file will be located in your current directory. The file name will be:
    <APP_NAME>_manifest.yml

 

 

Download application droplet:

  1. Sign in to the org and space of the app you want to download the droplet from. E.g., cf target -o <ORG_NAME> -s <SPACE_NAME>

  2. Use the command: cf download-droplet <APP_NAME> and you will see similar output:
    C:\> cf download-droplet <APP_NAME>
    Downloading current droplet for app <APP_NAME> in org <ORG_NAME> / space <SPACE_NAME> as user@scompany.com...
    Droplet downloaded successfully at C:\droplet_5569e13d-3e2d-4e73-a409-ae0c0000e621.tgz
    OK
  3. The file will be in your current directory. The file name will be similar:
    droplet_5569e13d-3e2d-4e73-a409-ae0c0000e621.tgz

  4. By unzipping the .TGZ file, you will get:
    droplet_5569e13d-3e2d-4e73-a409-ae0c0000e621.tar

  5. By unzipping the .TAR file you will see several files and folders.

    The source code* should be in the app folder.
    *Depending on the original programming language, the source code may not be available. E.g., Java programs are precompiled.

  6. Repeat step 2 for other spaces and applications and components as needed.

 

 

Push your application droplet using CF stack cflinuxfs4:

  1. Completed previous steps above to check your application is using depreciated stack cflinuxfs3 and have downloaded a copy of the application droplet. If not, complete above steps before continuing.

  2. Use the command cf push <APP_NAME> --droplet <DROPLET_NAME> -s cflinuxfs4 and the output will be similar:
    C:\> cf push <APP_NAME> --droplet droplet_5569e13d-3e2d-4e73-a409-ae0c0000e621.tgz -s cflinuxfs4
    Pushing app <APP_NAME> to org <ORG_NAME> / space <SPACE_NAME> as user@company.com...
    Uploading droplet bits...
     89.36 MiB / 89.36 MiB [===================================================================================] 100.00% 1m16s

    Waiting for API to complete processing files...

    Waiting for app <APP_NAME> to start...

    Instances starting...
    Instances starting...

    name:              <APP_NAME>
    requested state:   started
    routes:            appname.apps.eu1.mindsphere.io
    last uploaded:     Mon 29 Apr 11:51:33 PDT 2024
    stack:             cflinuxfs4
    buildpacks:
            name            version   detect output   buildpack name
            php_buildpack   4.6.17    php             php

    type:           web
    sidecars:
    instances:      1/1
    memory usage:   32M
         state     since                  cpu    memory         disk           details
    #0   running   2024-04-29T18:52:13Z   0.6%   19.2M of 32M   482.4M of 600M
  3. You can also use the command cf app <APP_NAME> to check as well.
    Any programing language issues is beyond the scope and support of this article.

  4. Repeat step 2 as needed for any other spaces, applications and components you want to update.
    If you have multiple files/components, rename the files names to make it easier to differentiate between them.

 

 

Troubleshooting:

Q: If your app fails to start after updating from cfliunxfs3 to cflinuxfs4. Example:

name:              <APP_NAME>
requested state:   started
routes:            appname.apps.eu1.mindsphere.io
last uploaded:     Mon 29 Apr 11:46:48 PDT 2024
stack:
buildpacks:

type:           web
sidecars:
instances:      0/1
memory usage:   32M
     state     since                  cpu    memory        disk           details
#0   crashed   2024-04-29T18:49:46Z   0.0%   6.9M of 32M   282.7M of 1G
Start unsuccessful

TIP: use 'cf.exe logs <APP_NAME> --recent' for more information
FAILED

A: Check the application logs with the command cf logs <APP_NAME> --recent for clues to why the application is not starting. Here are some suggestions that may be helpful:

  • Try restaging the application with the command cf restage <APP_NAME> to rebuild your application with the latest configuration and buildpack.

 

  • If you have multiple components to an application, e.g., Frontend, Backend. Check if there is a specific order the components need to start.

 

  • Check if sufficient memory (RAM) or disk space is allocated. Use commands to adjust the sizes. Restage the application afterwards.
    cf scale <APP_NAME> -k <MEMORY_SIZE>M or <MEMORY_SIZE>G
    cf scale <APP_NAME> -m <DISK_SPACE>M or <DISK_SPACE>G
    See Scaling vertically section of Cloud Foundry documentation.

 

  • Use command cf push <APP_NAME> --droplet <DROPLET_NAME> -s cflinuxfs3 to push an old version to Cloud Foundry.

 

  • If there is an issue with the deployment and you cannot deploy a previous version, you can use the command cf cancel-deployment <APP_NAME> to cancel an existing deployment.

 

 

  • If you're experiencing issues with different or custom builds not functioning properly with cflinuxfs4, but they do work with cflinuxfs3, you can try creating a new separate application instead of upgrading an existing one. Push this new application with cflinuxfs4 to help identify if the buildpack cache is causing any problems during the file system migration.

 

 

 

Helpful Cloud Foundry Command Line Interface Tool commands:

Sign in to your CF organization
Retrieve list of users and their roles for the space
Switch org and space
Switch space
See all applications in a space
See health, status, stacks details of an application
Retrieve the most recent application logs
See all application droplets and there guids
Cancel an in-progress deployment
Set the amount of disk space of an existing application
Set the amount of memory allocated to an application
Push a droplet to CF and use the CF stack cflinuxfs4
Rebuild an app with current configuration and buildpack
cf login -a https://api.cf.eu1.mindsphere.io --sso
cf space-users <ORG_NAME> <SPACE_NAME>
cf target -o <ORG_NAME> -s <SPACE_NAME>
cf target -s <SPACE_NAME>

cf apps
cf app <APP_NAME>
cf logs <APP_NAME> --recent

cf droplets <APP_NAME>
cf cancel-deployment <APP_NAME>
cf scale <APP_NAME> -k 1G
cf scale <APP_NAME> -m 512M
cf push <APP_NAME> --droplet <DROPLET_NAME> -s cflinuxfs4
cf restage <APP_NAME>

 

KB Article ID# KB000130921_EN_US

Contents

SummaryDetails

Associated Components

Cloud Foundry Developer Tools - Other