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

Extend this example to include a mysql container #11

Open
tripper54 opened this issue Jun 6, 2018 · 4 comments
Open

Extend this example to include a mysql container #11

tripper54 opened this issue Jun 6, 2018 · 4 comments

Comments

@tripper54
Copy link

Hi there,

Thanks for putting this example together, it has been a great help!

It would be really cool if you could extend it to include a mysql container for the DB layer. I think an example that included a second mysql container would cover typical use cases a lot better.

Thanks!

@ec-wagner
Copy link

Trying to figure out how to use a circleci MySQL container with this example. Can someone please push me in the right direction.

this is how my config.yml looks like:

version: 2
jobs:
  build:
    docker:
      - image: circleci/php:7.1-node-browsers
        environment:
          MYSQL_HOST: 127.0.0.1
          MYSQL_DB: testing
          MYSQL_USER: testing
          MYSQL_ALLOW_EMPTY_PASSWORD: true
          MYSQL_PASSWORD: testing

      - image: mysql:5.7
        environment:
            MYSQL_USER: testing
            MYSQL_ALLOW_EMPTY_PASSWORD: true

    working_directory: ~/laravel

    steps:
      - checkout
      - run: sudo apt install -y libsqlite3-dev zlib1g-dev
      - run: sudo docker-php-ext-install zip
      - run: composer install -n --prefer-dist
      # - run: composer install --dev --ignore-platform-reqs

      # prepare the database
      - run:
          name: Create Mysql Database
          command: mysql  -h 127.0.0.1 -u root -e "create database testing;"

the build breaks at last step

#!/bin/bash -eo pipefail
mysql  -h 127.0.0.1 -u root -e "create database testing;"
/bin/bash: mysql: command not found
Exited with code 127

@ec-wagner
Copy link

from here I found out that I have to add an mysql client to the primary container

- run: checkout
- run: sudo apt install -y mysql-client

But now I am running into another error

$ php artisan migrate

In Connection.php line 647:
  could not find driver (SQL: select * from information_schema.tables where table_schema = circle_test and table_name = migrations)  
                                                                                                                                     
In Connector.php line 68:
  could not find driver

Yes, please add and MyQSL example.

@ridaamirini
Copy link

ridaamirini commented Jan 6, 2019

@ec-wagner this should fix it

- run: sudo docker-php-ext-install zip pdo pdo_mysql

@omitobi
Copy link

omitobi commented May 2, 2020

@ec-wagner this should fix it

- run: sudo docker-php-ext-install zip pdo pdo_mysql

@ridaamirini Your comment helped me fix the same issue. Thank you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants