vanilla/vanilla-docker

trouble with initial setup

olets opened this issue · 2 comments

olets commented

I'm having some trouble that might be related to what ports are available, but it also looks like part of the install (a composer command) might be buggy. I'd be happy for any help debugging. Thanks!

I followed the README, and when I first ran docker-compose up -build I got

…lots of install logs, every looks okay…
…just the occasional "can't be created because it already exists," then…
…
Build complete.
Don't forget to run 'make test'.

Installing shared extensions:     /usr/local/lib/php/extensions/no-debug-non-zts-20170718/
find . -name \*.gcno -o -name \*.gcda | xargs rm -f
find . -name \*.lo -o -name \*.o | xargs rm -f
find . -name \*.la -o -name \*.a | xargs rm -f
find . -name \*.so | xargs rm -f
find . -name .libs -a -type d|xargs rm -rf
rm -f libphp.la       modules/* libs/*
No releases available for package "pecl.php.net/xdebug"
install failed
ERROR: Service 'php-fpm' failed to build: The command '/bin/sh -c apt-get update     && apt-get install -y         libfreetype6-dev         libjpeg62-turbo-dev         libmcrypt-dev         libmemcached-dev         libpng-dev         sendmail     && docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/     && docker-php-ext-install -j$(nproc) gd mbstring pdo pdo_mysql     && pecl install xdebug     && docker-php-ext-enable xdebug     && pecl install memcached     && docker-php-ext-enable memcached' returned a non-zero code: 1

I ran up -build again, and this time got

...(lots of logs)…
Successfully built 2dd0b7539b0e
Successfully tagged vanilla-docker_httpd:latest
Creating database ... done
Creating php-fpm  ... done
Creating httpd    ...
Creating nginx    ... error

Creating httpd    ... done
0e8d775dec16413cb75be67c8b20546c28c48): Error starting userland proxy: Bind for 0.0.0.0:443: unexpected error (Failure EADDRINUSE)

ERROR: for nginx  Cannot start service nginx: driver failed programming external connectivity on endpoint nginx (66a0298c058a2f938e5d9c26a200e8d775dec16413cb75be67c8b20546c28c48): Error starting userland proxy: Bind for 0.0.0.0:443: unexpected error (Failure EADDRINUSE)
ERROR: Encountered errors while bringing up the project.

I found 443:443 in docker-compose.yml, and tried changing it to 3001:3001, and ran docker-compose up --build:

…(fewer logs)…
Successfully built 36c53ee0a0c1
Successfully tagged vanilla-docker_nginx:latest
Creating database ... done
Creating php-fpm  ... done
Creating nginx    ... done
Creating httpd    ... done
Attaching to database, php-fpm, nginx, httpd
php-fpm     | Updating certificates in /etc/ssl/certs...
php-fpm     | 1 added, 0 removed; done.
php-fpm     | Running hooks in /etc/ca-certificates/update.d...
php-fpm     | done.

Great! Visited http://dev.vanilla.localhost/ and in the browser got

Could not find the autoloader. Did you forget to run 'composer install' in '/srv/vanilla-repositories/vanilla' ? 

I tried https://dev.vanilla.localhost:9443 and saw the same thing.

After a few tries at shutting down and starting up the docker, I finally reverted the port config back to use 443:443. Just for kicks, I tried starting up the docker again. This time I got that same good looking result, no EADDRINUSE error. But http://dev.vanilla.localhost/ still gives me the notice about composer install. And now https://dev.vanilla.localhost:9443 shows

Bad Request

Your browser sent a request that this server could not understand.
Reason: You're speaking plain HTTP to an SSL-enabled server port.
Instead use the HTTPS scheme to access this URL, please.

Multiple things here:

  • docker-compose up --build is the proper command to run. (Maybe a typo)
  • Skipping the first error since you got past it, the problem is probably because you have httpd installed as a service on your local machine and it is launched at start up. You can double check that using ps aux | grep httpd or sudo launchctl list | grep httpd (to check if httpd is running). So to "fix" that error you just have to make sure that the service taking the port 80 is not launched when you start your computer.
  • If you want to use different ports you have to do the mapping like so:
    nginx:
        ...
        ports:
            - "{ALTERNATE_PORT_80}:80"
            - "{ALTERNATE_PORT_8080}:8080"
            - "{ALTERNATE_PORT_443}:443"

This will map port from your local machine to the port inside the docker container.
Then you can do http://dev.vanilla.localhost:{ALTERNATE_PORT_80}/ to access vanilla.

  • As for Could not find the autoloader. Did you forget to run 'composer install' in '/srv/vanilla-repositories/vanilla' ? That error means that you didn't run composer install inside your vanilla repository.
olets commented

Yes, the -build was a typo in my writeup. I did figure out the composer install thing (I was tripped up by the error's /srv/vanilla-repositories/ for a while).

I ended up getting as far as the Vanilla installer, and the installer couldn't find the db.

The project I was doing this for has gone in a different direction, and I'm not sure when I'll come back to debugging the db problem :) But I'll open a PR to fill in some gaps in the Readme. Thanks for the help!