Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

drpayyne
Copy link
Contributor

@drpayyne drpayyne commented Nov 11, 2019

Description

  • Added optional argument --expose-db-port=<PORT> to bin/ece-docker build:compose to expose DB port to the host

Fixed Issues

Manual testing scenarios

  1. Run bin/ece-docker build:compose --expose-db-port=4000 to expose port 4000 to host
  2. Run bin/ece-docker build:compose without --expose-db-port argument to hide DB from host (existing funcitonality)

Contribution checklist

  • Pull request has a meaningful description of its purpose
  • All commits are accompanied by meaningful commit messages

@drpayyne
Copy link
Contributor Author

Hi @shiftedreality, while setting up this repository in my local, I ran into lots of issues regarding missing .yaml files and incorrect paths to locate the mentioned missing .yaml files. Is this expected?

mattskr
mattskr previously approved these changes Nov 11, 2019
@YPyltiai YPyltiai added community PR/issue origin improvement issue type Release: 1.0.0 Magento-Cloud-Docker Release labels Nov 11, 2019
Copy link
Member

@shiftedreality shiftedreality left a 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

ProductionBuilder::KEY_NO_CRON => $input->getOption(self::OPTION_NO_CRON)
]);

if($exposedDbPort = $input->getOption(self::OPTION_EXPOSE_DB_PORT)) {
Copy link
Member

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
    ];

Copy link
Contributor Author

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.

Copy link
Member

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

Copy link
Contributor Author

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!

$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";
Copy link
Member

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

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed it, thanks!

@shiftedreality shiftedreality changed the base branch from develop to 1.0 November 11, 2019 20:07
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
Copy link
Contributor Author

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

Copy link
Member

@shiftedreality shiftedreality Nov 12, 2019

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

Copy link
Contributor Author

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!

@shiftedreality
Copy link
Member

This is simple script to test Docker integration:

#!/usr/bin/env php
<?php
/**
 * Copyright © Magento, Inc. All rights reserved.
 * See COPYING.txt for license details.
 */
require __DIR__ . '/../bootstrap.php';

use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Loader\XmlFileLoader;
use Symfony\Component\Config\FileLocator;
use Magento\CloudDocker\Filesystem\DirectoryList;

$container = new ContainerBuilder();
$container->set(DirectoryList::class, new DirectoryList(
    dirname(__DIR__),
    __DIR__ . '/../../YOUR_PROJECT',
    __DIR__ . '/../../YOUR_PROJECT'
));

$loader = new XmlFileLoader($container, new FileLocator(__DIR__ . '/../config'));
$loader->load('services.xml');

$container->compile();

$application = new Magento\CloudDocker\Application($container);
$application->run();

Place it as ./bin/dev-ece-docker:

-- YOUR_PROJECT
-- magento-cloud-docker/bin/dev-ece-docker

@shiftedreality
Copy link
Member

@mattskr please approve 1 more time

@andriyShevtsov
Copy link
Contributor

QA approved

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

Successfully merging this pull request may close these issues.

6 participants