> ## Documentation Index
> Fetch the complete documentation index at: https://engineering.trewknowledge.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Running ElasticPress Locally

<Warning>This process is only required for non-WordPress VIP projects.</Warning>

You will need to ensure you have the [ElasticPress plugin](https://wordpress.org/plugins/elasticpress/) installed and activated on your local instance of WordPress to utilize the local EP server.

## Docker:

Download, install [Docker Desktop](https://www.docker.com/products/docker-desktop/), and run the application.

## Server:

1. Create an ElasticPress directory on your main hard drive account (i.e. `/Users/username/Sites/ep-server`).
2. Create the following files with corresponding code:
   a. `docker-compose.yml`
   ```
   version: '2.2'
   services:
   	elasticsearch:
   		build:
   			dockerfile: Dockerfile
   			context: .
   			args:
   				ES_VERSION: ${ES_VERSION-7.10.2}
   		ports:
   			- 8890:9200
   		mem_limit: 1024M
   		mem_reservation: 1024M
   		volumes:
   			- './elasticsearch.yml:/usr/share/elasticsearch/config/elasticsearch.yml:cached'
   		environment:
   			ES_JAVA_OPTS: '-Xms450m -Xmx450m'
   ```
   b. `Dockerfile`
   ```
   ARG ES_VERSION=7.10.2
   FROM docker.elastic.co/elasticsearch/elasticsearch:${ES_VERSION}
   RUN if [ -d plugins/ingest-attachment ]; then true ; else ./bin/elasticsearch-plugin install ingest-attachment -b; fi
   ```
   c. `elasticsearch.yml`
   ```
   xpack.security.enabled: false
   http.host: 0.0.0.0
   http.cors.enabled : true
   http.cors.allow-origin : "*"
   http.cors.allow-methods : OPTIONS, HEAD, GET, POST, PUT, DELETE
   http.cors.allow-headers : X-Requested-With,X-Auth-Token,x-elasticpress-request-id,Content-Type,Content-Length
   ```
3. Open the terminal and run `docker-compose up` in your newly created ep-server directory.
4. Visit `http://localhost:8890` in your browser of choice to confirm the server is running.
5. Update your ElasticPress plugin settings to point to the newly created server URL and run a sync to index your local site content.

<img className="block rounded-lg" src="https://mintcdn.com/trewknowledge/ZrdmaaZIhn2ANZeE/images/elasticpress-guide-1.png?fit=max&auto=format&n=ZrdmaaZIhn2ANZeE&q=85&s=a529d0d872c4138cdc34f5d3a83c76f2" alt="ElasticPress Local Server" width="1044" height="892" data-path="images/elasticpress-guide-1.png" />

<img className="block rounded-lg" src="https://mintcdn.com/trewknowledge/ZrdmaaZIhn2ANZeE/images/elasticpress-guide-2.png?fit=max&auto=format&n=ZrdmaaZIhn2ANZeE&q=85&s=d09d07faae0951637ee53ac0bf67eb62" alt="ElasticePress Sync" width="888" height="724" data-path="images/elasticpress-guide-2.png" />

## Debugging:

You can install the following plugins to help with debugging ElasticPress

* [Debug Bar](https://wordpress.org/plugins/debug-bar/)
* [ElasticPress Debugging Add-On](https://wordpress.org/plugins/elasticpress-debugging-add-on/)
