Git Product home page Git Product logo

platformsh / legacy-cli Goto Github PK

View Code? Open in Web Editor NEW
224.0 26.0 121.0 8.94 MB

This is the legacy version of Platform.sh's command-line interface. The new version is at: https://github.com/platformsh/cli

Home Page: https://docs.platform.sh/administration/cli.html

License: MIT License

PHP 99.69% Shell 0.27% HTML 0.01% Makefile 0.01% Dockerfile 0.03%
php cli cloud paas symfony-console command-line-tool platform

legacy-cli's People

Contributors

akalipetis avatar bojanz avatar colliercz avatar crell avatar cs278 avatar damz avatar dependabot[bot] avatar derrix060 avatar dwkitchen avatar fabpot avatar guguss avatar hanoii avatar kazanir avatar kotnik avatar mariadeanton avatar markushausammann avatar matthiaz avatar mglaman avatar nvahalik avatar oripekelman avatar pawpy avatar pierstoval avatar pjcdawkins avatar ralt avatar rfay avatar romainneutron avatar spk avatar steveoliver avatar tuladhar avatar vidarl avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

legacy-cli's Issues

Add logout feature

Right now I can't log out of my CLI session, but I'd like to be able to.

When `platform get` fails a directory should not be created

Synopsis:

platform get pxbzj2d3rq6rc
Cloning into 'pxbzj2d3rq6rc/repository'...
Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.```

... correct ssh key problem...

```platform get pxbzj2d3rq6rc
The project directory 'pxbzj2d3rq6rc' already exists.```

Cleanup after failed get, or don't fail if directory exists

I've often run into a situation where I do a "platform get [projectid]" and it fails (let's say I don't have my key uploaded). I then fix the problem (generate and upload a key), and then try to do the platform get. It fails again, however, because of this:

platform get [projectid]
The project directory '[projectid]' already exists.

It would be nice if the CLI were smart enough to clean up, or somehow not see this as a reason for failure.

Add platform list output to .md file

Adding the output of platform list to the .md file gives users a better chance to evaluate whether they want to use the tool:

platform list
Platform CLI version 0.1

Usage:
[options] command [arguments]

Options:
--help -h Display this help message.
--quiet -q Do not output any message.
--verbose -v|vv|vvv Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug
--version -V Display this application version.
--no-interaction -n Do not ask any interactive question.
--shell -s Launch the shell.

Available commands:
branch Branch an environment.
build Builds the current project.
checkout Checkout an environment.
drush Invoke a drush command using the site alias for the current environment.
environments Get a list of all environments.
get Does a git clone of the referenced project.
help Displays help for a command
list Lists commands
projects Get a list of all active projects.
ssh-keys Get a list of all added SSH keys.
environment
environment:backup Backup an environment.
environment:branch Branch an environment.
environment:checkout Checkout an environment.
environment:delete Delete an environment.
environment:merge Merge an environment.
environment:synchronize Synchronize an environment.
project
project:build Builds the current project.
project:delete Delete a project.
project:get Does a git clone of the referenced project.
ssh-key
ssh-key:add Add a new SSH key.
ssh-key:delete Delete an SSH key.

If there is only one branch, don't ask

platform get dxbeehq4vvf7q
Enter a number to choose which environment to checkout:
[0] : Master
0

^^ Preferred behavior would be to just grab Master, as it is the only branch, and to tell me that it is grabbing Master.

Update CLI to handle environment:delete

When deleting an environment with the CLI, it currently reports success, but doesn't actually delete the environment. The Platform API now supports this, but the CLI just needs to be updated.

Search the documentation

For consideration (I'm not 100% sold on this): platform documentation %{search terms}
or maybe
platform search %{search terms}

This would less the plaintext version of the online documentation.

Make unauthorized error less scary and more helpful

I probably had an old invalid token in ~/.platform anyway got a scary red error with no "next steps". deleting the file and logging back worked.

Welcome to Commerce Platform!

  [Guzzle\Http\Exception\ClientErrorResponseException]
  Client error response
  [status code] 401
  [reason phrase] Unauthorized
  [url] https://marketplace.commerceguys.com/api/platform/me``à

Drush version requirements too strict

The 'development' environment could not be built: Drush version must be 6.0.0 or newer. C:\Users\dwkitchen\platform> drush version Drush Version : 6.0

Handle ``shell_exec`` errors

When running a command, the CLI should check the return status, and throw an exception if needed.

This should be implemented in a wrapper function.

Include .gitignore in itself by default

From Dave Pullen: "Currently when creating a new platform project I have to manually add .gitignore to the .gitignore file, would be nice if that was just there by default."

Autoloader can no longer find symfony-cli classes after a composer global update

Hi,

I did a:

$ composer global update

which resulted in:

Changed current directory to /Users/augustin/.composer
Loading composer repositories with package information
Updating dependencies (including require-dev)
Nothing to install or update
Writing lock file
Generating autoload files

And now, I'm getting errors when running any platform command:

Fatal error: Class 'CommerceGuys\Platform\Cli\Input\ArgvInput' not found in /Users/augustin/.composer/vendor/commerceguys/platform-cli/platform on line 21

Not sure how to debug this...

Add support for synchronizing files and database

Currently, if I want my local files and database to be in sync with what's on the server I have to take three steps:

Get the database:
drush sql-sync @XXX.master > database.sql
mysql < database.sql

Get the files:
rsync -zvr [project]-[branch]@ssh.eu.platform.sh:/app/public/sites/default/files/ ./www/sites/default/files/

But with the shared/settings.local.php file we should be able to do the SQL sync for the user. We should also be making a shared/files directory that gets symlinked into the local build (if we're not already).

Home Directory cannot be found on Windows

$homeDir = shell_exec('cd ~ && pwd');

This function doesn't work on Windows.

Multi command shell needs to be in the form 'cd ~; pwd'

However this is multi line in the form


Path
----
C:\Users\dwkitchen

Make www symlink relative to project root

eg:
ln -s builds/2014-05-17--13-41-13--master www

This way, when I run Platform in a VM, but there's a shared directory with the host OS, I can run sites off the codebase in the host OS. Otherwise, the symlink is absolute within the VM, and doesn't exist on the host OS; eg:

www -> /vagrant/src/dxbeehq4vvf7q/builds/2014-05-17--13-41-13--master

^^ doesn't exist on my MacOSX, but it's perfectaly valid within the Vagrant Box.

Generated drush aliases are missing the "root" parameter

The currently generated aliases look like this:

$aliases['master'] = array (
  'parent' => '@parent',
  'site' => 'example',
  'env' => 'master',
  'remote-host' => 'ssh.eu.platform.sh',
  'remote-user' => 'example-master',
);

However, the web root is not actually in the home folder of the user. By default it is in /app/public, but this is configurable in the .platform.app.yaml. I added 'root' => '/app/public' manually, but this should be happening by default, otherwise all drush commands won't work.

Don't create folder if can't clone from repo

When running platform get, if the repo can't be cloned (my case SSH key), the folder is still created.
After correcting issue I could not run platform get again as the folder already existed.

Configuring PHPStorm for Platform

Since I have started using Platform I've been running into an issue that has caused frustration and I wanted to get feedback from the Platform team, or anyone that has run into this, as to how we handle this issue. The issue has to do with the way Platform creates a new folder in the 'builds' directory then uses a symlink for the www directory to actually display the site. This is causing a number of issues in my IDE (PHPStorm) and I have yet to find a good way to resolve it. By having so many items in the builds folder it makes things like object search and jumping to a declaration a bit trickier because I end up getting presented with a dialog asking me which object or declaration I'd like to look at, this list continues to grow as more builds are created. This adds a bit of extra time and adds the possibility I might click on the wrong one and be looking at out of date information. The number of builds also increases index time which can sometimes bog down the IDE/machine.

I've tried marking the builds folder as excluded in my PHPStorm project but when I do that it makes debugging more complex. Each time a request is made to index.php it throws an error because that is now outside the scope of the project. I can configure PHPStorm to map the symlink properly but the next time I do a build I have to recreate that mapping in the IDE.

I'd just like to know if there are any suggestions on how to work around this. So far I've just accepted it but I'm afraid this is the sort of thing that might push people off when they try Platform.

New command: platform ssh

As a convenience to the user, a command "platform ssh" which generates the ssh connection string needed to access the webserver.

eg:
ssh [email protected]

Open questions on behavior: Is it enough to print the string - can the user then hit return and initiate the ssh connection? Should we skip printing the command and just execute it?

Make sure docs are copy pastable and do not break users env

In README possibly prefer something like:

You should add platform directory to the PATH in ~/.bashrc, ~/.zshrc, ~/.profile or your shell's equivalent configuration file. You can do so by running the following command in the directory to which you cloned platform-cli

echo "export PATH=$PATH:${PWD}">>~/.bashrc;source ~/.bashrc

Why would these values be NULL?

'@parent', 'site' => '2vu7i2qxbbpwm', 'env' => 'master', 'remote-host' => NULL, 'remote-user' => NULL, ); $aliases['setup'] = array ( 'parent' => '@parent', 'site' => '2vu7i2qxbbpwm', 'env' => 'setup', 'remote-host' => NULL, 'remote-user' => NULL, ); This was on an Ubuntu installation.

Plugin model for stacks

We should probably move to a plugin model with hooky hooks for detect / get, build and such... and only expose commands that are available in the context (no drush for symfony)

Rename regroup and clean commands

screen shot 2014-09-11 at 17 19 27
if everything I do gets merges... this is how the list command looks like.

Too many first level commands too many aliases shown and naming is incosistent.

I believe:

  1. Anything that might be a plural should be a plural: so
domains
domain
  domain:add    
  domain:delete

should be

domains
  domains:add    
  domains:delete
  domains:list (or this could be simply domains which saves us a line!)

the same goes for ssh-keys

I wonder what we should do with project(s) and environement(s)

We might want less aliases (or not show them by default with platform list)

oh yeah and we need to hide _completion

Add a ``--wait`` parameter to all operations

This waits for the operation to complete or time-out after a while (10 minutes?).

As a Platform CLI user, I want a Platform environment:status command that lets me know when an environment is done building.

An extra flag -f, should specify the return output format (JSON, XML, default=plaintext)

Statuses should be: Building, Ready, Unavailable, Active, Inactive.

Platform compatability

  1. We should probably test this on multiple platforms.
  2. We should clarify in docs if this works on windows, fully or partially. (Note that since vista there is the mklink utility to create symlinks.)

Errors when getting an empty repo - i.e. a new project

When running platform get on a new project with an empty rep

Cloning into 'ccywdbkeldadm/repository'...
warning: You appear to have cloned an empty repository.
Checking connectivity... done
PHP Warning:  copy(builds/2014-04-04--11-55-23--master/sites/default/settings.php): failed to open stream: No such file or directory in /home/dwkitchen/Git/platform-cli/src/Command/ProjectBuildCommand.php on line 103
PHP Warning:  unlink(builds/2014-04-04--11-55-23--master/sites/default/default.settings.php): No such file or directory in /home/dwkitchen/Git/platform-cli/src/Command/ProjectBuildCommand.php on line 104
PHP Warning:  mkdir(): No such file or directory in /home/dwkitchen/Git/platform-cli/src/Command/ProjectBuildCommand.php on line 141
PHP Warning:  symlink(): No such file or directory in /home/dwkitchen/Git/platform-cli/src/Command/ProjectBuildCommand.php on line 150

Error when installing via composer

Fatal error: include(): Cannot redeclare class composer\command\licensescommand in phar:///usr/local/bin/composer/vendor/composer/ClassLoader.php on line 269

How to do this with the CLI? (@platform.local alias)

This is from our documentation, but it's specific to if you've made your own Drush aliases: http://docs.commerceguys.com/platform/platform-quick-start-guide/001-mastering-the-basics.html

Copy the database using drush
Need to get a copy of your site’s database locally? The easiest way to do that is to use Drush and the sql-sync command. You’ll need to have Drush aliases setup for both your Platform site and your local site. If you are using the Platform CLI and you’ve run platform get [platform_id] for a project, then your Platform aliases have already been setup.

$ drush @sql-sync @platform.master @platform.local

^^ What's the best way to do something like that with the CLI (important to Augustin and Rusty for documentation)

Give platform build a --working-copy option

The use case would be if you want to do a project with a set of custom modules as well as one or more contrib modules that you want to work on. Right now, the only repo you get is what platform puts in /repository. It would be good if platform build could be told to do drush make --working-copy so that contrib modules get made as actual repos that we can work on.

Installation via composer fails

Working (fresh) composer installation
~/workspace/playground(frega-test) $ composer -V
Composer version ac497feabaa0d247c441178b7b4aaa4c61b07399 2014-06-10 14:13:12

Other globally installed composer packages

  d11wtq/boris              v1.0.8             
  drupal/coder              7.2.2              Coder is a library and a module to review Drupal code.
  drush/drush               dev-master f13c248 Drush is a command line shell and scripting interface for Drupal, a veritable Swiss Army knife designed to make life easier for those of us who spend some of our w...
  pear/console_table        1.1.5              Class that makes it easy to build console style tables.
  squizlabs/php_codesniffer 1.5.2              PHP_CodeSniffer tokenises PHP, JavaScript and CSS files and detects violations of a defined set of coding standards.
  symfony/yaml              v2.2.1             Symfony Yaml Component

Drush-dev pins symfony/yaml on v2.2.1 (https://github.com/drush-ops/drush/blob/master/composer.json#L30) and installing platform-cli thus runs into this (dependency) issue:
~/workspace/playground(frega-test) $ composer global require "commerceguys/platform-cli=1.0.*"
Changed current directory to /home/frega/.composer
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.

Problem 1
- Installation request for commerceguys/platform-cli 1.0.* -> satisfiable by commerceguys/platform-cli[v1.0.0].
- Conclusion: remove symfony/yaml v2.2.1
- commerceguys/platform-cli v1.0.0 requires symfony/yaml ~2.4 -> satisfiable by symfony/yaml[v2.4.0, v2.4.1, v2.4.2, v2.4.3, v2.4.4, v2.4.5, v2.4.6, v2.5.0].
- Can only install one of: symfony/yaml[v2.4.0, v2.2.1].
- Can only install one of: symfony/yaml[v2.4.1, v2.2.1].
- Can only install one of: symfony/yaml[v2.4.2, v2.2.1].
- Can only install one of: symfony/yaml[v2.4.3, v2.2.1].
- Can only install one of: symfony/yaml[v2.4.4, v2.2.1].
- Can only install one of: symfony/yaml[v2.4.5, v2.2.1].
- Can only install one of: symfony/yaml[v2.4.6, v2.2.1].
- Can only install one of: symfony/yaml[v2.5.0, v2.2.1].
- Installation request for symfony/yaml == 2.2.1.0 -> satisfiable by symfony/yaml[v2.2.1].

Is there a simple work-around?

New command to upload SSL certificate

CLI should allow you to upload your own certificate to serve SSL requests on a custom domain (it's not available from the UI yet).

It would take 3 parameters:

  • A private key
  • A certificate signing this private key matching the custom domain (either in its Common Name or via the Subject Alternative Name extension)
  • The authority chain of the certificate, i.e. the chain of certificates linking this certificate to a root certification authority.

Drush aliases are not working

When I run:
drush @ed5tphi3zgcdy.dev-chil1 uli

I get:
A Drupal installation directory could not be found [error]

The aliases should point to the public folder of Platform instead of the root.

Naming of commands

I find 'init' and 'list' to be surprising. I would prefer "login" instead if init. and "list" should be reserved to list stuff like enviromenents or projects. "help" is there to list commands.

Also if possible: change the order of commands so project is before environement.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.