Platform.sh User Documentation

Migrating to Platform.sh

Upsun Beta

Access our newest offering - Upsun!

Get your free trial by clicking the link below.

Get your Upsun free trial

If you already have an app running somewhere else, you want to migrate it to Platform.sh and deploy it. To do so, follow these steps.

Before you begin Anchor to this heading

You need:

  • An app that works and is ready to be built
  • Code in Git
  • A Platform.sh account – if you don’t already have one, start a trial
  • The Platform.sh CLI installed locally

1. Export from previous system Anchor to this heading

Start by exporting everything you might need from your current app. This includes data in databases, files on a file system, and for some apps, such as Drupal, configuration that you need to export from the system into files.

2. Create a project Anchor to this heading

Run the following command:

platform project:create

When prompted, fill in details like the project name, region, and plan.

Create a new project from scratch.

In the form, fill in details like the project name and region. The project is automatically created with a Development plan, which you can then upgrade.

3. Add configuration Anchor to this heading

The exact configuration you want depends on your app. You likely want to configure three areas:

You can also take guidance from the project templates, which are starting points for various technology stacks with working configuration examples.

When you’ve added your configuration, make sure to commit it to Git.

4. Push your code Anchor to this heading

The way to push your code to Platform.sh depends on whether you’re hosting your code with a third-party service using a source integration. If you aren’t, your repository is hosted in Platform.sh and you can use the CLI or just Git itself.

  1. Get your project ID by running the following command:

    platform projects
  2. Add Platform.sh as a remote repository by running the following command:

    platform project:set-remote PROJECT_ID
  3. Push to the Platform.sh repository by running the following command:

    platform push

When you try to push, any detected errors in your configuration are reported and block the push. After any errors are fixed, a push creates a new environment.

Set up the integration for your selected service:

Then push code to that service as you do normally. Pushing to a branch creates an environment from that branch.

Note that the source integration doesn’t report any errors in configuration directly. You have to monitor those in your project activities.

  1. Add an SSH key.
  2. In the Console, open your project and click Code .
  3. Click Git.
  4. From the displayed command, copy the location of your repository. It should have a format similar to the following:
abcdefgh1234567@git.eu.platform.sh:abcdefgh1234567.git
  1. Add Platform.sh as a remote repository by running the following command:
git remote add platform REPOSITORY_LOCATION
  1. Push to the Platform.sh repository by running the following command:
git push -u platform DEFAULT_BRANCH_NAME

When you try to push, any detected errors in your configuration are reported and block the push. After any errors are fixed, a push creates a new environment.

5. Import data Anchor to this heading

Once you have an environment, you can import the data you backed up in step 1. The exact process may depend on the service you use.

For SQL databases, for example, you can use a version of this command:

platform sql < BACKUP_FILE_NAME

For any potential more details, see the specific service.

6. Import files Anchor to this heading

Your app may include content files, meaning files that aren’t intended to be part of your codebase so aren’t in Git. You can upload such files to mounts you created. Upload to each mount separately.

Suppose for instance you have the following file mounts defined:

.platform.app.yaml
mounts:
    'web/uploads':
        source: local
        source_path: uploads
    'private':
        source: local
        source_path: private

Upload to each of directories above by running the following commands:

platform mount:upload --mount web/uploads --source ./uploads
platform mount:upload --mount private --source ./private

You can adjust these commands for your own case. Or upload to your mounts using a different SSH method.

Optional: Add variables Anchor to this heading

If your app requires environment variables to build properly, add them to your environment.

What’s next Anchor to this heading

Now that your app is ready to be deployed, you can do more:

  • Upgrade from a Development plan.

Is this page helpful?