zepgram / magento2-fast-vm

Optimal vagrant developer box for Magento2. Folders synced by nfs/rsync. This box includes Magento developer utilities.
MIT License
110 stars 35 forks source link

Elasticsearch error vagrant up #85

Closed jeroencusters closed 3 years ago

jeroencusters commented 3 years ago

Hi, I would like to try your pre-configured VM. Versions:

Errors: zepgram: [Progress: 655 / 1314] zepgram: Installing search configuration... zepgram: In SearchConfig.php line 81: zepgram: zepgram: Could not validate a connection to Elasticsearch. No alive nodes found in your cluster ... zepgram: Updating modules: zepgram: Could not validate a connection to Elasticsearch. No alive nodes found in your cluster The SSH command responded with a non-zero exit status. Vagrant assumes that this means the command failed. The output for this command should be in the log above. Please read the output to determine what went wrong.

I tried mount: nfs, rsync and default and path: root and app and I didn't open explorer during installation. Everytime the same error.

How can I finish the setup manually and check/reactivate Elasticsearch later?

Thanks for your help!

zepgram commented 3 years ago

Hi @jeroencusters are you installing magento from composer or from a git repository ? Can you try to add this in provision/110-magento-app.sh : image

jeroencusters commented 3 years ago

@zepgram I followed the instructions of the readme.md (git clone + vagrant up). Adding this line unfortunately doesn't help. Same error.

zepgram commented 3 years ago

Ok can you share me your config.yml (without credentials) ?

jeroencusters commented 3 years ago

vmconf: machine_name: 'Vagrant Magento 2' network_ip: '192.168.200.50' host_name: 'zepgram' memory: '4096' cpus: '1' mount: 'default' path: 'app' provision: 'all' composer: username: '' password: '' git: name: '' email: '' host: 'bitbucket.org' repository: '' magento: url: 'dev.magento.com' source: 'composer' edition: 'community' version: '2.4.2' php_version: 'default' sample: 'true' mode: 'developer' currency: 'EUR' language: 'en_US' time_zone: 'Europe/Amsterdam' crypt_key: ''

zepgram commented 3 years ago

Are you trying to install from a git repository ? I see "bitbucket.org" in host config, if you are you must set the value "git" to source field.

zepgram commented 3 years ago

An other question, between each change in configuration did you run vagrant destroy ?

jeroencusters commented 3 years ago

@zepgram No, I used git clone with composer installation. I added git details because I thought this would set some defaults for git project. Source is composer. I did vagrant destroy and removed www/magento folder after configuration change. I just changed elasticsearch_host to "127.0.0.1" (double quotes, maybe this helps) and started vagrant up again.

Could it be a memory issue? My laptop has 8 GB RAM. I use 4 GB for the VM.

zepgram commented 3 years ago

Nop, this is only related to elasticsearch service, which is mandatory for Magento installation since 2.4.0 This is working on my vagrant, maybe the installation of the service didn't work for you.

Can you try to printout the entire vagrant up with this command: vagrant up --debug &> vagrant.log

And send me the vagrant.log

jeroencusters commented 3 years ago

How can I send you the log? I saw the following error: DEBUG ssh: stderr: Job for elasticsearch.service failed because a timeout was exceeded. See "systemctl status elasticsearch.service" and "journalctl -xe" for details.

Maybe this link can help: https://stackoverflow.com/questions/58656747/elasticsearch-job-for-elasticsearch-service-failed

zepgram commented 3 years ago

Can you try this ?

You can add it here: https://github.com/zepgram/magento2-fast-vm/blob/master/provision/020-system-services.sh#L219

sudo mkdir /etc/systemd/system/elasticsearch.service.d
echo -e "[Service]\nTimeoutStartSec=180" | sudo tee /etc/systemd/system/elasticsearch.service.d/startup-timeout.conf
jeroencusters commented 3 years ago

Thanks!

The first line is duplicate (see https://github.com/zepgram/magento2-fast-vm/blob/master/provision/020-system-services.sh#L214).

The second line solved this issue. Installation is finished, but the sample data is missing.

Error: zepgram: /tmp/vagrant-shell: line 84: 19291 Killed sudo -u vagrant php -d memory_limit=-1 "$PROJECT_PATH"/bin/magento sampledata:deploy

I had a similar error on Digitalocean testserver. When I added 2 GB swapfile I could deploy sampledata.

Admin login is not possible: You need to configure Two-Factor Authorization in order to proceed to your store's admin area An E-mail was sent to you with further instructions

jeroencusters commented 3 years ago

Disabling Two-Factor Auth module solved the last issue: bin/magento module:disable Magento_TwoFactorAuth

zepgram commented 3 years ago

Nice. You don't have to disable this module, you can access TFA email from mailcatcher here: 192.168.200.50:1080 Then you have to download google auth app in order to login.

jeroencusters commented 3 years ago

@zepgram thanks for all your help! I disabled Magento_TwoFactorAuth since it's not needed in Dev environtment. Sample is added after installation with the following command: php -dmemory_limit=3G bin/magento sampledata:deploy

I will close this issue.