Exporting data

As a Platform.sh user, your code and data belong to you. At any time, you can download your site’s data for local development, to back up your data, or to change provider.

Before you begin 

You need:

1. Download your app’s code 

Your app’s code is maintained through the Git version control system.

To download your entire app’s code history:

  1. List all your projects with:

    platform projects
  2. Retrieve the project you want to back up with:

    platform get PROJECT_ID
  1. In the Console, open your project and click Code .

  2. Click Git.

  3. To copy the command, click .

  4. To clone the repository, run a command similar to the following:

    git clone abcdefgh1234567@git.eu.platform.sh:abcdefgh1234567.git project-name

2. Download your files 

Some files might not be stored in Git, such as data your app writes in mounts.

To download your files:

  1. Get a list of all your mounts with:

    platform mount:list
  2. Download all of your files from a given mount with:

    platform mount:download --mount MOUNT_PATH --target ./LOCAL_FOLDER
You can transfer files through SSH using scp or rsync.

For more examples, see how to transfer files to and from a built app.

3. Download data from services 

The mechanism for downloading from each service (such as your database) varies.

For services designed to hold non-persistent data, such as Redis or Solr, it’s generally not necessary to download data as it can be rebuilt from the primary data store.

For services designed to hold persistent data, see each service’s page for instructions:

4. Get the environment variables 

Environment variables can contain critical information such as tokens or additional configuration options for your app.

Environment variables beginning with:

All other variables are part of $PLATFORM_VARIABLES.

To back up your environment variables:

  1. Get the variable’s values with:

    platform ssh --project PROJECT_ID --environment ENVIRONMENT -- 'echo $PLATFORM_VARIABLES | base64 -d | jq'

    Note that you can also get all the environment variable values with:

    platform ssh --project PROJECT_ID --environment ENVIRONMENT -- env
  2. Store the data on your local computer, for example in an encrypted text file for sensitive tokens.

  1. In the Console, open your project and click .
  2. Click Project Settings .
  3. Click Variables and access your variable’s values and settings.
  4. Store the data on your local computer, for example in an encrypted text file for sensitive tokens.

Note that in the Console, you can’t access the value of variables that have been created using the --sensitive true flag. Use the CLI instead to retrieve these values.

What’s next