TelemundoDigitalUnit / NBC_Docker

0 stars 1 forks source link

"Composer needs to be installed for the site" error on local WP Dashboard #9

Open rayshahriar opened 4 years ago

rayshahriar commented 4 years ago

Attempted to fix by applying the following directions from @nbcsteveb : git pull ./dkr.sh build ./dkr.sh up -d wordpress wordpress-lx wordpress-microsites

But the following errors were thrown after applying the first build command: wp-cli uses an image, skipping mysql uses an image, skipping mysql-lx uses an image, skipping wp-cli-microsites uses an image, skipping wp-cli-lx uses an image, skipping memcached-lx uses an image, skipping mysql-microsites uses an image, skipping memcached-microsites uses an image, skipping phpmyadmin-microsites uses an image, skipping nginx-lx uses an image, skipping phpmyadmin-lx uses an image, skipping nginx-microsites uses an image, skipping memcached uses an image, skipping phpmyadmin uses an image, skipping nginx uses an image, skipping Building wordpress-lx Step 1/4 : FROM wordpress:5.3-fpm ---> a6d0fbff1a4a Step 2/4 : RUN apt-get update && apt-get install -y libfcgi-bin ---> Using cache ---> fa5d6eba2214 Step 3/4 : RUN apt-get install -y libz-dev libmemcached-dev && if [ -n "$http_proxy" ]; then pear config-set http_proxy $(echo -n $http_proxy | sed 's/^https\?:\/\///'); pecl config-set http_proxy $(echo -n $http_proxy | sed 's/^https\?:\/\///'); fi; pecl install memcache memcached xdebug && docker-php-ext-enable memcache && docker-php-ext-enable memcached && docker-php-ext-enable xdebug && echo "xdebug.profiler_enable=0" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini && echo "xdebug.remote_enable=on" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini && echo "xdebug.profiler_output_dir=/tmp" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini && echo "xdebug.remote_autostart=on" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini && echo "xdebug.remote_port=$xdebug_port" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini && echo "xdebug.remote_handler=dbgp" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini && echo "xdebug.remote_connect_back=0" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini && echo "xdebug.remote_host=docker.for.mac.localhost" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini ; ---> Using cache ---> 6de7c8a20402 Step 4/4 : RUN php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" && php -r "if (hash_file('sha384', 'composer-setup.php') === 'c5b9b6d368201a9db6f74e2611495f369991b72d9c8cbd3ffbc63edff210eb73d46ffbfce88669ad33695ef77dc76976') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;" && php composer-setup.php && php -r "unlink('composer-setup.php');" && mv composer.phar /usr/local/bin/composer ; ---> Running in 6c4b753c6dfd [11-Feb-2020 20:31:23 UTC] PHP Warning: copy(): php_network_getaddresses: getaddrinfo failed: Name or service not known in Command line code on line 1 [11-Feb-2020 20:31:23 UTC] PHP Stack trace: [11-Feb-2020 20:31:23 UTC] PHP 1. {main}() Command line code:0 [11-Feb-2020 20:31:23 UTC] PHP 2. copy() Command line code:1 [11-Feb-2020 20:31:23 UTC] PHP Warning: copy(https://getcomposer.org/installer): failed to open stream: php_network_getaddresses: getaddrinfo failed: Name or service not known in Command line code on line 1 [11-Feb-2020 20:31:23 UTC] PHP Stack trace: [11-Feb-2020 20:31:23 UTC] PHP 1. {main}() Command line code:0 [11-Feb-2020 20:31:23 UTC] PHP 2. copy() Command line code:1 [11-Feb-2020 20:31:23 UTC] PHP Warning: hash_file(composer-setup.php): failed to open stream: No such file or directory in Command line code on line 1 [11-Feb-2020 20:31:23 UTC] PHP Stack trace: [11-Feb-2020 20:31:23 UTC] PHP 1. {main}() Command line code:0 [11-Feb-2020 20:31:23 UTC] PHP 2. hash_file() Command line code:1 Installer corrupt[11-Feb-2020 20:31:23 UTC] PHP Warning: unlink(composer-setup.php): No such file or directory in Command line code on line 1 [11-Feb-2020 20:31:23 UTC] PHP Stack trace: [11-Feb-2020 20:31:23 UTC] PHP 1. {main}() Command line code:0 [11-Feb-2020 20:31:23 UTC] PHP 2. unlink() Command line code:1 Could not open input file: composer-setup.php ERROR: Service 'wordpress-lx' failed to build: The command '/bin/sh -c php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" && php -r "if (hash_file('sha384', 'composer-setup.php') === 'c5b9b6d368201a9db6f74e2611495f369991b72d9c8cbd3ffbc63edff210eb73d46ffbfce88669ad33695ef77dc76976') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;" && php composer-setup.php && php -r "unlink('composer-setup.php');" && mv composer.phar /usr/local/bin/composer ;' returned a non-zero code: 1

