chilio / laravel-dusk-ci

Docker Test suite for Laravel Dusk in gitlab CI
MIT License
159 stars 51 forks source link

Run test with MySQL #22

Closed ghost closed 6 years ago

ghost commented 6 years ago

I'm trying to run your docker package to launch my Dusk tests. But I have an error related to MySQL, I don't know if it's related to your package or not, so I prefear to ask here before.

(If it's not related, I'll move this quesiton to the docker/mysql)

I'm using the folowing version

When my job is launched I get

Running with gitlab-runner 11.0.0 (5396d320)
  on Gitlab-runner web 694c0a31
Using Docker executor with image chilio/laravel-dusk-ci:stable ...
Starting service mysql:5.7 ...
Pulling docker image mysql:5.7 ...
Using docker image sha256:66bc0f66b7af6ba3ea96582685d3afcd6dff93c2f8999da0ffadd67b280db548 for mysql:5.7 ...
Waiting for services to be up and running...

*** WARNING: Service runner-694c0a31-project-30-concurrent-0-mysql-0 probably didn't start properly.

Health check error:
service "runner-694c0a31-project-30-concurrent-0-mysql-0-wait-for-service" timeout

I don't know why my current mysql container is not used and a "concurrent" version is displayed here

But just after I have this

2018-07-13T09:48:46.166996215Z Initializing database
[...]
2018-07-13T09:49:21.483652451Z Database initialized
2018-07-13T09:49:21.485018618Z Initializing certificates
2018-07-13T09:49:21.509636892Z Generating a 2048 bit RSA private key

So I guess, it's something great ?!

But at the end

Pulling docker image chilio/laravel-dusk-ci:stable ...
Using docker image sha256:e0da075c669a703e615f4cab3d08b2c03e6de138c9d2bc82399e0e9823719b0d for chilio/laravel-dusk-ci:stable ...
Running on runner-694c0a31-project-30-concurrent-0 via d09f531ddeb7...
Fetching changes...
HEAD is now at cf063fe Update .gitlab-ci.yml
Checking out cf063fe3 as master...
Skipping Git submodules setup
Checking cache for master...
Successfully extracted cache
ERROR: Job failed (system failure): Error response from daemon: Cannot link to a non running container: /runner-694c0a31-project-30-concurrent-0-mysql-0 AS /runner-694c0a31-project-30-concurrent-0-build-4/mysql

Through docker I can use docker exec -it some-mysql bash and connect to my mysql and show the databases.

I'm new to docker/testing env so maybe I missed a concept, sorry if this is the case.

chilio commented 6 years ago

@Raccoon5031 if you can in your environment, please do reboot your gitlab-runner host.

Then please remove all cache and artifacts routines also (cause they might interfere with your current workflow). Although kinda strange please do...

Then check, if you are not running out of storage space.

Nonetheless you should install gitlab-cleaner for your gitlab setup.

For now, that are my ideas, to your problem.

If you will still be running into these issues, please post more data (especially error details)....

BTW. I have experienced similar errors ONLY on an overloaded VM machine, with 10 concurrent runners, so therefore you should check your resources Storage, LAN, CPU (and exactly in this order)

ghost commented 6 years ago

Hi @chilio,

Thanks for your answer.

I restarted the gitlab-runner host, removed all chache.

My disk usage is only at 25% for the concerned partition.

No connection issue and the CPU is used at 1% by default. 12% when the test is starting (building phase, during a few seconds) and then between 3 and 6 % until the pipeline failed. Then again 1%.

Here is the complete result of the job

Running with gitlab-runner 11.0.0 (5396d320)
  on Gitlab-runner web 694c0a31
Using Docker executor with image chilio/laravel-dusk-ci:stable ...
Starting service mysql:5.7 ...
Pulling docker image mysql:5.7 ...
Using docker image sha256:66bc0f66b7af6ba3ea96582685d3afcd6dff93c2f8999da0ffadd67b280db548 for mysql:5.7 ...
Waiting for services to be up and running...

*** WARNING: Service runner-694c0a31-project-30-concurrent-0-mysql-0 probably didn't start properly.

Health check error:
service "runner-694c0a31-project-30-concurrent-0-mysql-0-wait-for-service" timeout

Health check container logs:

