Skip to content

Rewrite base implementation using SSH for remote calls #1

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

Open
wants to merge 10 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 20 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,23 +8,33 @@ Actual commands reside on Magento instances. When a new instance (context) is ad

The tool itself only provides following commands:

* ```magento instance:add [name] [url]``` - register a new managed remote instance
* ```magento instance:remove [name]``` - unregister a managed instance from the tool instance list
* ```magento instance:list``` - list registered remote instances
* ```magento instance:update``` - load a list of commands supported by the instance
* ```magento context:set [name]``` - select the default instance to be used in commands
* `./bin/magento instance:add [name] [type] [url]` - register a new managed remote instance
* `./bin/magento instance:remove [name]` - unregister a managed instance from the tool instance list
* `./bin/magento instance:list` - list registered remote instances
* `./bin/magento instance:get` - show current context
* `./bin/magento context:set [name]` - select the default instance to be used in commands

### Magento instance endpoints
#### Remote types

This tool only works with magento instances that support remote calls and metadata sharing.
Tool works with both remote and local calls.

Use https://gist.github.com/antonkril/405d5025038fbc0d333dcd59482e58f4 in root folder for metadata sharing.
### Add remote context:

```bash
./bin/magento context:add cloud remote <some_ssh_url>
```

### Add local context:

```bash
./bin/magento context:add local local <some_local_path>
```

#### Security

The prototype MUST NOT be used in production systems.
The tool is using SSH for remote calls.

### Evolution plan

* Add authentication
* Add install/deploy commands for standard environments (local, docker, vagrant, kubernetes)
* Optimize IO operations
16 changes: 16 additions & 0 deletions bin/magento
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/usr/bin/env php
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
require __DIR__ . '/../bootstrap.php';

$handler = new \Magento\Console\Application\ErrorHandler();
set_error_handler([$handler, 'handle']);

$container = new \Illuminate\Container\Container();
$container->instance(\Illuminate\Contracts\Container\Container::class, $container);
$container->make(\Magento\Console\Application::class, [
'container' => $container
])->run();
18 changes: 18 additions & 0 deletions bootstrap.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
require_once __DIR__ . '/vendor/autoload.php';

error_reporting(E_ALL);
date_default_timezone_set('UTC');

$homeDir = $_SERVER['HOME'] . '/.magento';
if (!file_exists($homeDir)) {
mkdir($homeDir);
}

if (!defined('HOME_DIR')) {
define('HOME_DIR', $homeDir);
}
22 changes: 19 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,29 @@
{
"name": "magento/magento-tool",
"description": "Magento Console Client",
"type": "project",
"license": [
"OSL-3.0",
"AFL-3.0"
],
"config": {
"sort-packages": true
},
"require": {
"php": "^7.1.3",
"symfony/console": "^4.1",
"ext-curl": "*",
"ext-json": "*",
"ext-curl": "*"
"illuminate/config": "^5.7",
"illuminate/container": "^5.7",
"illuminate/filesystem": "^5.7",
"symfony/console": "^4.1",
"symfony/process": "^4.2",
"symfony/yaml": "^4.2"
},
"autoload": {
"psr-4": { "Magento\\Console\\": "src/" },
"psr-4": {
"Magento\\Console\\": "src/"
},
"exclude-from-classmap": [
"/Tests/"
]
Expand Down
Loading