nbcsteveb commented 4 years ago

Hey @rayshahriar

getaddrinfo failed: Name or service not known in Command line code

these are proxy errors.

For quick workaround can you run that command off the proxy ?

rayshahriar commented 4 years ago

Ok, tried off network and getting a new set of errors: `[11-Feb-2020 21:09:35 UTC] PHP Warning: copy(): SSL: Success in Command line code on line 1 [11-Feb-2020 21:09:35 UTC] PHP Stack trace: [11-Feb-2020 21:09:35 UTC] PHP 1. {main}() Command line code:0 [11-Feb-2020 21:09:35 UTC] PHP 2. copy() Command line code:1 [11-Feb-2020 21:09:35 UTC] PHP Warning: copy(): Failed to enable crypto in Command line code on line 1 [11-Feb-2020 21:09:35 UTC] PHP Stack trace: [11-Feb-2020 21:09:35 UTC] PHP 1. {main}() Command line code:0 [11-Feb-2020 21:09:35 UTC] PHP 2. copy() Command line code:1 [11-Feb-2020 21:09:35 UTC] PHP Warning: copy(https://getcomposer.org/installer): failed to open stream: operation failed in Command line code on line 1 [11-Feb-2020 21:09:35 UTC] PHP Stack trace: [11-Feb-2020 21:09:35 UTC] PHP 1. {main}() Command line code:0 [11-Feb-2020 21:09:35 UTC] PHP 2. copy() Command line code:1 [11-Feb-2020 21:09:35 UTC] PHP Warning: hash_file(composer-setup.php): failed to open stream: No such file or directory in Command line code on line 1 Installer corrupt[11-Feb-2020 21:09:35 UTC] PHP Stack trace: [11-Feb-2020 21:09:35 UTC] PHP 1. {main}() Command line code:0 [11-Feb-2020 21:09:35 UTC] PHP 2. hash_file() Command line code:1 [11-Feb-2020 21:09:35 UTC] PHP Warning: unlink(composer-setup.php): No such file or directory in Command line code on line 1 [11-Feb-2020 21:09:35 UTC] PHP Stack trace: [11-Feb-2020 21:09:35 UTC] PHP 1. {main}() Command line code:0

[11-Feb-2020 21:09:35 UTC] PHP 2. unlink() Command line code:1 Could not open input file: composer-setup.php ERROR: Service 'wordpress-microsites' failed to build: The command '/bin/sh -c php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" && php -r "if (hash_file('sha384', 'composer-setup.php') === 'c5b9b6d368201a9db6f74e2611495f369991b72d9c8cbd3ffbc63edff210eb73d46ffbfce88669ad33695ef77dc76976') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;" && php composer-setup.php && php -r "unlink('composer-setup.php');" && mv composer.phar /usr/local/bin/composer ;' returned a non-zero code: 1`

nbcsteveb commented 4 years ago

The http_proxy and https_proxy environment variables are probably interfering here..

When you hop off the proxy, make sure you do the following:

In your new shell, you can test internet connection with:

curl curlmyip.org

If it responds back with an IP address, your connection is working.

Once you've properly disabled proxy settings, you should be able to run the build command.

When you're done, and you want to hop back on the proxy, you'll have to revert any changes you made to shell config or docker config.

nbcsteveb commented 4 years ago

Also refer to fix offered here for ON proxy:

https://nbcots.slack.com/archives/CFTRZ5MF0/p1568050945010200

add these lines to your ~/.docker/config.json

"proxies" : {
    "default" : {
        "httpsProxy" : "http://proxy.inbcu.com:80",
        "httpProxy" : "http://proxy.inbcu.com:80"
    }
},