Homestead: Elasticsearch default configuration or documentation could be improved

Created on 11 Oct 2018  路  3Comments  路  Source: laravel/homestead

Versions & Host operating system

Service | Version
-|-
Vagrant | 2.1.2
Virtualbox | 5.2.18 r124319 (Qt5.6.3)
Laravel Homestead | 7.18.0
MacBook OSx | High Sierra 10.13.6 (17G65)

For information clarity, homestead is installed locally to the project not globally to my machine.

Homestead.yaml

ip: 192.168.10.10

memory: 4096
cpus: 4
provider: virtualbox
authorize: ~/.ssh/id_rsa.pub

elasticsearch: 6

keys:
  - ~/.ssh/id_rsa

folders:
  - map: ~/Sites/Paquette/paquette
    to: /home/vagrant/code/Paquette/paquette
  - map: ~/Code/Paquette/amethyst
    to: /home/vagrant/code/packages/amethyst

sites:
  - map: app.paquette.test
    to: /home/vagrant/code/Paquette/paquette/public

databases:
  - paquette

name: paquette
hostname: paquette

Vagrant destroy & up output

Link: https://gist.github.com/AustinPaquette/28e25a2b712143319daa43e92423cd9f

Expected behavior

I would naturally expect that I can connect to the elasticsearch installation via the default port 9200


Actual behavior

Port 9200 is not forwarded resulting in a chrome error:

Chrome:

Steps to reproduce

  1. vagrant up on any project with homestead pulling in elasticsearch
  2. try to access localhost:9200

Workaround

This gem of a solution was posted on Laracasts, and works like a charm. It's just an update to the /etc/elasticsearch/elasticsearch.yml configuration file that I feel should either be at least escalated to the documentation, or at best provided as a configuration parameter.

Additionally it's required to add this to homestead.yaml

ports:
  - send: 9200
    to: 9200

With those changes made and running

sudo /etc/init.d/elasticsearch restart
vagrant reload --provision

accessing localhost:9200 works with the expected output and port 9200 forwarded.


I don't think this is necessarily an issue that would have to be addressed by Homestead, but a documentation improvement could certainly be made to remove such a high barrier of entry to using HTTP Clients for testing or just simply accessing the localhost URL.

I firmly believe all of these customizations could remain in userland but there's no helpful information available on the usual spots -- with exception to the actual solution on laracasts, which loses a bit of credibility simply because it's _two years old_ and technology changes a fair amount these days.

Code

The code repo at the exact commit I'm writing this can be found here if you care to run some tests
https://github.com/paquette/paquette/tree/effed8c571baf3ad0c863d31bb328bbcead43652

Most helpful comment

That totally makes sense @svpernova09, just wanted to make sure it wasn't an oversight. Made a note to come back and see what I can do to add to the docs when some extra time pops up.

Cheers, and thanks for the speedy response.

All 3 comments

From Homestead's perspective this is working as intended. We don't enable ports for options that are installed post vagrant up. It might be nice to add ports based on configuration values but currently not a feature that exists.

I would welcome a docs PR that would address this / make it clearer.

Thanks for taking the time to write this up and submit it.

That totally makes sense @svpernova09, just wanted to make sure it wasn't an oversight. Made a note to come back and see what I can do to add to the docs when some extra time pops up.

Cheers, and thanks for the speedy response.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

leandroruel picture leandroruel  路  4Comments

cschoeni picture cschoeni  路  4Comments

teleclimber picture teleclimber  路  3Comments

Modelizer picture Modelizer  路  5Comments

svpernova09 picture svpernova09  路  3Comments