Service container logs:
2018-07-16T07:56:26.306168426Z Initializing database
2018-07-16T07:56:26.330132064Z 2018-07-16T07:56:26.327382Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2018-07-16T07:56:27.887992195Z 2018-07-16T07:56:27.884828Z 0 [Warning] InnoDB: New log files created, LSN=45790
2018-07-16T07:56:29.296405895Z 2018-07-16T07:56:29.295980Z 0 [Warning] InnoDB: Creating foreign key constraint system tables.
2018-07-16T07:56:30.103526296Z 2018-07-16T07:56:30.103336Z 0 [Warning] No existing UUID has been found, so we assume that this is the first time that this server has been started. Generating a new UUID: bfb8ce8a-88cd-11e8-9b4d-0242ac110004.
2018-07-16T07:56:30.170889955Z 2018-07-16T07:56:30.167405Z 0 [Warning] Gtid table is not ready to be used. Table 'mysql.gtid_executed' cannot be opened.
2018-07-16T07:56:30.170933239Z 2018-07-16T07:56:30.168589Z 1 [Warning] root@localhost is created with an empty password ! Please consider switching off the --initialize-insecure option.

*********

Pulling docker image chilio/laravel-dusk-ci:stable ...
Using docker image sha256:e0da075c669a703e615f4cab3d08b2c03e6de138c9d2bc82399e0e9823719b0d for chilio/laravel-dusk-ci:stable ...
Running on runner-694c0a31-project-30-concurrent-0 via d09f531ddeb7...
Fetching changes...
Removing vendor/
HEAD is now at cf063fe Update .gitlab-ci.yml
Checking out cf063fe3 as master...
Skipping Git submodules setup
Checking cache for master...
Successfully extracted cache
$ composer install --prefer-dist --no-ansi --no-interaction --no-progress --no-scripts
Loading composer repositories with package information
Installing dependencies (including require-dev) from lock file
Package operations: 90 installs, 0 updates, 0 removals
  - Installing symfony/process (v4.0.9): Downloading (100%)
  - Installing psr/log (1.0.2): Downloading (100%)
  - Installing knplabs/knp-snappy (v1.0.4): Downloading (100%)
  - Installing vlucas/phpdotenv (v2.4.0): Downloading (100%)
  - Installing symfony/css-selector (v4.0.9): Downloading (100%)
  - Installing tijsverkoyen/css-to-inline-styles (2.2.1): Downloading (100%)
  - Installing symfony/polyfill-php72 (v1.8.0): Downloading (100%)
  - Installing symfony/polyfill-mbstring (v1.8.0): Downloading (100%)
  - Installing symfony/var-dumper (v4.0.9): Downloading (100%)
  - Installing symfony/routing (v4.0.9): Downloading (100%)
  - Installing symfony/http-foundation (v4.0.9): Downloading (100%)
  - Installing symfony/event-dispatcher (v4.0.9): Downloading (100%)
  - Installing symfony/debug (v4.0.9): Downloading (100%)
  - Installing symfony/http-kernel (v4.0.9): Downloading (100%)
  - Installing symfony/finder (v4.0.9): Downloading (100%)
  - Installing symfony/console (v4.0.9): Downloading (100%)
  - Installing doctrine/lexer (v1.0.1): Downloading (100%)
  - Installing egulias/email-validator (2.1.4): Downloading (100%)
  - Installing swiftmailer/swiftmailer (v6.0.2): Downloading (100%)
  - Installing paragonie/random_compat (v2.0.12): Downloading (100%)
  - Installing ramsey/uuid (3.7.3): Downloading (100%)
  - Installing psr/simple-cache (1.0.1): Downloading (100%)
  - Installing psr/container (1.0.0): Downloading (100%)
  - Installing symfony/translation (v4.0.9): Downloading (100%)
  - Installing nesbot/carbon (1.25.0): Downloading (100%)
  - Installing monolog/monolog (1.23.0): Downloading (100%)
  - Installing league/flysystem (1.0.45): Downloading (100%)
  - Installing erusev/parsedown (1.7.1): Downloading (100%)
  - Installing dragonmantank/cron-expression (v2.1.0): Downloading (100%)
  - Installing doctrine/inflector (v1.3.0): Downloading (100%)
  - Installing laravel/framework (v5.6.21): Downloading (100%)
  - Installing barryvdh/laravel-snappy (v0.4.1): Downloading (100%)
  - Installing psr/http-message (1.0.1): Downloading (100%)
  - Installing guzzlehttp/psr7 (1.4.2): Downloading (100%)
  - Installing guzzlehttp/promises (v1.3.1): Downloading (100%)
  - Installing guzzlehttp/guzzle (6.3.3): Downloading (100%)
  - Installing h4cc/wkhtmltopdf-amd64 (0.12.4): Downloading (100%)
  - Installing jakub-onderka/php-console-color (0.1): Downloading (100%)
  - Installing laracasts/flash (3.0.2): Downloading (100%)
  - Installing nikic/php-parser (v4.0.1): Downloading (100%)
  - Installing jakub-onderka/php-console-highlighter (v0.3.2): Downloading (100%)
  - Installing dnoegel/php-xdg-base-dir (0.1): Downloading (100%)
  - Installing psy/psysh (v0.9.3): Downloading (100%)
  - Installing laravel/tinker (v1.0.6): Downloading (100%)
  - Installing laravelcollective/html (v5.6.8): Downloading (100%)
  - Installing phpseclib/phpseclib (2.0.11): Downloading (100%)
  - Installing league/flysystem-sftp (1.0.15): Downloading (100%)
  - Installing phpoffice/phpexcel (1.8.1): Downloading (100%)
  - Installing symfony/polyfill-util (v1.8.0): Downloading (100%)
  - Installing symfony/polyfill-php56 (v1.8.0): Downloading (100%)
  - Installing jeremeamia/superclosure (2.4.0): Downloading (100%)
  - Installing maatwebsite/excel (2.1.28): Downloading (100%)
  - Installing pusher/pusher-php-server (v3.0.3): Downloading (100%)
  - Installing spatie/laravel-blade-javascript (2.2.0): Downloading (100%)
  - Installing spatie/laravel-permission (2.12.1): Downloading (100%)
  - Installing unisharp/laravel-ckeditor (4.7.2): Downloading (100%)
  - Installing filp/whoops (2.1.14): Downloading (100%)
  - Installing fzaninotto/faker (v1.7.1): Downloading (100%)
  - Installing facebook/webdriver (1.5.0): Downloading (100%)
  - Installing laravel/dusk (v3.0.8): Downloading (100%)
  - Installing hamcrest/hamcrest-php (v1.2.2): Downloading (100%)
  - Installing mockery/mockery (0.9.9): Downloading (100%)
  - Installing webmozart/assert (1.3.0): Downloading (100%)
  - Installing phpdocumentor/reflection-common (1.0.1): Downloading (100%)
  - Installing phpdocumentor/type-resolver (0.4.0): Downloading (100%)
  - Installing phpdocumentor/reflection-docblock (4.3.0): Downloading (100%)
  - Installing phpunit/php-token-stream (3.0.0): Downloading (100%)
  - Installing sebastian/version (2.0.1): Downloading (100%)
  - Installing sebastian/resource-operations (1.0.0): Downloading (100%)
  - Installing sebastian/recursion-context (3.0.0): Downloading (100%)
  - Installing sebastian/object-reflector (1.1.1): Downloading (100%)
  - Installing sebastian/object-enumerator (3.0.3): Downloading (100%)
  - Installing sebastian/global-state (2.0.0): Downloading (100%)
  - Installing sebastian/exporter (3.1.0): Downloading (100%)
  - Installing sebastian/environment (3.1.0): Downloading (100%)
  - Installing sebastian/diff (3.0.0): Downloading (100%)
  - Installing sebastian/comparator (3.0.0): Downloading (100%)
  - Installing phpunit/php-text-template (1.2.1): Downloading (100%)
  - Installing doctrine/instantiator (1.1.0): Downloading (100%)
  - Installing phpunit/phpunit-mock-objects (6.1.1): Downloading (100%)
  - Installing phpunit/php-timer (2.0.0): Downloading (100%)
  - Installing phpunit/php-file-iterator (1.4.5): Downloading (100%)
  - Installing theseer/tokenizer (1.1.0): Downloading (100%)
  - Installing sebastian/code-unit-reverse-lookup (1.0.1): Downloading (100%)
  - Installing phpunit/php-code-coverage (6.0.4): Downloading (100%)
  - Installing phpspec/prophecy (1.7.6): Downloading (100%)
  - Installing phar-io/version (1.0.1): Downloading (100%)
  - Installing phar-io/manifest (1.0.1): Downloading (100%)
  - Installing myclabs/deep-copy (1.7.0): Downloading (100%)
  - Installing phpunit/phpunit (7.1.5): Downloading (100%)
