DDEV provides integration with the Platform.sh Website Management Platform, which allows Platform.sh users to quickly download and provision a project from Platform.sh in a local DDEV-managed environment.
!!!tip
Consider using ddev get platformsh/ddev-platformsh
(platformsh/ddev-platformsh) for more complete Platform.sh integration.
DDEV’s Platform.sh integration pulls databases and files from an existing Platform.sh site/environment into your local system so you can develop locally.
You need to obtain and configure an API token first. This is only needed once.
- Login to the Platform.sh Dashboard and go to Account → API Tokens. Create an API token DDEV can use.
- Add the API token to the
web_environment
section in your global DDEV configuration at~/.ddev/global_config.yaml
:
web_environment:
- PLATFORMSH_CLI_TOKEN=abcdeyourtoken
-
Check out the site from Platform.sh and configure it with
ddev config
. You’ll want to useddev start
and make sure the basic functionality is working. -
Add
PLATFORM_PROJECT
andPLATFORM_ENVIRONMENT
variables to your project.-
Either in
.ddev/config.yaml
or a.ddev/config.*.yaml
file:web_environment: - PLATFORM_PROJECT=nf4amudfn23biyourproject - PLATFORM_ENVIRONMENT=main
-
Or with a command from your terminal:
ddev config --web-environment-add="PLATFORM_PROJECT=nf4amudfn23bi,PLATFORM_ENVIRONMENT=main"
-
-
Run
ddev restart
. -
Run
ddev pull platform
. After you agree to the prompt, the current upstream databases and files will be downloaded. -
Optionally use
ddev push platform
to push local files and database to Platform.sh. Theddev push
command can potentially damage your production site, so we don’t recommend using it.
If you have more than one database on your Platform.sh project, you'll need to choose which one you want to use
as the 'db' primary database on DDEV, and that one will be pulled to the database named db
.
Do this by setting PLATFORM_PRIMARY_RELATIONSHIP, for example,
ddev config --web-environment-add="PLATFORM_PRIMARY_RELATIONSHIP=main"
or run ddev pull platform
with the --environment
flag, for example,
ddev pull platform --environment="PLATFORM_PRIMARY_RELATIONSHIP=main"
ddev pull platform
will connect to Platform.sh to download database and files. To skip downloading and importing either file or database assets, use the--skip-files
and--skip-db
flags.- If you need to change the
platform.yaml
recipe, you can change it to suit your needs, but remember to remove the#ddev-generated
line from the top of the file.