Skip to content

DDEV and Ibexa Cloud

Two ways are available to run an Ibexa Cloud project locally with DDEV:

Note

The following examples use Ibexa Cloud CLI (ibexa_cloud).

With the ddev-platformsh add-on

To configure the ddev/ddev-platformsh add-on, you need a Platform.sh API Token.

The ddev/ddev-platformsh add-on configures the document root, the PHP version, the database, and the cache pool according to the Ibexa Cloud configuration. About the search engine, the add-on can configure Elasticsearch but can't configure Solr. If you use Solr on Ibexa Cloud and want to add it to your DDEV stack, see Clustering with DDEV and ibexa/ddev-solr add-on.

COMPOSER_AUTH from Platform.sh can't be used, because JSON commas are incorrectly interpreted by --web-environment-add, which sees them as multiple variable separators. But the variable must exist for Platform.sh hooks scripts to work. To use an auth.json file for this purpose, see Using auth.json.

You must remove Node.js and NVM installations as they're already included in DDEV.

The following sequence of commands:

  1. Downloads the Ibexa Cloud Platform.sh project from the default environment "production" into a new directory, based on the Platform.sh CLI alias ibexa_cloud defined in introduction. (Replace <project-ID> with the hash of your own project. See ibexa_cloud help get for options like selecting another environment).
  2. Configures a new DDEV project.
  3. Ignores .ddev/ directory from Git. (Some DDEV config could be committed like in this documentation.)
  4. Sets Composer authentication by using an already existing auth.json file.
  5. Creates a public/var directory if it doesn't exist, to allow the creation of public/var/.platform.installed by Platform.sh hook script.
  6. Installs the ddev/ddev-platformsh add-on which prompts for the Platform.sh API token, project ID and environment name.
  7. Comments out the Node.js and NVM installations from the hooks copied in .ddev/config.platformsh.yaml. (In this file, you may have to discard other specific features like New Relic.)
  8. Changes maxmemory-policy from default allkeys-lfu to a value accepted by the RedisTagAwareAdapter.
  9. Starts the project.
  10. Gets the content from Platform.sh, both database and binary files by using ddev pull platform feature from the add-on.
  11. Restarts the project.
  12. Displays information about the project services.
  13. Opens the project in a browser.
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
ibexa_cloud project:get <project-ID> my-ddev-project && cd my-ddev-project
ddev config --project-type=php --web-environment-add COMPOSER_AUTH=''
echo '.ddev/' >> .gitignore
mkdir -p .ddev/homeadditions/.composer && cp <path-to-an>/auth.json .ddev/homeadditions/.composer
if [ ! -d public/var ]; then mkdir public/var; fi
ddev get ddev/ddev-platformsh
sed -i -E "s/( +)(.*nvm (install|use).*)/\1#\2/" .ddev/config.platformsh.yaml
sed -i 's/maxmemory-policy allkeys-lfu/maxmemory-policy volatile-lfu/' .ddev/redis/redis.conf
ddev start
ddev pull platform -y
ddev restart
ddev describe
ddev launch

Note

The Platform.sh API token is set at user profile level, therefore it's stored globally under current user root as PLATFORMSH_CLI_TOKEN in ~/.ddev/global_config.yaml.

Without the Platform.sh add-on

The following example adapts the manual method to run an already existing project to the Platform.sh case:

The following sequence of commands:

  1. Downloads the Ibexa Cloud Platform.sh project from the default environment "production" into a new directory, based on the Platform.sh CLI alias ibexa_cloud defined in introduction. (Replace <project-ID> with the hash of your own project. See ibexa_cloud help get for options like selecting another environment).
  2. Configures a new DDEV project.
  3. Ignores .ddev/ directory from Git. (Some DDEV config could be committed like in this documentation.)
  4. Starts the DDEV project.
  5. Sets Composer authentication.
  6. Gets the database content from Platform.sh.
  7. Imports this database content into DDEV project's database.
  8. Downloads the Platform.sh public/var locally to have the content binary files.
  9. Install the dependencies and run post-install scripts.
  10. Displays information about the project services.
  11. Opens the DDEV project in a browser.
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
ibexa_cloud project:get <project-ID> my-ddev-project && cd my-ddev-project
ddev config --project-type=php --php-version 8.1 --docroot=public --web-environment-add DATABASE_URL=mysql://db:db@db:3306/db
echo '.ddev/' >> .gitignore
ddev start
ddev composer config --global http-basic.updates.ibexa.co <installation-key> <token-password>
ibexa_cloud db:dump --gzip --file=production.sql.gz
ddev import-db --src=production.sql.gz && rm production.sql.gz
ibexa_cloud mount:download --mount public/var --target public/var
ddev composer install
ddev describe
ddev launch

From there, services can be added to get closer to Ibexa Cloud Platform.sh architecture. .platform/services.yaml indicates the services used. For more information, see Clustering with DDEV.