knplabs/knp-snappy suggests installing h4cc/wkhtmltoimage-amd64 (Provides wkhtmltoimage-amd64 binary for Linux-compatible machines, use version `~0.12` as dependency)
knplabs/knp-snappy suggests installing h4cc/wkhtmltoimage-i386 (Provides wkhtmltoimage-i386 binary for Linux-compatible machines, use version `~0.12` as dependency)
knplabs/knp-snappy suggests installing h4cc/wkhtmltopdf-i386 (Provides wkhtmltopdf-i386 binary for Linux-compatible machines, use version `~0.12` as dependency)
knplabs/knp-snappy suggests installing wemersonjanuario/wkhtmltopdf-windows (Provides wkhtmltopdf executable for Windows, use version `~0.12` as dependency)
symfony/routing suggests installing doctrine/annotations (For using the annotation loader)
symfony/routing suggests installing symfony/config (For using the all-in-one router or any loader)
symfony/routing suggests installing symfony/dependency-injection (For loading routes from a service)
symfony/routing suggests installing symfony/expression-language (For using expression matching)
symfony/routing suggests installing symfony/yaml (For using the YAML loader)
symfony/event-dispatcher suggests installing symfony/dependency-injection ()
symfony/http-kernel suggests installing symfony/browser-kit ()
symfony/http-kernel suggests installing symfony/config ()
symfony/http-kernel suggests installing symfony/dependency-injection ()
symfony/console suggests installing symfony/lock ()
paragonie/random_compat suggests installing ext-libsodium (Provides a modern crypto API that can be used to generate random bytes.)
ramsey/uuid suggests installing ext-libsodium (Provides the PECL libsodium extension for use with the SodiumRandomGenerator)
ramsey/uuid suggests installing ircmaxell/random-lib (Provides RandomLib for use with the RandomLibAdapter)
ramsey/uuid suggests installing moontoast/math (Provides support for converting UUID to 128-bit integer (in string form).)
ramsey/uuid suggests installing ramsey/uuid-console (A console application for generating UUIDs with ramsey/uuid)
ramsey/uuid suggests installing ramsey/uuid-doctrine (Allows the use of Ramsey\Uuid\Uuid as Doctrine field type.)
symfony/translation suggests installing symfony/config ()
symfony/translation suggests installing symfony/yaml ()
monolog/monolog suggests installing aws/aws-sdk-php (Allow sending log messages to AWS services like DynamoDB)
monolog/monolog suggests installing doctrine/couchdb (Allow sending log messages to a CouchDB server)
monolog/monolog suggests installing ext-amqp (Allow sending log messages to an AMQP server (1.0+ required))
monolog/monolog suggests installing ext-mongo (Allow sending log messages to a MongoDB server)
monolog/monolog suggests installing graylog2/gelf-php (Allow sending log messages to a GrayLog2 server)
monolog/monolog suggests installing mongodb/mongodb (Allow sending log messages to a MongoDB server via PHP Driver)
monolog/monolog suggests installing php-amqplib/php-amqplib (Allow sending log messages to an AMQP server using php-amqplib)
monolog/monolog suggests installing php-console/php-console (Allow sending log messages to Google Chrome)
monolog/monolog suggests installing rollbar/rollbar (Allow sending log messages to Rollbar)
monolog/monolog suggests installing ruflin/elastica (Allow sending log messages to an Elastic Search server)
monolog/monolog suggests installing sentry/sentry (Allow sending log messages to a Sentry server)
league/flysystem suggests installing league/flysystem-aws-s3-v2 (Allows you to use S3 storage with AWS SDK v2)
league/flysystem suggests installing league/flysystem-aws-s3-v3 (Allows you to use S3 storage with AWS SDK v3)
league/flysystem suggests installing league/flysystem-azure (Allows you to use Windows Azure Blob storage)
league/flysystem suggests installing league/flysystem-cached-adapter (Flysystem adapter decorator for metadata caching)
league/flysystem suggests installing league/flysystem-eventable-filesystem (Allows you to use EventableFilesystem)
league/flysystem suggests installing league/flysystem-rackspace (Allows you to use Rackspace Cloud Files)
league/flysystem suggests installing league/flysystem-webdav (Allows you to use WebDAV storage)
league/flysystem suggests installing league/flysystem-ziparchive (Allows you to use ZipArchive adapter)
league/flysystem suggests installing spatie/flysystem-dropbox (Allows you to use Dropbox storage)
league/flysystem suggests installing srmklive/flysystem-dropbox-v2 (Allows you to use Dropbox storage for PHP 5 applications)
laravel/framework suggests installing aws/aws-sdk-php (Required to use the SQS queue driver and SES mail driver (~3.0).)
laravel/framework suggests installing doctrine/dbal (Required to rename columns and drop SQLite columns (~2.6).)
laravel/framework suggests installing league/flysystem-aws-s3-v3 (Required to use the Flysystem S3 driver (~1.0).)
laravel/framework suggests installing league/flysystem-cached-adapter (Required to use the Flysystem cache (~1.0).)
laravel/framework suggests installing league/flysystem-rackspace (Required to use the Flysystem Rackspace driver (~1.0).)
laravel/framework suggests installing nexmo/client (Required to use the Nexmo transport (~1.0).)
laravel/framework suggests installing pda/pheanstalk (Required to use the beanstalk queue driver (~3.0).)
laravel/framework suggests installing predis/predis (Required to use the redis cache and queue drivers (~1.0).)
laravel/framework suggests installing symfony/dom-crawler (Required to use most of the crawler integration testing tools (~4.0).)
laravel/framework suggests installing symfony/psr-http-message-bridge (Required to psr7 bridging features (~1.0).)
psy/psysh suggests installing ext-pdo-sqlite (The doc command requires SQLite to work.)
psy/psysh suggests installing hoa/console (A pure PHP readline implementation. You'll want this if your PHP install doesn't already support readline or libedit.)
phpseclib/phpseclib suggests installing ext-libsodium (SSH2/SFTP can make use of some algorithms provided by the libsodium-php extension.)
phpseclib/phpseclib suggests installing ext-mcrypt (Install the Mcrypt extension in order to speed up a few other cryptographic operations.)
filp/whoops suggests installing whoops/soap (Formats errors as SOAP responses)
sebastian/global-state suggests installing ext-uopz (*)
phpunit/phpunit suggests installing phpunit/php-invoker (^2.0)
Package phpoffice/phpexcel is abandoned, you should avoid using it. Use phpoffice/phpspreadsheet instead.
Generating optimized autoload files
ERROR: Job failed (system failure): Error response from daemon: Cannot link to a non running container: /runner-694c0a31-project-30-concurrent-0-mysql-0 AS /runner-694c0a31-project-30-concurrent-0-predefined-5/mysql

