Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fail early if required dependencies fail #18

Open
k1sul1 opened this issue Feb 19, 2018 · 0 comments
Open

Fail early if required dependencies fail #18

k1sul1 opened this issue Feb 19, 2018 · 0 comments

Comments

@k1sul1
Copy link
Contributor

k1sul1 commented Feb 19, 2018

If Composer is not installed properly locally, weird behaviour may ensue. Example:

vagrant up
==> default: config.yml was not found. Copying defaults from sample configs..
Bringing machine 'wordpress-box' up with 'virtualbox' provider...
==> wordpress-box: Importing base box 'seravo/wordpress'...
==> wordpress-box: Matching MAC address for NAT networking...
==> wordpress-box: Checking if box 'seravo/wordpress' is up to date...
==> wordpress-box: Setting the name of the VM: redacted_wp_wordpress-box_1519038602133_64247
==> wordpress-box: Clearing any previously set network interfaces...
==> wordpress-box: Preparing network interfaces based on configuration...
    wordpress-box: Adapter 1: nat
    wordpress-box: Adapter 2: hostonly
==> wordpress-box: Forwarding ports...
    wordpress-box: 22 (guest) => 2222 (host) (adapter 1)
==> wordpress-box: Running 'pre-boot' VM customizations...
==> wordpress-box: Booting VM...
==> wordpress-box: Waiting for machine to boot. This may take a few minutes...
    wordpress-box: SSH address: 127.0.0.1:2222
    wordpress-box: SSH username: vagrant
    wordpress-box: SSH auth method: private key
==> wordpress-box: Machine booted and ready!
==> wordpress-box: Checking for guest additions in VM...
    wordpress-box: The guest additions on this VM do not match the installed version of
    wordpress-box: VirtualBox! In most cases this is fine, but in rare cases it can
    wordpress-box: prevent things such as shared folders from working properly. If you see
    wordpress-box: shared folder errors, please make sure the guest additions within the
    wordpress-box: virtual machine match the version of VirtualBox you have installed on
    wordpress-box: your host and reload your VM.
    wordpress-box: 
    wordpress-box: Guest Additions Version: 4.3.36
    wordpress-box: VirtualBox Version: 5.2
==> wordpress-box: [vagrant-hostsupdater] Checking for host entries
==> wordpress-box: [vagrant-hostsupdater] Writing the following entries to (/etc/hosts)
==> wordpress-box: [vagrant-hostsupdater]   192.168.190.110  wordpress  # VAGRANT: b3a131e995f4e74dd323b1582bce1412 (wordpress-box) / 5f8314db-7724-4cdc-aaf5-c673d02a0ed6
==> wordpress-box: [vagrant-hostsupdater]   192.168.190.110  wordpress.local  # VAGRANT: b3a131e995f4e74dd323b1582bce1412 (wordpress-box) / 5f8314db-7724-4cdc-aaf5-c673d02a0ed6
==> wordpress-box: [vagrant-hostsupdater]   192.168.190.110  www.wordpress.local  # VAGRANT: b3a131e995f4e74dd323b1582bce1412 (wordpress-box) / 5f8314db-7724-4cdc-aaf5-c673d02a0ed6
==> wordpress-box: [vagrant-hostsupdater]   192.168.190.110  webgrind.wordpress.local  # VAGRANT: b3a131e995f4e74dd323b1582bce1412 (wordpress-box) / 5f8314db-7724-4cdc-aaf5-c673d02a0ed6
==> wordpress-box: [vagrant-hostsupdater]   192.168.190.110  adminer.wordpress.local  # VAGRANT: b3a131e995f4e74dd323b1582bce1412 (wordpress-box) / 5f8314db-7724-4cdc-aaf5-c673d02a0ed6
==> wordpress-box: [vagrant-hostsupdater]   192.168.190.110  mailcatcher.wordpress.local  # VAGRANT: b3a131e995f4e74dd323b1582bce1412 (wordpress-box) / 5f8314db-7724-4cdc-aaf5-c673d02a0ed6
==> wordpress-box: [vagrant-hostsupdater]   192.168.190.110  browsersync.wordpress.local  # VAGRANT: b3a131e995f4e74dd323b1582bce1412 (wordpress-box) / 5f8314db-7724-4cdc-aaf5-c673d02a0ed6
==> wordpress-box: [vagrant-hostsupdater]   192.168.190.110  info.wordpress.local  # VAGRANT: b3a131e995f4e74dd323b1582bce1412 (wordpress-box) / 5f8314db-7724-4cdc-aaf5-c673d02a0ed6
==> wordpress-box: [vagrant-hostsupdater] This operation requires administrative access. You may skip it by manually adding equivalent entries to the hosts file.
Password:
==> wordpress-box: Setting hostname...
==> wordpress-box: Configuring and enabling network interfaces...
==> wordpress-box: Mounting shared folders...
    wordpress-box: /data/wordpress => /Users/redacted/Desktop/Dev/wordpress/redacted_wp
