Henry Bai
Henry Bai

Reputation: 447

How to upload resources files with app to cloud foundry

My project needs to read several files as resource (krb5.conf, truststore, keytab). they are in project directory. e.g. C:\Users\WorkSpace\MyProject\krb5.conf.

However, when I upload my project to cloud foundry, the app cannot find my resource files when running.

This is my first time deploy app on cloud foundry. Is there anyway to upload resources files like text file, image jpg to cloud foundry with project? so app can read those files when running on cloud foundry

Upvotes: 1

Views: 694

Answers (1)

Daniel Mikusa
Daniel Mikusa

Reputation: 15051

When you cf push an application, the cli will upload all files under the specified path. By default, the path is the current directory. You can set a custom path with --path or -p.

The --path and -p argument may also point to zip files or jar files, for Java apps. In that case, the contents of the archive are uploaded.

The only exceptions:

  1. Files listed here.

    • .cfignore
    • _darcs
    • .DS_Store
    • .git
    • .gitignore
    • .hg
    • manifest.yml
    • .svn
  2. If you have a .cfignore file (same syntax as .gitignore), anything matched is not uploaded.

To troubleshoot issues:

  1. Check your path. Make sure it's correct and includes your files.
  2. Make sure the files are not being ignored.
  3. Run cf ssh to your app and check if the files exist.
  4. Ensure you're using the correct path to files in the container, use $HOME or /home/vcap/app which are the root for your application files.

Upvotes: 2

Related Questions