astorm/magento2-travis

Elasticsearch - no alive cluster found in your application during build

aashan10 opened this issue · 6 comments

The command "php bin/magento setup:install --admin-email "$PULSESTORM_MAGE2_ADMIN_EMAIL" --admin-firstname "$PULSESTORM_MAGE2_ADMIN_FIRST_NAME" --admin-lastname "$PULSESTORM_MAGE2_ADMIN_LAST_NAME" --admin-password "$PULSESTORM_MAGE2_ADMIN_PASSWORD" --admin-user "$PULSESTORM_MAGE2_ADMIN_USERNAME" --backend-frontname admin --base-url "$PULSESTORM_MAGE2_FAKE_URL" --db-host 127.0.0.1 --db-name magento_2_travis --db-user root --session-save files --use-rewrites 1 --use-secure 0 -vvv" failed and exited with 1 during .

This is the error message I got while trying to build the application.

Screenshot_2020-10-15_22-09-35
Screenshot_2020-10-15_22-10-04

[Magento\Framework\Validation\ValidationException] Could not validate a connection to Elasticsearch. No alive nodes found in y our cluster

This was the actual error message.

The .travis.yml file after modification is:

env:
    #global environmental variables control magento install parameters
    #see also hosts in addons.
    global:
        - PULSESTORM_MAGE2_FAKE_URL=http://magento-2-link-guest-order.dev
        - PULSESTORM_MAGE2_ADMIN_EMAIL=ashanghimire10@gmail.com
        - PULSESTORM_MAGE2_ADMIN_FIRST_NAME=Aashan
        - PULSESTORM_MAGE2_ADMIN_LAST_NAME=Ghimire
        - PULSESTORM_MAGE2_ADMIN_USERNAME=admin
        - PULSESTORM_MAGE2_ADMIN_PASSWORD=test_pass@123
        - PULSESTORM_MAGE2_ADMIN_DBNAME=magento_2_link_guest_orders
        - PULSESTORM_PESTLE_URL=http://pestle.pulsestorm.net
        - PULSESTORM_COMPOSER_REPOSITORY_TO_TEST=https://github.com/aashan10/magento2-link-guest-order.git
        - PULSESTORM_COMPOSER_PACKAGE_TO_TEST=aashan/module-link-guest-orders
addons:
    hosts:
        # should match PULSESTORM_MAGE2_FAKE_URL above
        - magento-2-link-guest-order.dev
language: php
sudo: required
dist: trusty
php:
    - 7.3
