Platform.sh aims to be a great host, but we never want to lock you in to our service. Your code and your data belong to you, and you should always be able to download your site’s data for local development, backup, or to “take your data elsewhere”.
Your application’s code is maintained in Git. Because Git is a distributed system it is trivial to download your entire code history with a simple
git clone or
platform get command.
Your application runs on a read-only file system, so it cannot be edited. That means there’s nothing to download from most of it that isn’t already in your Git repository.
The only files to download are from any writable file mounts you may have defined in your
.platform.app.yaml file. The easiest way to download those is using the
rsync tool. For instance, suppose you have a mounts section that defines one web-accessible directory and one non-web-accessible directory:
mounts: 'web/uploads': source: local source_path: uploads 'private': source: local source_path: private
The CLI provides a useful
mount command for accessing mount data.
Downloading a mount is then as simple as running the following:
rsync to download each directory, we can use the following commands. The
platform ssh --pipe command will return the SSH URL for the current environment as an inline string that
rsync can recognize. To use a non-default environment, use the
-e switch after
--pipe. Note that the trailing slash on the remote path means
rsync will copy just the files inside the specified directory, not the directory itself.
rsync -az `platform ssh --pipe`:/app/private/ ./private/ rsync -az `platform ssh --pipe`:/app/web/uploads ./uploads/
If you’re running
rsync on MacOS, you should add
--iconv=utf-8,utf-8-mac to your
for more details on how to adjust the download process.
The mechanism for downloading from each service (such as your database) varies. For services designed to hold non-persistent information (such as Redis or Solr) it’s generally not necessary to download data as it can be rebuilt from the primary data store.