Server Paths & Instance File Structure

Last Updated October 2014

Knowing the file structure of your apps’s instances is incredibly useful and important. It allows you to use proper absolute paths and helps you stay oriented when SSH’d into a service. This doc outlines the file structure of your app’s instances and discusses relevant filepaths. After reading it, you should be familiar with:

  • The file structure of instances
  • Relevant directories you should be aware of

Code Instances are Read-Only

Before we we get started, it’s important to know that all code service filesystems are read-only with the exception of the /tmp directory. While it is possible to change file permissions while SSH’d in, it’s highly discouraged for the reasons outlined in the SSH Access doc. If a file needs writable permissions, it should be stored in network storage.

Relevant Server Paths

There are only two directories you really need to be aware of in your app’s instances: /data & /tmp.

/data

This is your application code root. When your app’s code services are build, your git repo is cloned directly into /data. The filepaths below are the exactly the same relative to the root of your repo:

Relative Path:
images/my-image.png

Absolute Path:
/data/images/my-image.png

When SSH’ing into a service, you are dropped directly into /data in one of your service’s instances. From here, you can access any of your app’s code.

/var/www is Symlinked to /data

For backwards compatibility, /var/www is symlinked to /data. Any apps previously deployed on Pagoda Box that depend on absolute paths do not need to be updated.

/tmp

The /tmp directory is a writable directory available on all code services. It is part of the local filesystem, so anything stored there can be quickly accessed without any latency. It’s incredibly useful for things like static asset caching or temporary file storage.

Note that /tmp is not a network directory and therefore is not shared between instances. Every instances’ /tmp directory is unique. Also know that any time you deploy your app or repair your service, /tmp gets flushed when old instances are decommissioned.

If you have any questions, suggestions, or corrections, let us know.