before_script:
    # some useful debugging stuff for travis
    #- curl http://magento-2-link-guest-order.dev/index.php
    #- curl http://magento-2-link-guest-order.dev/
    #- sudo find /var/log/apache2 -exec cat '{}' \;
    #- sudo cat /etc/apache2/sites-available/000-default.conf
    #- sudo cat /etc/apache2/sites-enabled/000-default.conf
    #- sudo apachectl -V
    #- sudo apache2ctl -V
    #- ls -lh $TRAVIS_BUILD_DIR
    #- sudo ls /etc/apache2/sites-available
    #- sudo ls /etc/apache2/sites-enabled
    #- pwd
    #
    # get latest composer
    - composer selfupdate
    # disable xdebug for perf
    - echo '' > ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/xdebug.ini
    # add multiverse support to get MySQL 5.6 update apt
    - sudo add-apt-repository "deb http://archive.ubuntu.com/ubuntu/ trusty multiverse" && sudo add-apt-repository "deb http://archive.ubuntu.com/ubuntu/ trusty-updates multiverse"
    - sudo apt-get update -qq
    # add mysql 5.6
    - sudo apt-get remove -y -qq --purge mysql-common mysql-server-5.5 mysql-server-core-5.5 mysql-client-5.5 mysql-client-core-5.5
    - sudo apt-get -y -qq autoremove;
    - sudo apt-get -y -qq autoclean;
    - sudo apt-get install -y -qq mysql-server-5.6 mysql-client-5.6;
    - mysql -uroot -e 'SET @@global.sql_mode = NO_ENGINE_SUBSTITUTION; CREATE DATABASE magento_2_travis;';
    # add apache
    - sudo apt-get install -y -qq apache2 libapache2-mod-fastcgi
    #   enable php-fpm -- www.conf.default is PHP 7 only, so we dev/null any copy problems
    - sudo cp ~/.phpenv/versions/$(phpenv version-name)/etc/php-fpm.d/www.conf.default ~/.phpenv/versions/$(phpenv version-name)/etc/php-fpm.d/www.conf 2>/dev/null || true
    - sudo cp ~/.phpenv/versions/$(phpenv version-name)/etc/php-fpm.conf.default ~/.phpenv/versions/$(phpenv version-name)/etc/php-fpm.conf
    - sudo a2enmod rewrite actions fastcgi alias
    - echo "cgi.fix_pathinfo = 1" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini
    - ~/.phpenv/versions/$(phpenv version-name)/sbin/php-fpm
    #   awful hack used during travis debugging that I swear I'm going to remove
    #   but then again you're reading this so I didn't remove it and **sigh**
    - sudo chmod 777 /home /home/travis /home/travis/build

    #   configure apache virtual hosts, assumes 000-default.conf is there
    - sudo cp -f .travis/travis-ci-apache /etc/apache2/sites-available/000-default.conf
    - sudo sed -e "s?%TRAVIS_BUILD_DIR%?$(pwd)?g" --in-place /etc/apache2/sites-available/000-default.conf
    # restart apache
    - sudo service apache2 restart

    # clone main magento github repository
    - git clone https://github.com/magento/magento2
    # download latest pestle phar and install
    - curl -LO "$PULSESTORM_PESTLE_URL/pestle.phar"
    - sudo mv pestle.phar /usr/local/bin
    - sudo chmod +x /usr/local/bin/pestle.phar
    # install Magento
    - cd magento2
    - composer install --prefer-dist
    # switch to specific branch in you like
    #- git checkout 2.0;git checkout tags/2.0.2

    # Use a github token
    - if [ -n "$GH_TOKEN" ]; then composer config github-oauth.github.com ${GH_TOKEN}; fi;

    # add composer package under test, composer require will trigger update/install

    - composer config repositories.travis_to_test git $PULSESTORM_COMPOSER_REPOSITORY_TO_TEST
    - composer require --prefer-dist $PULSESTORM_COMPOSER_PACKAGE_TO_TEST dev-master

    # run installation command using evn variables set above
    - php bin/magento setup:install --admin-email "$PULSESTORM_MAGE2_ADMIN_EMAIL" --admin-firstname "$PULSESTORM_MAGE2_ADMIN_FIRST_NAME" --admin-lastname "$PULSESTORM_MAGE2_ADMIN_LAST_NAME" --admin-password "$PULSESTORM_MAGE2_ADMIN_PASSWORD" --admin-user "$PULSESTORM_MAGE2_ADMIN_USERNAME" --backend-frontname admin --base-url "$PULSESTORM_MAGE2_FAKE_URL" --db-host 127.0.0.1 --db-name magento_2_travis --db-user root --session-save files --use-rewrites 1 --use-secure 0 -vvv
    # test that magento is installed
    - curl "$PULSESTORM_MAGE2_FAKE_URL/index.php" > /tmp/output.txt
    # test that pestle is working
    - pestle.phar hello_world
script: test 'grep -Fx "magento-2-link-guest-order.dev" /tmp/output.txt'

Edited because I accidentally posted the fixed .travis.yml

@aashan10 Nice to meet you. Did you see this error in Travis? Or locally? With that version of Magento?

Hello @astorm, huge fan.
I used these configs to setup build in travis. I did not change anything in .travis.yml except for the github link and package name. So everything is default.

@aashan10 It sounds like whatever version of Magento you're using this with

a. Expects there to be a running elasticsearch instance
b. Expects the system to be configured to connect to it

I'll point my twitter followers at this. If Magento does require an elastic search instance now I'm happy to accept PRs to get this old project working with that. I probably won't have time to do this myself.

@astorm I have fixed it for my build. Will send the PR mentioning this issue.

Found this issue which has been resolved like a year ago but is still active. Closing this one!