ElasticGraph::Local
Provides support for developing and running ElasticGraph applications locally. These locally running ElasticGraph applications use 100% fake generated data so as not to require a publisher of real data to be implemented.
Dependency Diagram
Installation
elasticgraph-local
is added to a project automatically when you bootstrap a project using:
gem exec elasticgraph new path/to/project
Usage
Everything you need is provided by rake tasks. Run the following to see what they are:
bundle exec rake -T
At a high level, this provides tasks that help you to:
- Boot Elasticsearch/OpenSearch (+ their corresponding dashboards) locally using the
opensearch:*
/elasticsearch:*
tasks. - Generate and validate ElasticGraph schema artifacts using the
schema_artifacts:*
tasks. - Configure your locally running Elasticsearch/OpenSearch using the
clusters:configure:perform
task. - Index fake data into Elasticsearch/OpenSearch (either running locally or on AWS) using the
index_fake_data:*
tasks. - Boot the ElasticGraph GraphQL endpoint and GraphiQL in-browser UI using the
boot_graphiql
task.
If you just want to boot ElasticGraph locally without worrying about any of the details, run:
bundle exec rake boot_locally
That sequences each of the other tasks so that, with a single command, you can go from nothing to a locally running ElasticGraph instance with data that you can query from your browser.
Managing Elasticsearch/Opensearch
The opensearch:
/elasticsearch:
tasks will boot the desired Elasticsearch or OpenSearch version using docker
along with the corresponding dashboards (Kibana for Elasticsearch, OpenSearch Dashboards for OpenSearch). You can
use either the :boot
or :daemon
tasks:
- The
:boot
task will keep Elasticsearch/Opensearch in the foreground, allowing you to see the logs. - The
:daemon
task runs Elasticsearch/Opensearch as a background daemon task. Notably, it waits to return until Elasticsearch/Opensearch are ready to receive traffic.
If you use a :daemon
task, you can later use the corresponding :halt
task to stop the daemon.