==> wordpress-box: Running provisioner: shell...
    wordpress-box: Running: inline script
    wordpress-box: ==> generating new self signed certificate...
    wordpress-box:  * Restarting nginx nginx
    wordpress-box:    ...done.
==> wordpress-box: Running provisioner: shell...
    wordpress-box: Running: inline script
==> wordpress-box: Running provisioner: shell...
    wordpress-box: Running: inline script
    wordpress-box:  * Restarting nginx nginx
    wordpress-box:    ...done.
    wordpress-box: avahi-daemon stop/waiting
    wordpress-box: avahi-daemon start/running, process 2301
    wordpress-box: Setting custom domains in /etc/hosts/...
==> wordpress-box: Running triggers after up...
checking for composer... no
==> wordpress-box: Executing remote command "composer install --working-dir=/data/wordpress"...
==> wordpress-box: Do not run Composer as root/super user! See https://getcomposer.org/root for details
==> wordpress-box: Loading composer repositories with package information
==> wordpress-box: Installing dependencies (including require-dev) from lock file
==> wordpress-box: Nothing to install or update
==> wordpress-box: Generating autoload files
==> wordpress-box: > WordPress\Installer::symlinkWPContent
==> wordpress-box: Remote command execution finished.
==> wordpress-box: Executing remote command "wp core install --url=https://wordpress.local --title=Wordpress         [email protected] --admin_user=vagrant --admin_password=vagrant"...
==> wordpress-box: Success: WordPress installed successfully.
==> wordpress-box: Remote command execution finished.
==> trigger: Installed default WordPress with user:vagrant password:vagrant
    wordpress-box: Activate git hooks in scripts/hooks? (yes): 
==> wordpress-box: Executing remote command "wp-activate-git-hooks"...
==> wordpress-box: Remote command execution finished.
    wordpress-box: Trust the generated ssl-certificate in OS-X keychain? (yes): 
==> wordpress-box: Executing remote command "wp-use-asset-proxy &> /dev/null"...
==> wordpress-box: Remote command execution finished.
==> wordpress-box: Executing remote command "wp-restart-nginx &> /dev/null"...
==> wordpress-box: Remote command execution finished.
==> trigger: Found vagrant-up-customizer.sh and running it ...
I7777.     .=7777,.77777..7=..     .7777.  ...777777777..  .7777..77777777777777
.77777..   .7777=  77777..777,..   .7777.  .777777777777I  .7777..77777777777777
 .I7777. ..77777.  77777..77777..  .7777...77777?...777.   .7777. .....7777.....
  .77777..77777.   77777..7777777...7777..77777.   ......  .7777.     .7777.
   .7777+7777I.    77777..777777777.7777..7777..    . .77  .7777.     .7777.
    .77777777.     77777..7777=777777777..7777..      ..   .7777.     .7777.
    ..777777.      77777..7777..?7777777..77777..   .,7,.  .7777.     .7777.
     .,7777.       77777..7777....777777. .77777777I77777I..7777.     .7777.
      .?77.        77777..7777..   .7777.  .I77777777777:  .7777.     .7777.
       .7..        77777..7777..    ..I7.   ...7I77777..   .7777.     .7777.
                    .... ..... .      ...        ...       ......     ......
                                                 logo generated @ GlassGiant.com
Running the installer...
Conquering the world...
-ne ##                    (10%)
-ne ######                (30%)
-ne ##############        (60%)
-ne ##################### (100%)
-ne 
Replacing README...
Saved working directory and index state WIP on master: 1431a70 Replace duplicate content with link to master content at seravo.com/docs
==> Non-committed extra files present at commit time - integration test results might be false!
?? .circleci/
?? config.yml
?? customizations/
?? install.sh
?? vagrant-up-customizer.sh
==> Checking syntax errors...
==> Running tests in Vagrant...
_____________________________________________________________________
WARNING! Your environment specifies an invalid locale.
 This can affect your user experience significantly, including the
 ability to manage packages. You may install the locales by running:
   sudo apt-get install language-pack-UTF-8
     or
   sudo locale-gen UTF-8
