Install with DDEV¶
This guide provides a step-by-step walkthrough of installing Ibexa DXP by using DDEV. DDEV is an open-source tool that simplifies the process of setting up local PHP development environments.
Requirements¶
Before you start the installation, ensure that you have the following software installed:
Installation¶
1. Create a DDEV project directory¶
Start by creating a new directory for your DDEV project by using the following command, where <my-ddev-project>
stands for your desired directory name:
1 |
|
2. Configure DDEV¶
Configure PHP version and document root¶
Next, configure your DDEV environment with the following command:
1 |
|
This command sets the project type to PHP, the PHP version to 8.3, the document root to public
directory, and creates the document root if it doesn't exist.
Use another database type (optional)¶
By default, DDEV uses MariaDB.
To use PostgreSQL instead, run the following command:
1 |
|
To use MySQL instead, run the following command:
1 |
|
You can also use other versions of MariaDB, Mysql or PostgreSQL. See DDEV database types documentation for available version ranges.
Configure database connection¶
Now, configure the database connection for your Ibexa DXP project. Depending on your database of choice (MySQL or PostgreSQL), use the appropriate command below.
Note
Those commands set a DATABASE_URL
environment variable inside the container which overrides the variable from .env
.
To use .env.local
file instead of server-level environment variables, see Using dotenv.
1 |
|
To ensure consistent character set when performing operations both in Symfony context and with the ddev mysql
client add the following database server configuration.
Create the file .ddev/mysql/utf8mb4.cnf
with the following content:
1 2 3 |
|
1 |
|
Enable Mutagen (optional)¶
If you're using macOS or Windows, you might want to enable Mutagen to improve performance. You can do this by running the following command:
1 |
|
See DDEV performance documentation for more.
Change port mapping (optional)¶
By default, DDEV uses ports 80 and 443. You can set different ports with a command like the following:
1 |
|
3. Start DDEV¶
Proceed by starting your DDEV environment with the following command:
1 |
|
Tip
If you forgot some part of configuration, you can set it by using ddev config
later, but afterwards you have to restart DDEV with ddev restart
.
4. Composer authentication¶
Next, you need to set up authentication tokens by modifying the Composer configuration.
You must run the following command after executing ddev start
, because the command runs inside the container.
Replace <installation-key>
and <token-password>
with your actual installation key and token password.
1 |
|
This authentication doesn't persist if the project is restarted (by ddev restart
or ddev composer create
).
You can back up the authentication file (auth.json
) by using the following command:
1 |
|
If you want to reuse an existing auth.json
file, see Using auth.json
.
5. Create project¶
Once DDEV is running, use Composer to create a new Ibexa DXP project.
Remember to replace <edition>
and <version>
with your desired edition and version.
1 |
|
Tip
Consider adding the Symfony Debug bundle which fixes memory outage when dumping objects with circular references.
ddev composer require --dev symfony/debug-bundle
6. Install the platform and its database¶
Once you've made this change, you can proceed to install Ibexa DXP.
1 2 |
|
7. Open browser¶
Once the above steps are completed, open the Ibexa DXP's webpage by running the ddev launch
command.
Tip
You can also see the project URL in the ddev start
output.
8. Start using Ibexa DXP¶
You can now start using Ibexa DXP and implement your own website on the platform.
You can edit the configuration and code in the DDEV project directory.
You can use commands listed in the documentation by prefixing them with ddev exec
or by opening a terminal inside the container by using ddev ssh
.
For example, if a guideline invites you to run php bin/console cache:clear
, you can do it in the DDEV container in one of the following ways:
- run
ddev php bin/console cache:clear
- enter
ddev ssh
and runphp bin/console cache:clear
after the new prompt
Other options for configuration¶
DDEV offers several ways to get the same result, offering different levels of flexibility or adaptability to your development environment.
Tip
Learn more about the DDEV commands:
- run
ddev --help
to list all commands - run
ddev help <command>
to get usage details about a specific command
Learn more about DDEV configuration from ddev config
command documentation and advanced configuration files documentation.
Using auth.json
¶
An auth.json
file can be used for one project, or globally for all projects, with the DDEV homeaddition
feature.
For example, you can copy an auth.json
file to a DDEV project: cp <path-to-an>/auth.json .ddev/homeadditions/.composer
Alternatively, the Composer global auth.json
can be the DDEV global auth.json
with the help of a symbolic link: mkdir -p ~/.ddev/homeadditions/.composer && ln -s ~/.composer/auth.json ~/.ddev/homeadditions/.composer/auth.json
If the DDEV project has already been started, you need to run ddev restart
.
The use of an auth.json
file replaces step 4. Composer authentication.
Using Dotenv¶
Instead of using environment variables inside the container, a .env.local
file can be added to the project.
The following example shows the use of .env.local
with database configuration:
- Skip step 2. Configure DDEV / Configure database connection.
- Modify step 5. Create Ibexa DXP project to insert the database setting:
1 2 3
ddev composer create ibexa/commerce-skeleton --no-install; echo "DATABASE_URL=mysql://db:db@db:3306/db" >> .env.local; ddev composer install;
Precedence
For the same variable, its server level environment value overrides its application level .env
value.
To switch a variable from ddev config --web-environment-add
command to .env.local
file, you have to do either of the following:
- remove it from under the
web_environment:
key in.ddev/config.yaml
file then restart the project - rebuild the project from scratch
Nginx Server Blocks¶
Even if Ibexa DXP works with the default Nginx configuration that comes with DDEV, it's recommended to use a dedicated one.
Copy the Server Blocks template as a new Nginx configuration:
1 2 |
|
Then, replace the placeholders with the appropriate values in .ddev/nginx_full/ibexa.conf
:
Placeholder | Value |
---|---|
%PORT% |
80 |
%HOST_LIST% |
*.ddev.site |
%BASEDIR% |
/var/www/html |
%BODY_SIZE_LIMIT_M% |
0 |
%TIMEOUT_S% |
90s |
%FASTCGI_PASS% |
unix:/var/run/php-fpm.sock |
%BINARY_DATA_HANDLER% |
empty string |
Because of path resolution inside DDEV's Nginx, you must replace one more thing: ibexa_params.d
with sites-enabled/ibexa_params.d
.
You can, for example, do it with sed
:
1 2 3 4 5 6 7 8 |
|
If you want to use HTTPS, you must add the following rule to avoid mixed content (HTTPS pages linking to HTTP resources): fastcgi_param HTTPS $fcgi_https;
For example, you can append it to Ibexa's FastCGI config:
1 |
|
Switch to Apache and its virtual host¶
To use Apache instead of the default Nginx, run the following command:
1 |
|
Ibexa DXP can't run on Apache without a dedicated virtual host.
To set the Apache virtual host, override .ddev/apache/apache-site.conf
with Ibexa DXP's config.
You can do it manually or by using a script.
Manual procedure¶
Copy the virtual host template as the new Apache configuration:
1 |
|
Then, replace the placeholders with the appropriate values in .ddev/apache/apache-site.conf
:
Placeholder | Value |
---|---|
%IP_ADDRESS% |
* |
%PORT% |
80 |
%HOST_NAME% |
my-ddev-project.ddev.site |
%HOST_ALIAS% |
*.ddev.site |
%BASEDIR% |
/var/www/html |
%BODY_SIZE_LIMIT% |
0 |
%TIMEOUT% |
0 |
%FASTCGI_PASS% |
unix:/var/run/php-fpm.sock |
You can, for example, do it with sed
:
1 2 3 4 5 6 |
|
If you want to use HTTPS, you must add the following rule to avoid mixed content (HTTPS pages linking to HTTP resources): SetEnvIf X-Forwarded-Proto "https" HTTPS=on
You can, for example, do it with sed
:
1 |
|
Finally, restart the project:
1 |
|
Scripted procedure¶
Generate the virtual host with vhost.sh
:
1 2 3 4 5 6 7 8 9 10 11 |
|
Then, restart the project:
1 |
|
Run an already existing project¶
To run an existing project, you need to:
- Configure the DDEV project.
- Start the DDEV project.
- Add Composer authentication.
- Install dependencies packages with Composer.
- Populate the contents, which could mean:
- getting a clean database with ddev
php bin/console ibexa:install
and adding some data with Ibexa data migration, or - injecting a dump with
ddev import-db
and copying related binary files intopublic/var
.
- getting a clean database with ddev
The following examples run an already version-controlled project and have the right content structure (but no content):
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
|
Notice that the example adds the whole .ddev/
directory to .gitignore
, but you can also version parts of it.
Some DDEV configs can be shared among developers. For example, a common .ddev/config.yaml
can be committed for everyone and locally extended or overridden.
Compared to running a clean install like described in Installation steps, you can proceed as follows:
- In 1. Create a DDEV project directory, you can use an existing directory that contains an Ibexa DXP project instead of creating an empty directory.
- In 5. Create Ibexa DXP project, use only
ddev composer install
instead ofddev composer create
. - Populate the database with Ibexa data migration or
ddev import-db
.
Hostnames and domains¶
If the local project needs to answer to real production domains (for example, to use the existing hostname to SiteAccess or hostname element to SiteAccess mappings), you can use additional hostnames.
Caution
As this feature modifies domain resolution, the real website may be unreachable until the hosts
file is manually cleaned.
Cluster or Ibexa Cloud¶
You can use DDEV to locally simulate a production cluster.
- See Clustering with DDEV to add Elasticsearch, Solr, Redis, or Memcached to your DDEV installation.
- See DDEV and Ibexa Cloud to locally run an Ibexa DXP project by using DDEV.
Stop or remove the project¶
If you need to stop the project to start it again later, use ddev stop
.
Then, use ddev start
to run the project in the same state.
If you want to fully remove the project:
- delete the DDEV elements without backup:
ddev delete --omit-snapshot && rm -rf ./ddev
- remove the project folder:
cd .. && rm -r my-ddev-project
If additional hostnames have been used, you must clean the hosts file.
To learn more about removing all projects at once or DDEV itself, see Uninstalling DDEV.