Skip to content

Conversation

@bnymn
Copy link
Contributor

@bnymn bnymn commented Sep 16, 2018

The original PR is #14660.

Enable Magento 2 to connect MySQL through SSL.

Description

We have made some modification to enable Magento 2 connect MySQL through SSL.

During the installation, there was no option to force MySQL connection through SSL. With this PR, the following options will be enabled for you to use SSL.

bin/magento setup:install \
	--db-host=<MYSQL_HOST> \
	--db-name=<MYSQL_DATABASE> \
	--db-user=<MYSQL_USERNAME> \
	--db-password=<MYSQL_PASSWORD> \
	--db-ssl-key=<MYSQL_CLIENT_KEY> \
	--db-ssl-cert=<MYSQL_CLIENT_CERT> \
	--db-ssl-ca=<MYSQL_SERVER_CERT>

Fixed Issues (if relevant)

  1. Magento 2 and SSL connection to MySQL #13561: Magento 2 and SSL connection to MySQL

Manual testing scenarios

There are two scenarios to test this feature. First one is by installing Magento via command-line, and the second one is using the Magento Setup UI via browser.

1. Installing via Command-line

  1. Install a MySQL server which accepts connections through SSL.
  2. Copy these files into a folder which is accessible by Magento: client-key.pem, client-cert.pem, ca.pem.
  3. Install a fresh Magento with the following command-line command:
bin/magento setup:install \
	--db-host=<MYSQL_HOST> \
	--db-name=<MYSQL_DATABASE> \
	--db-user=<MYSQL_USERNAME> \
	--db-password=<MYSQL_PASSWORD> \
	--db-ssl-key=<PATH/TO/CLIENT-KEY.pem> \
	--db-ssl-cert=<PATH/TO/CLIENT-CERT.pem> \
	--db-ssl-ca=<PATH/TO/CA.pem>
  1. Observe that driver_options is added into env.php file.

2. Installing via Magento Setup UI

  1. Install a MySQL server which accepts connections through SSL.
  2. Copy these files into a folder which is accessible by Magento: client-key.pem, client-cert.pem, ca.pem.
  3. Install a fresh Magento via Setup UI.
    screencapture-magento2-local-setup-2018-09-16-10_04_56
  4. Observe that driver_options is added into env.php file.

Contribution checklist

  • Pull request has a meaningful description of its purpose
  • All commits are accompanied by meaningful commit messages
  • All new or changed code is covered with unit/integration tests (if applicable)
  • All automated tests passed successfully (all builds on Travis CI are green)

@magento-cicd2
Copy link
Contributor

magento-cicd2 commented Sep 16, 2018

CLA assistant check
All committers have signed the CLA.

@magento-engcom-team
Copy link
Contributor

Hi @bnymn. Thank you for your contribution
Here is some useful tips how you can test your changes using Magento test environment.
Add the comment under your pull request to deploy test or vanilla Magento instance:

  • @magento-engcom-team give me test instance - deploy test instance based on PR changes
  • @magento-engcom-team give me $VERSION instance - deploy vanilla Magento instance

For more details, please, review the Magento Contributor Assistant documentation

@bnymn
Copy link
Contributor Author

bnymn commented Sep 16, 2018

@magento-engcom-team give me test instance

@magento-engcom-team
Copy link
Contributor

Hi @bnymn. Thank you for your request. I'm working on Magento instance for you

@magento-engcom-team
Copy link
Contributor

Hi @bnymn, here is your new Magento instance.
Admin access: https://pr-18075.engcom.dev.magento.com/admin
Login: admin Password: 123123q

@bnymn
Copy link
Contributor Author

bnymn commented Sep 21, 2018

Hi @okorshenko , @ishakhsuvarov

I am getting the following error during code sniff. I could not resolve this issue, since I don't know where the problem is. Would you please help me solve the problem?

1) Magento\Test\Php\LiveCodeTest::testCodeStyle
TypeError: Argument 2 passed to Magento\Sniffs\Annotation\ClassAnnotationStructureSniff::validateAnnotationBlockExists() must be of the type integer, boolean given, called in /home/travis/build/magento/magento2/dev/tests/static/framework/Magento/Sniffs/Annotation/ClassAnnotationStructureSniff.php on line 100
/home/travis/build/magento/magento2/dev/tests/static/framework/Magento/Sniffs/Annotation/ClassAnnotationStructureSniff.php:76
/home/travis/build/magento/magento2/dev/tests/static/framework/Magento/Sniffs/Annotation/ClassAnnotationStructureSniff.php:100
/home/travis/build/magento/magento2/vendor/squizlabs/php_codesniffer/src/Files/File.php:497
/home/travis/build/magento/magento2/vendor/squizlabs/php_codesniffer/src/Files/LocalFile.php:91
/home/travis/build/magento/magento2/vendor/squizlabs/php_codesniffer/src/Runner.php:585
/home/travis/build/magento/magento2/vendor/squizlabs/php_codesniffer/src/Runner.php:394
/home/travis/build/magento/magento2/vendor/squizlabs/php_codesniffer/src/Runner.php:114
/home/travis/build/magento/magento2/dev/tests/static/framework/Magento/TestFramework/CodingStandard/Tool/CodeSniffer.php:105
/home/travis/build/magento/magento2/dev/tests/static/testsuite/Magento/Test/Php/LiveCodeTest.php:270

@okorshenko okorshenko assigned slavvka and unassigned okorshenko Oct 1, 2018
@bnymn bnymn requested review from buskamuza and sivaschenko June 24, 2019 19:36
@magento-engcom-team
Copy link
Contributor

Hi @sivaschenko, thank you for the review.
ENGCOM-2983 has been created to process this Pull Request
✳️ @sivaschenko, could you please add one of the following labels to the Pull Request?

Label Description
Auto-Tests: Covered All changes in Pull Request is covered by auto-tests
Auto-Tests: Not Covered Changes in Pull Request requires coverage by auto-tests
Auto-Tests: Not Required Changes in Pull Request does not require coverage by auto-tests

@sivaschenko sivaschenko added the Auto-Tests: Not Required Changes in Pull Request does not require coverage by auto-tests label Jun 26, 2019
@engcom-Delta engcom-Delta self-assigned this Jun 27, 2019
@engcom-Delta
Copy link
Contributor

✔️ QA passed

@m2-assistant
Copy link

m2-assistant bot commented Jul 7, 2019

Hi @bnymn, thank you for your contribution!
Please, complete Contribution Survey, it will take less than a minute.
Your feedback will help us to improve contribution process.

@magento-engcom-team magento-engcom-team added this to the Release: 2.3.3 milestone Jul 7, 2019
@sidolov
Copy link
Contributor

sidolov commented Aug 14, 2019

Hi @bnymn, unfortunately, we cannot deliver your feature to 2.3.3 release because provided solution caused several issues on the other Magento services. We are going to restore your commits and re-work some places to achieve the quality goal and include changes to 2.3.4 release.
Thank you for your collaboration! I'm really sorry that we need to postpone such significant changes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.