To see all available language packs, run:
   apt-cache search "^language-pack-[a-z][a-z]$"
To disable this message for all users, run:
   sudo touch /var/lib/cloud/instance/locale-check.skip
_____________________________________________________________________
==> Checking syntax errors...
==> Running rspec tests...
Running baseline.rb:
Fontconfig warning: ignoring UTF-8: not a valid region tag
....
Cleaning up...
Finished in 11.84 seconds (files took 11.51 seconds to load)
4 examples, 0 failures
==> Tests passed!
[master 23dc7c2] [auto] Replace README
 1 file changed, 103 insertions(+), 148 deletions(-)
 rewrite README.md (98%)
On branch master
Your branch is ahead of 'origin/master' by 1 commit.
  (use "git push" to publish your local commits)
Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git checkout -- <file>..." to discard changes in working directory)
    modified:   composer.json
    modified:   composer.lock
Untracked files:
  (use "git add <file>..." to include in what will be committed)
    .circleci/
    config.yml
    customizations/
    install.sh
    vagrant-up-customizer.sh
no changes added to commit (use "git add" and/or "git commit -a")
Dropped refs/stash@{0} (f31b5c121184d521fa1719c688260c0cc7fb28d8)
Adding /data/wordpress/customizations/bin to PATH
Enabling backups of the database...
Backing the database up...
Exporting the database...
Cleaning old databases that are over 7 days old...
Replacing composer.json...
Removing existing plugins...
Updating Composer mirrors...
customizations/installer.sh: line 79: composer: command not found
Running composer install...
customizations/installer.sh: line 82: composer: command not found
Turning all plugins on...
PHP Warning:  require_once(/data/wordpress/vendor/autoload.php): failed to open stream: No such file or directory in phar:///usr/local/bin/wp-cli/php/WP_CLI/Runner.php(1020) : eval()'d code on line 9
PHP Stack trace:
PHP   1. {main}() /usr/local/bin/wp-cli:0
PHP   2. include() /usr/local/bin/wp-cli:4
PHP   3. include() phar:///usr/local/bin/wp-cli/php/boot-phar.php:8
PHP   4. WP_CLI\bootstrap() phar:///usr/local/bin/wp-cli/php/wp-cli.php:23
PHP   5. WP_CLI\Bootstrap\LaunchRunner->process($state = class WP_CLI\Bootstrap\BootstrapState { private $state = array () }) phar:///usr/local/bin/wp-cli/php/bootstrap.php:75
PHP   6. WP_CLI\Runner->start() phar:///usr/local/bin/wp-cli/php/WP_CLI/Bootstrap/LaunchRunner.php:23
PHP   7. WP_CLI\Runner->load_wordpress() phar:///usr/local/bin/wp-cli/php/WP_CLI/Runner.php:983
PHP   8. eval() phar:///usr/local/bin/wp-cli/php/WP_CLI/Runner.php:1020
PHP Fatal error:  require_once(): Failed opening required '/data/wordpress/vendor/autoload.php' (include_path='phar:///usr/local/bin/wp-cli/vendor/phpunit/php-token-stream:phar:///usr/local/bin/wp-cli/vendor/phpunit/phpunit-mock-objects:phar:///usr/local/bin/wp-cli/vendor/phpunit/php-code-coverage:phar:///usr/local/bin/wp-cli/vendor/phpunit/phpunit:phar:///usr/local/bin/wp-cli/vendor/symfony/yaml:.:/usr/share/php') in phar:///usr/local/bin/wp-cli/php/WP_CLI/Runner.php(1020) : eval()'d code on line 9
PHP Stack trace:
PHP   1. {main}() /usr/local/bin/wp-cli:0
PHP   2. include() /usr/local/bin/wp-cli:4
PHP   3. include() phar:///usr/local/bin/wp-cli/php/boot-phar.php:8
PHP   4. WP_CLI\bootstrap() phar:///usr/local/bin/wp-cli/php/wp-cli.php:23
PHP   5. WP_CLI\Bootstrap\LaunchRunner->process($state = class WP_CLI\Bootstrap\BootstrapState { private $state = array () }) phar:///usr/local/bin/wp-cli/php/bootstrap.php:75
PHP   6. WP_CLI\Runner->start() phar:///usr/local/bin/wp-cli/php/WP_CLI/Bootstrap/LaunchRunner.php:23
PHP   7. WP_CLI\Runner->load_wordpress() phar:///usr/local/bin/wp-cli/php/WP_CLI/Runner.php:983
PHP   8. eval() phar:///usr/local/bin/wp-cli/php/WP_CLI/Runner.php:1020
PHP Warning:  require_once(/data/wordpress/vendor/autoload.php): failed to open stream: No such file or directory in phar:///usr/local/bin/wp-cli/php/WP_CLI/Runner.php(1020) : eval()'d code on line 9
PHP Stack trace:
PHP   1. {main}() /usr/local/bin/wp-cli:0
PHP   2. include() /usr/local/bin/wp-cli:4
PHP   3. include() phar:///usr/local/bin/wp-cli/php/boot-phar.php:8
PHP   4. WP_CLI\bootstrap() phar:///usr/local/bin/wp-cli/php/wp-cli.php:23
PHP   5. WP_CLI\Bootstrap\LaunchRunner->process($state = class WP_CLI\Bootstrap\BootstrapState { private $state = array () }) phar:///usr/local/bin/wp-cli/php/bootstrap.php:75
PHP   6. WP_CLI\Runner->start() phar:///usr/local/bin/wp-cli/php/WP_CLI/Bootstrap/LaunchRunner.php:23
PHP   7. WP_CLI\Runner->load_wordpress() phar:///usr/local/bin/wp-cli/php/WP_CLI/Runner.php:983
PHP   8. eval() phar:///usr/local/bin/wp-cli/php/WP_CLI/Runner.php:1020
PHP Fatal error:  require_once(): Failed opening required '/data/wordpress/vendor/autoload.php' (include_path='phar:///usr/local/bin/wp-cli/vendor/phpunit/php-token-stream:phar:///usr/local/bin/wp-cli/vendor/phpunit/phpunit-mock-objects:phar:///usr/local/bin/wp-cli/vendor/phpunit/php-code-coverage:phar:///usr/local/bin/wp-cli/vendor/phpunit/phpunit:phar:///usr/local/bin/wp-cli/vendor/symfony/yaml:.:/usr/share/php') in phar:///usr/local/bin/wp-cli/php/WP_CLI/Runner.php(1020) : eval()'d code on line 9
PHP Stack trace:
PHP   1. {main}() /usr/local/bin/wp-cli:0
PHP   2. include() /usr/local/bin/wp-cli:4
PHP   3. include() phar:///usr/local/bin/wp-cli/php/boot-phar.php:8
PHP   4. WP_CLI\bootstrap() phar:///usr/local/bin/wp-cli/php/wp-cli.php:23
PHP   5. WP_CLI\Bootstrap\LaunchRunner->process($state = class WP_CLI\Bootstrap\BootstrapState { private $state = array () }) phar:///usr/local/bin/wp-cli/php/bootstrap.php:75
PHP   6. WP_CLI\Runner->start() phar:///usr/local/bin/wp-cli/php/WP_CLI/Bootstrap/LaunchRunner.php:23
PHP   7. WP_CLI\Runner->load_wordpress() phar:///usr/local/bin/wp-cli/php/WP_CLI/Runner.php:983
PHP   8. eval() phar:///usr/local/bin/wp-cli/php/WP_CLI/Runner.php:1020
xargs: sudo: exited with status 255; aborting
==> Would you like to install the base theme? (y/N) y
==> Great! What name do you want to give to it? [A-Za-z0-9_] redacted_wp
==> What is the URL of the WordPress instance that WDS should proxy from? Default is https://wordpress.local: 
==> Would you like some fri- sample content with it? (Y/n) 
==> Do you want to track it in Git? (y/N) 
==> Last thing! Would you like to activate the theme? (Y/n) 
customizations/theme-installer.sh: line 35: composer: command not found
mv: rename wordpress-theme-base to redacted_wp: No such file or directory
customizations/theme-installer.sh: line 38: cd: redacted_wp: No such file or directory
==> trigger: Documentation available at https://seravo.com/docs/
==> trigger: Visit your site: https://wordpress.local

This happened because user didn't have Composer in their path. Composer is ran in the context of the users machine in order to use packagist.com token, and for performance reasons, it's simply unacceptably slow when ran in the context of Vagrant.

Kill the script early with a sensible error message instructing what to do. The Vagrant box has to be destroyed because it may be in a broken state.

Basically:

vagrant destroy
rm -rf .vagrant .vincit.d
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant