Giter Site home page Giter Site logo

clevercloud / clever-tools Goto Github PK

View Code? Open in Web Editor NEW
73.0 14.0 47.0 9.12 MB

The official command line interface for Clever Cloud

Home Page: https://www.clever-cloud.com/

License: Apache License 2.0

JavaScript 97.97% Shell 1.15% Dockerfile 0.42% Ruby 0.31% PowerShell 0.16%
cli tool

clever-tools's Introduction

Clever Tools

Deploy on Clever Cloud and control you applications, add-ons, services from command line.

Installation

Clever Tools are available from many channels. The simpler way to install them, if you already have Node.js on your system, is through npm package manager:

npm install -g clever-tools

We also distribute binaries and packages for multiple systems and tools:

Enabling autocompletion

The clever-tools CLI comes with a comprehensive auto-completion system. Some installation methods through package managers will try to enable it automatically. If not, use this for bash:

clever --bash-autocomplete-script $(which clever) | sudo tee /usr/share/bash-completion/completions/clever

or that for zsh:

clever --zsh-autocomplete-script $(which clever) | sudo tee /usr/share/zsh/site-functions

How to use

You can then login and check everything is working:

clever login
clever profile

Discover how to use Clever Tools through our documentation.

Examples

Discover how to deploy many applications on Clever Cloud within our guides.

How to send feedback?

Send us an email! or submit an issue.

Automated releases

This project uses GitHub Actions to build binaries, package them and release them automatically on the various repositories. If you want to know more or if you need to release a new version, please read RELEASE.md carefully.

License

This project is licensed under the Apache-2.0.

We're using a CJS bundled version of a file from curlconverter:

  • The project is licensed with MIT
  • The copyright is at the top the file vendors/curlconverter-parse
  • The details are explained in README_VENDORS.md

clever-tools's People

Contributors

aurrelhebert avatar blackyoup avatar caillef avatar clementd-fretlink avatar clevercloud-ci avatar davlgd avatar decampsrenan avatar divarvel avatar drouarb avatar gaelreyrol avatar grallc avatar haitlahcen avatar hsablonniere avatar judu avatar jygastaud avatar k33g avatar kakawait avatar kannarfr avatar keruspe avatar ldoguin avatar mbaechler avatar mickaelchanrion avatar miton18 avatar notbad4u avatar pdesoyres-cc avatar rbelouin avatar remibardon avatar snyk-bot avatar tolbon avatar urcadox 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

Watchers

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

clever-tools's Issues

Check for remote name conflicts during link, not deploy

Let's say I already have a remote named "preprod", and I link an application with the alias "preprod".

If my preprod remote isn't exactly the one clever-tools tries to create, it just bails out doing nothing. It can be quite common as we expect users to have "git+ssh://blah" url as displayed everywhere but clever-tools tries to use only "ssh://" because of nodegit (hasn't this been fixed already?)

clever link should check for a remote with the given name and print a warning showing both the current and expected value, and then the other commands should just use the remote without complaining.

Allow having a "default" alias

For now, let's say I have a prod and a preprod app.

clever link prod_id
clever link preprod_id --alias preprod

I would expect "clever" to deal with prod, and "clever --alias preprod" to deal with preprod.

Currently "clever" complains that I do not pass it an alias, which has been autogenerated as equal to the app name

Incorrectly strips logging output of HTML-alike text.

This behaviour is very, very wrong. For example:

2015-11-11T16:53:38.478Z: Exception: Inappropriate return value or return value does not match response registry:

The above line should actually be (similar to):

2015-11-11T16:53:38.478Z: Exception: Inappropriate return value or return value does not match response registry: <web.contentment.controller.ContentmentRoot object at 0x7f40fe371738>

This is especially important for Python code, as 95% of repr() output for otherwise undescribed objects looks like that and makes the difference between a useful message and one which conveys no meaning. Interestingly, this is a problem with the web interface as well.

Rework the alias behaviour

Right now, aliases are used to select an application among the linked application.

A possible replacement:

  • remove --alias
  • replace it with --application, which can be an app_id, the application name, or an alias
    Using the app_id would allow to disambiguate the linked applications if they have the same name or alias (but the alias would still be the recommended way to disambiguate, as well as being the most convenient)

See #81

Consistent naming for organisations, addons, apps.

Before

clever create -o <org_id> <app_name>
clever link <org_id>/<app_name>
clever addon link <addon_id>

After

clever create [-o (<org_id>|<org_name)] <app_name>
clever link [-o (<org_id>|<org_name>)] (<app_id>|<app_name>)
clever service link-addon (<addon_id>|<addon_name>)
clever service link-app (<app_id>|<app_name>)

That would fix #51.
The clever service stuff will happen in #55

Simplify the creation of new apps

It would be nice if the creation of a new app could be as simple as linking an existing app.

- clever create -t node -o orga_<uuid> app-name
+ clever create -t node orga-name/app-name

Integrate the new service dependencies topology manager

Move clever addon link, clever addon unlink to clever service link-addon and clever service unlink-addon, add clever service link-app and clever service unlink-app, and make link-addon and unlink-addon work with names instead of ids.

Keep clever addon create and clever addon remove as they exist now.

Add a --exposed flag clever env <command> for exposed configuration.

Thoughts?

Issue when trying to deploy a new app

When trying to deploy a newly created app, I got this error:

▶ clever deploy
Pushing source code to Clever-Cloud.
[ERROR] [Error: Reference 'refs/remotes/test-app-demo-nodejs/master/HEAD' not found]

Support for webhooks

Webhooks can be registered on the notification API, each webhook has the following shape:

{
   owner_id: <user_id> or <org_id>, // the owner of the hook (user or organisation)
   urls: [ {body_format: "raw" or "slack", url: <url>], // one or more URLs to call when events happen
   scope: [<user_id or org_id or app_id or addon_id>],// the entities we're interested in
   events: [<event type>] // the events we're interested in
}

It's a bit hard to map that to a CLI interface without ending up with something bloated, so I think the best way is to find a subset that can be cleanly mapped to a cli interface, eg

# list the active notifications
clever notifications [--org <org_id>]

# create a hook with only one url
clever notifications [--org <org_id>] add \
   [--format <format>] \ # default: raw
   [--event <event_type>] \ # array, nothing means all events
   [--entity <app / addon>] \ #array, nothing means the whole owner
   <url>

# remove a hook
clever notifications [--org <org_id>] remove <hook_id>

It's in no way complete, but it's a good starting point. Thoughts @urcadox @BlackYoup ?

clever config ?

On first run on a clean install, any invocation of clever will throw an exception, for environment vars and/or configuration file being not defined.

For instance:

$ clever -v login
[INFO] [env] API_HOST was not defined, using default
[INFO] [env] LOG_URL was not defined, using default
[INFO] [env] EVENT_URL was not defined, using default
[INFO] [env] OAUTH_CONSUMER_KEY was not defined, using default
[INFO] [env] OAUTH_CONSUMER_SECRET was not defined, using default
[INFO] [env] CONFIGURATION_FILE was not defined, using default
[INFO] [env] CONSOLE_TOKEN_URL was not defined, using default
[INFO] [env] CLEVER_CONFIGURATION_DIR was not defined, using default
[INFO] [env] APP_CONFIGURATION_FILE was not defined, using default
[DEBUG] Load configuration from /Users/rda/.config/clever-cloud
/usr/local/lib/node_modules/clever-tools/node_modules/baconjs/dist/Bacon.js:1257
        throw e;
              ^
TypeError: undefined is not a function
    at /usr/local/lib/node_modules/clever-tools/src/models/configuration.js:45:12

It looks like it expects at least an empty JSON hash in the configuration file, a manual echo "{}" > ~/.config/clever-cloud fixes the issue.

Thanks!

Node v4.x is not supported

Looks like I can't make clever deploy and clever status commands work in the 0.3.2 version.

Here is the error I get:

▶ clever deploy
module.js:338
    throw err;
    ^   

Error: Cannot find module '../build/Debug/nodegit.node'
    at Function.Module._resolveFilename (module.js:336:15)
    at Function.Module._load (module.js:286:25)
    at Module.require (module.js:365:17)
    at require (module.js:384:17)
    at Object.<anonymous> (/home/urcadox/.npm_install/lib/node_modules/clever-tools/node_modules/nodegit/lib/nodegit.js:16:12)
    at Module._compile (module.js:434:26)
    at Object.Module._extensions..js (module.js:452:10)
    at Module.load (module.js:355:32)
    at Function.Module._load (module.js:310:12)
    at Module.require (module.js:365:17)
    at require (module.js:384:17)
    at Object.<anonymous> (/home/urcadox/.npm_install/lib/node_modules/clever-tools/src/models/git.js:4:15)
    at Module._compile (module.js:434:26)
    at Object.Module._extensions..js (module.js:452:10)
    at Module.load (module.js:355:32)
    at Function.Module._load (module.js:310:12)

I tried on my usual dev machine and on another on which I never installed clever-tools before.

clever unlink not working

Hi!

I tried to unlink an application I deleted from the web dashboard using

clever unlink app_58fc0dc3-04e7-4045-8416-95a3317a4a14

but when I run clever applications the app is still here.

$ clever applications
Application ——
  alias: ——
  id: app_58fc0dc3-04e7-4045-8416-95a3317a4a14
  deployment url: ——

Application ——
  alias: ——
  id: app_cea68d53-65e2-41e2-82fe-7fe95805b887
  deployment url: ——

clever statusis also saying to use a command that do not exist clever list

$ clever status
[ERROR] Several applications are linked. You can specify one with the `--alias` option. Run `clever list` to list linked applications. Available aliases: ——, ——

/bin/env not found in postinstall.sh

In scripts/, postinstall.sh uses /bin/env sh as an interpreter (and breaks, at least on OSX), whereas the two other scripts use /usr/bin/env sh. Is there are specific reason for the difference?

Edit application config with `clever config`

For now: name, description, zero-downtime deployment, sticky sessions, dedicated build instances, cancel on push.

clever config set name <name>
clever config set description <description>
clever config set zero-downtime (true|false)
clever config set sticky-sessions (true|false)
clever config set dedicated-build (false|<flavor>)
clever config set cancel-on-push (true|false)

It could also be done with flags, but that could get messy. Thoughts?

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.