A workaround to this issue is to create a symbolic link from your NFS volumes mount point to a new directory under the Applications starting directory. Everything on the NFS Volume then becomes available for application usage by referencing that directory.
1. Create an NFS service that all our apps will mount:
cf create-service nfs Existing myapp -c '{"share":"10.1.2.3/exports/myappdocs"}'
2. Create a .profile
file in your app directory. Add a command in the .profile
to create a symbolic link from the bind service mount point to a directory where your app can access it. The static buildpack document root is /app/public
.
Note: You will bind the service in the step after this one, as you are pushing the app without a NFS Services section.
cat .profile ln -s /var/myapp /app/public/myapp cf push -f myapp.yml
3. Next bind your NFS service to the application:
cf bind-service myapp myapp -c '{"uid":"1000","gid":"1000","mount":"/var/myapp"}' cf restage myapp
4. To confirm the process was successful, access the content in the NFS volume by including the directory name in the URL.
curl http://myapp.apps.domain/myapp/index.html