Do I need a MySQL container running with a specific version ? Because I'm currently using mysql:57 in a docker container (but again, I'm not sure it's needed) Or do I need to setup something before concerning the database ?

I also tried to use your 3 versions (latest, stable, old-stable) but I have the same issue.

chilio commented 6 years ago

@Raccoon5031 gitlab-runner spins up completely new mysql instance (so you can run all on a clean db) and therefore you should have proper variables in .gitlab-ci.yml like:

# Variables
variables:
  MYSQL_ROOT_PASSWORD: root
  MYSQL_USER: homestead
  MYSQL_PASSWORD: secret
  MYSQL_DATABASE: homestead
  DB_HOST: mysql
  DB_CONNECTION: mysql

Do you have them? If so please post your complete .gitlab-ci.yml BTW. You can use different mysql versions like mysql:5.7 you mentioned. However as of mysql 8 mysql:latest does not work for now...

ghost commented 6 years ago

@chilio

Then please remove all cache and artifacts routines also (cause they might interfere with your current workflow). Although kinda strange please do...

I left an artifact without realizing it. After removing it, everything worked directly.

Thank you for your help !

Maybe it would be interesting to mention that in the "Troubleshooting" part?

chilio commented 6 years ago

@Raccoon5031 I will do that, thanks for the tip...