| description |
|---|
Use DDEV to run a cluster infrastructure locally. |
!!! caution
Don't use this procedure in production.
A staging environment for validation before production should exactly replicate the production environment.
This is meant for development environment only.
This guide follows Install with DDEV and helps to extend the previous installation to locally replicate a production cluster.
In contrast to a production cluster, this setup has only one front app server. But the data sharing needed by a cluster of several servers can still be emulated.
The ddev config --php-version option should set the same PHP version as the production servers.
!!! tip
- [`ddev describe`](https://ddev.readthedocs.io/en/latest/users/usage/commands/#describe) displays a cluster summary that include accesses from inside and outside DDEV services
- [`ddev ssh`](https://ddev.readthedocs.io/en/latest/users/usage/commands/#ssh) opens a terminal inside a service
- [`ddev exec`](https://ddev.readthedocs.io/en/latest/users/usage/commands/#exec) executes a command inside a service
Discover more commands in DDEV documentation.
To run an [[= product_name_cloud =]] project locally, you may refer to DDEV and Ibexa Cloud instead.
A search engine can be added to the cluster.
The following sequence of commands:
- Adds the Elasticsearch container
- Sets Elasticsearch as the search engine
- Restarts the DDEV cluster and clears application cache
- Injects the schema and reindexes the content
ddev add-on get ddev/ddev-elasticsearch
ddev config --web-environment-add SEARCH_ENGINE=elasticsearch
ddev config --web-environment-add ELASTICSEARCH_DSN=http://elasticsearch:9200
ddev restart
ddev console cache:clear
ddev console ibexa:elasticsearch:put-index-template
ddev console ibexa:reindexYou can now check whether Elasticsearch works.
For example, the ddev exec curl -s "http://elasticsearch:9200/_count" command checks whether the web server can access the elasticsearch server and displays the number of indexed documents.
For more information on topics such as memory management, see ddev/ddev-elasticsearch README.
See Elasticsearch REST API reference for more request options, like, for example:
_count, as seen above_cluster/health(don't mind the "yellow" status which is normal in the absence of replicas in the DDEV container)_search?size=0", which is another way to get document count
!!! tip
You can use [`jq`](https://jqlang.org/) to format and colorize Elasticsearch REST API outputs.
The following sequence of commands:
- Adds the Solr container
- Sets Solr as the search engine
- Start the DDEV cluster to creates core config by combining default files and those provided by [[= product_name =]]
- Restarts the DDEV cluster and clears application cache
- Reindexes the content
ddev add-on get ddev/ddev-solr
ddev config --web-environment-add SEARCH_ENGINE=solr
ddev config --web-environment-add SOLR_DSN=http://solr:8983/solr
ddev config --web-environment-add SOLR_CORE=collection1
ddev start
mkdir .ddev/solr/configsets/collection1
ddev exec -s solr cp -R /opt/solr/server/solr/configsets/_default/conf/* /mnt/ddev_config/solr/configsets/collection1/
cp -R vendor/ibexa/solr/src/lib/Resources/config/solr/* .ddev/solr/configsets/collection1/
ddev restart
ddev console cache:clear
ddev console ibexa:reindexYou can now check whether Solr works.
For example, the ddev exec curl -s http://solr:SolrRocks@solr:8983/api/cores/ command:
- checks whether the
webserver can access thesolrserver - checks whether
collection1exists and its status - displays
collection1'snumDocsthat shouldn't be zero if indexing worked correctly
You can access the Solr admin UI from the host by:
- running
ddev solr-admincommand - accessing port 8983 on the same
.ddev.sitesubdomain than the web server (you can useddev describeto get this URL)
Use the credentials username solr and password SolrRocks.
For more information on topics such as available versions of Solr, see ddev/ddev-solr README.
You can add a persistence cache pool and a session handler to the cluster.
In the following examples:
- the same service is used to store both persistence cache and sessions
- the session handler is set on Symfony side, not on PHP side
The following sequence of commands:
- Adds the Redis container.
- Set Redis as the cache pool.
- Sets Redis as the session handler.
- Changes
maxmemory-policyfrom defaultallkeys-lfuto a value accepted by theRedisTagAwareAdapter. - Restarts the DDEV cluster and clears application cache.
ddev add-on get ddev/ddev-redis
ddev config --web-environment-add CACHE_POOL=cache.redis
ddev config --web-environment-add CACHE_DSN=redis
ddev config --web-environment-add SESSION_HANDLER_ID='Ibexa\\Bundle\\Core\\Session\\Handler\\NativeSessionHandler'
ddev config --web-environment-add SESSION_SAVE_PATH=tcp://redis:6379
sed -i 's/maxmemory-policy allkeys-lfu/maxmemory-policy volatile-lfu/' .ddev/redis/redis.conf;
ddev restart
ddev console cache:clearYou can now check whether Redis works.
For example, the ddev redis-cli MONITOR command returns outputs, for example, "SETEX" "ezp:, "MGET" "ezp:, "SETEX" "PHPREDIS_SESSION:, or "GET" "PHPREDIS_SESSION:, while navigating into the website, in particular the back office.
See Redis commands for more details such as information about the MONITOR command used in the previous example.