-
Notifications
You must be signed in to change notification settings - Fork 197
Added optional argument to expose DB port #101
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
Conversation
Hi @shiftedreality, while setting up this repository in my local, I ran into lots of issues regarding missing |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall looks good, requested minor changes
src/Command/BuildCompose.php
Outdated
ProductionBuilder::KEY_NO_CRON => $input->getOption(self::OPTION_NO_CRON) | ||
]); | ||
|
||
if($exposedDbPort = $input->getOption(self::OPTION_EXPOSE_DB_PORT)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This can be safely added to map:
private static $optionsMap = [
self::OPTION_PHP => ServiceInterface::NAME_PHP,
self::OPTION_DB => ServiceInterface::NAME_DB,
self::OPTION_NGINX => ServiceInterface::NAME_NGINX,
self::OPTION_REDIS => ServiceInterface::NAME_REDIS,
self::OPTION_ES => ServiceInterface::NAME_ELASTICSEARCH,
self::OPTION_NODE => ServiceInterface::NAME_NODE,
self::OPTION_RABBIT_MQ => ServiceInterface::NAME_RABBITMQ,
self::OPTION_SELENIUM_VERSION => ServiceFactory::SERVICE_SELENIUM_VERSION,
self::OPTION_SELENIUM_IMAGE => ServiceFactory::SERVICE_SELENIUM_IMAGE
];
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any suggestions on where I can place the constant for the --expose-db-port
argument? Not sure where to place it since it isn't a service like the others.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just put to ProductionBuilder
, we already have there similar args
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@shiftedreality, I've fixed it. Thank you!
src/Compose/ProductionBuilder.php
Outdated
$dbVersion = $this->config->get(ServiceInterface::NAME_DB) | ||
?: $this->getServiceVersion(ServiceInterface::NAME_DB); | ||
$hostPort = $this->config->get(self::KEY_EXPOSE_DB_PORT); | ||
$dbPorts = $hostPort ? "$hostPort:3306" : "3306"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please use single quotes in an else
statement
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed it, thanks!
src/Command/BuildCompose.php
Outdated
self::OPTION_ES => ServiceInterface::NAME_ELASTICSEARCH, | ||
self::OPTION_NODE => ServiceInterface::NAME_NODE, | ||
self::OPTION_RABBIT_MQ => ServiceInterface::NAME_RABBITMQ, | ||
self::OPTION_EXPOSE_DB_PORT => self::OPTION_EXPOSE_DB_PORT |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I reused the key, since ProductionBuilder already has the same key, and unlike the other services, this argument will have same name and value. @shiftedreality
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You cannot be sure those 2 constants will remain the same, please use the constant from ProductionBuilder
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed it, @shiftedreality. Apologies for the confusion!
This is simple script to test Docker integration:
Place it as
|
@mattskr please approve 1 more time |
QA approved |
Description
--expose-db-port=<PORT>
tobin/ece-docker build:compose
to expose DB port to the hostFixed Issues
Internal issue: https://magento2.atlassian.net/browse/MAGECLOUD-4544
Manual testing scenarios
bin/ece-docker build:compose --expose-db-port=4000
to expose port 4000 to hostbin/ece-docker build:compose
without--expose-db-port
argument to hide DB from host (existing funcitonality)Contribution checklist