Migrating to Platform.sh
On this page
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.
- 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
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.
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.
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.
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.
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:
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.
If your app requires environment variables to build properly, add them to your environment.
Now that your app is ready to be deployed, you can do more:
- Upgrade from a Development plan.
- For monitoring and profiling, integrate Blackfire.