Giter VIP home page Giter VIP logo

cozy-monitor's Introduction

Cozy Monitor

Cozy Monitor is a tool to manage your Cozy Platform from the command line.

Install

Install it via NPM

npm install cozy-monitor -g

Features

Run following command to see all available actions:

cozy-monitor --help

Or browse the online documentation.

Contribution

You can contribute to Cozy Monitor in many ways:

  • Pick up an issue and solve it.
  • Improve displayed messages.
  • Write tests.

Hack

Get sources:

git clone https://github.com/cozy/cozy-monitor.git

Run:

cd cozy-monitor
chmod +x bin/cozy-monitor
./bin/cozy-monitor

Each modification requires a new build, here is how to run a build:

npm run build

Make sure your modifications pass linting:

npm run lint

Tests

Build Status

To run tests type the following command into the Cozy Home folder:

npm run test

License

Cozy Monitor is developed by Cozy Cloud and distributed under the LGPL v3 license.

What is Cozy?

Cozy Logo

Cozy is a platform that brings all your web services in the same private space. With it, your web apps and your devices can share data easily, providing you with a new experience. You can install Cozy on your own hardware where no one profiles you.

Community

You can reach the Cozy Community by:

  • Chatting with us on IRC #cozycloud on irc.freenode.net
  • Posting on our Forum
  • Posting issues on the Github repos
  • Mentioning us on Twitter

cozy-monitor's People

Contributors

aenario avatar aylinkocoglu avatar bnjbvr avatar clochix avatar felix-lambert avatar frankrousseau avatar jsilvestre avatar kosssi avatar nono avatar obigroup avatar paultranvan avatar poupotte avatar

Stargazers

 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

cozy-monitor's Issues

Error with reinstall-missing-apps + branch

ReferenceError: options is not defined
  at /usr/lib/node_modules/cozy-monitor/lib/application.js:387:38
  at parseBody (/usr/lib/node_modules/cozy-monitor/node_modules/cozy-clients/node_modules/request-json/main.js:35:12)
  at Request._callback (/usr/lib/node_modules/cozy-monitor/node_modules/cozy-clients/node_modules/request-json/main.js:96:18)
  at Request.self.callback (/usr/lib/node_modules/cozy-monitor/node_modules/cozy-clients/node_modules/request-json/node_modules/request/request.js:121:22)
  at Request.emit (events.js:98:17)
  at Request.<anonymous> (/usr/lib/node_modules/cozy-monitor/node_modules/cozy-clients/node_modules/request-json/node_modules/request/request.js:978:14)
  at Request.emit (events.js:117:20)
  at IncomingMessage.<anonymous> (/usr/lib/node_modules/cozy-monitor/node_modules/cozy-clients/node_modules/request-json/node_modules/request/request.js:929:12)
  at IncomingMessage.emit (events.js:117:20)
  at _stream_readable.js:944:16
  at process._tickCallback (node.js:448:13)

manifest.repository.branch = options.branch

reset-proxy command is broken

Reported by a French user:

Tout est lancer correctement semble-t-il par contre lorsque je fais un reset-proxy, j'obtiens l'erreur suivante :

sudo cozy-monitor reset-proxy

info - Reset proxy routes
ReferenceError: statusClient is not defined
at Command. (/usr/local/lib/node_modules/cozy-monitor/lib/main.js:520:5)
at Command. (/usr/local/lib/node_modules/cozy-monitor/node_modules/commander/lib/commander.js:235:8)
at Command.EventEmitter.emit (events.js:98:17)
at Command.parseArgs (/usr/local/lib/node_modules/cozy-monitor/node_modules/commander/lib/commander.js:406:12)
at Command.parse (/usr/local/lib/node_modules/cozy-monitor/node_modules/commander/lib/commander.js:352:15)
at Object. (/usr/local/lib/node_modules/cozy-monitor/lib/main.js:535:11)
at Object. (/usr/local/lib/node_modules/cozy-monitor/lib/main.js:541:4)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (/usr/local/lib/node_modules/coffee-script/lib/coffee-script/register.js:45:36)
at Function.Module._load (module.js:312:12)
at Module.require (module.js:364:17)
at require (module.js:380:17)
at Object. (/usr/local/lib/node_modules/cozy-monitor/bin/cozy-monitor:10:3)
at Object. (/usr/local/lib/node_modules/cozy-monitor/bin/cozy-monitor:12:4)
at Module._compile (module.js:456:26)

cozy-monitor uninstall does not work

When I try to uninstall an application with the cozy-monitor, I got the following:

vagrant@precise32:~/isen-monitor$ cozy-monitor uninstall konnectors
info - Uninstall started for konnectors...
error - An error occured:
Application not found
Uninstall home failed for konnectors.

Default branch of applications in the Market is ignored.

In the market, we can define a default branch for application (don't know if we can use the same field in application manifest), but cozy-monitor install seems to ignore this field.

Example: the shout application. We should install the cozy branch, as specified in the market registry, but cozy-monitor install shout installs the master branch, and therefore fails.

Remove notifications after update

When we update an application using cozy-monitor, we should remove the notification of available updates, like we do in the Home page.

Branch is not taken into account in `update` command

When I have a Home installed on a custom branch,
Then I try to update with cozy-monitor update home

Result:

cozy-monitor update home
info - Updating home...
error - An error occured:
error - Update failed for home.
[Error: Error: Command failed: From https://github.com/cozy/cozy-home
 * branch            master     -> FETCH_HEAD
]

And the application is not updated.

routes action don't show routes anymore

The output looks like:

Display proxy routes...
agenda => [object Object]
contacts => [object Object]
webdav => [object Object]

When the user expects to see the application ports.

Status command is broken

When I run the status command it keeps on failing:

cozy-monitor status
postfix: up
couch: up
controller: up
ds: up
home: up
proxy: up
index: up
error - An error occured:
error - Cannot display status
[Error: Cannot retrieve apps]

Give an option for setting the installation timeout

Users complain that sometimes, Kresus is quite long to install on Raspberry Pi. As a matter of fact, it'd be nice if the utility line had an option to either allow setting the installation timeout, or even better, just remove this timeout.

Give an option for verbose mode

Hello, this would be convenient to have a verbose option when installing (or other) an app, instead of checking cozy-controller log. This verbos option could also include the stdout of other commands launched during the install (npm as an exemple).
Thx

Error: Parsing error : Unexpected token T, body= Token is not correct

Trying to login I get

{"error":"invalid json"}

On another browser it works ok, so I go back to Firefox and go to History and do "forget about this site" on my cozy URL to try out removing cookies that would be problem. This seems to solve it and I can enter the cozy dashboard. I then go to status to try to upgrade my stack, and when I do, it gives me the error message and I'm back to my login problem.

So I think I can upgrade via the command line tools and this is what I get :

root@059f5cab7f31:~# cozy-monitor update-all-cozy-stack              
info - Update all cozy stack ...
error - An error occured:
error - Update all cozy stack failed.
[Error: Error: Parsing error : Unexpected token T, body= 
 Token is not correct]

Versions :

# cozy-monitor versions

Cozy Stack:
controller: 2.0.31
data-system: 2.0.7
home: 2.0.10
proxy: 2.1.1
indexer: 1.0.0
monitor: 1.2.28

Other applications: 
blog: 1.0.0
bookmarks: 0.9.6
calendar: 1.0.23
contacts: 1.1.9
emails: 0.9.10
feeds: 1.4.1
files: 1.1.9
konnectors: 0.3.2
kyou: 0.2.1
notes: 1.0.1
photos: 1.0.14
remotestorage: 0.1.1
sync: 1.0.7


Display outdated applications

The version subcommand should display applications for which an update is available (color + version of the available update + keyword to allow grepping command output).

Error in npm start script not caught on install of application

When installing an application with cozy-monitor, if an error occurs during the run of start script of the manifest (eg : application not built, so npm start just fails), the error is no caught, and the command will only end when the timeout expires, or never if the timeout is disactivated

ds -> data-system in "cozy-monitor status"

Hello,

when I made a "cozy-monitor status" I would like to have "data-system" instead "ds":

root@cozy-test-nlz:~# cozy-monitor status
postfix: up
couch: up
controller: up
data-system: up
home: up
proxy: up
index: up

Add '.git' in repo url

In cozy-monitor install with option -r, it should be great to add .git at the end of url if user forgets it.

Installing applications from Marketplace is broken

cozy-monitor install data-system
info - Install started for data-system...
TypeError: Cannot read property 'url' of null
  at msgRepoGit (/usr/lib/node_modules/cozy-monitor/lib/stack_application.js:31:86)
  at /usr/lib/node_modules/cozy-monitor/lib/stack_application.js:72:29
  at parseBody (/usr/lib/node_modules/cozy-monitor/node_modules/cozy-clients/node_modules/request-json/main.js:35:12)
  at Request._callback (/usr/lib/node_modules/cozy-monitor/node_modules/cozy-clients/node_modules/request-json/main.js:96:18)
  at Request.self.callback (/usr/lib/node_modules/cozy-monitor/node_modules/cozy-clients/node_modules/request-json/node_modules/request/request.js:121:22)
  at Request.emit (events.js:98:17)
  at Request.<anonymous> (/usr/lib/node_modules/cozy-monitor/node_modules/cozy-clients/node_modules/request-json/node_modules/request/request.js:978:14)
  at Request.emit (events.js:117:20)
  at IncomingMessage.<anonymous> (/usr/lib/node_modules/cozy-monitor/node_modules/cozy-clients/node_modules/request-json/node_modules/request/request.js:929:12)
  at IncomingMessage.emit (events.js:117:20)
  at _stream_readable.js:944:16
  at process._tickCallback (node.js:442:13)

Cannot use behind a proxy

Hi,

At work, I must use a connection behind a proxy.
But cozy-monitor seems to use "request-json-light" that is the same lib as "request-json" without "request" dependencies. Then proxy settings cannot be applied.

Is there a way to use cozy-monitor behind a proxy?

Errors should be more explicit

Hi,
I recently had an install failing with this output:

[root@scw-52f5ac ~]# cozy-monitor install data-system
info - Install started for data-system...
error - An error occured:
error - Install failed for data-system.
[Error: data-system CANT START]
[root@scw-52f5ac ~]# 

I'm not surprised of getting an error (since I'm currently working on the Archlinux support), but "Install failed" isn't really explicit.

Right now, the only way to find an explicit error is in the controller's log, which is quite hard to find if you don't know where to look for it.

I suggest two solutions:

  • Adding an option to cozy-monitor for a verbose mode (as suggested by ZeHiro in #86)
  • Adding a line to the error display that would look like this: For more infos, please check the logs at [logs URL] ([logs URL] being /usr/local/var/log/cozy for me).

cozy-monitor status --raw

Hello,

I would like to have a "cozy-monitor status --raw" (or another parameter, it doesn't care) to have an output without color:

postfix: up
couch: up
controller: up
ds: up
home: up
proxy: up
index: up
sync: up
calendar: up
contacts: up

It's more easier for scripting. Thanks.

curlcouch truncate large results

It seems that curlcouch is truncating the result of the underlying curl request:

$ cozy-monitor curlcouch _design/contact/_view/all | wc -l
375
$ curl -s $(sed -n '1,1p' /etc/cozy/couchdb.login):$(sed -n '2,1p' /etc/cozy/couchdb.login)@127.0.0.1:5984/cozy/_design/contact/_view/all | wc -l
6751

Unreadable stacktrace

When an error occured, the stacktrace is not well displayed (carriage return are not displayed properly). It makes installation/update/uninstall debugging harder.

View compaction: TypeError: Request path contains unescaped characters.

When trying to compact all view, a user get the following error message:

> cozy-monitor compact-all-views
info - Start views compaction on cozy...
_http_client.js:50
    throw new TypeError('Request path contains unescaped characters.');
    ^

TypeError: Request path contains unescaped characters.
    at new ClientRequest (_http_client.js:50:11)
    at Object.exports.request (http.js:31:10)
    at playRequest (/usr/local/lib/node_modules/cozy-monitor/node_modules/request-json-light/main.js:101:29)
    at Object.module.exports.post (/usr/local/lib/node_modules/cozy-monitor/node_modules/request-json-light/main.js:138:12)
    at JsonClient.post (/usr/local/lib/node_modules/cozy-monitor/node_modules/request-json-light/main.js:213:27)
    at module.exports.compactViews (/usr/local/lib/node_modules/cozy-monitor/lib/database.js:145:22)
    at /usr/local/lib/node_modules/cozy-monitor/lib/database.js:167:16
    at /usr/local/lib/node_modules/cozy-monitor/node_modules/async/lib/async.js:181:20
    at iterate (/usr/local/lib/node_modules/cozy-monitor/node_modules/async/lib/async.js:262:13)
    at /usr/local/lib/node_modules/cozy-monitor/node_modules/async/lib/async.js:274:29

Wrong message for installation failed

cozy-monitor install <app>
    info - Install started for <app>...
    error - An error occured:
    error - Install failed for <app>.
    [Error: Install home failed for <app>.
    Default git repo https://github.com/cozy/cozy-<app>.git doesn't exist. 

Start command is broken

Start command doesn't give acces rights anymore. So the application cannot work properly.

Use market for application installation

If user try to install an application without specific url, monitor should be retrieve its url in market instead of use default https://github.com/cozy/<app>.git.

cozy-monitor status errors

Improve errors for cozy-monitor status

Cant get app list is not accurate enough, it should debug the following cases :

  • couchdb.login doesnt exists / wrong chmod
  • controller doesnt have proper token vs DS
  • ect ...

Errors are displayed twice

When an installation fails, errors are displayed twice:

cozy-monitor install kresus -r https://github.com/bnjbvr/kresus@incoming
info - Install started for kresus...
error - An error occured:
error - An error occured:
error - Install failed for kresus.
error - Install failed for kresus.
[Error: Error: Expected application not listed in database after installation.]

Improve status display

To help users diagnose problems on their serveur, maybe could we add two sections in the output: stack and application (but I don't know if it won't break some of @nledez 's scripts)

cozy-monitor curlcouch

Something like

curl $(sed -n '1,1p' /etc/cozy/couchdb.login):$(sed -n '2,1p' /etc/cozy/couchdb.login)@127.0.0.1:5984/cozy

Cozy down, can't restart and cozy-monitor failed

Hello,

I have an instance since may be 2 months on my own server.

Since this morning ( or may be 1 or 2 days before), I can't access to cozy ( DavDroid failed, and error 504 Gateway timeout from Firefox )

On the system, I can't restart it :

# cozy-monitor restart-cozy-stack
info - Restart data-system...
error - An error occured:
error - Restart failed for data-system.

And monitor failed :

# cozy-monitor status
postfix: up
couch: down
controller: up
ds: down
home: up
proxy: up
index: up
error - An error occured:
error - Cannot display status
[Error: Cannot retrieve apps]

Any help will be appreciated... I don't understood how this could stop like this, only DavDroid use it, and I haven't made upgrades since 1 month...

# cozy-monitor version
1.2.20
# cozy-monitor versions

Cozy Stack:
controller: 2.0.24
data-system: 1.0.28
home: 1.0.42
proxy: 1.0.14
indexer: 1.0.0
monitor: 1.2.20

Other applications: 
error - Error when retrieving user application.

/usr/local/lib/node_modules/cozy-monitor/node_modules/async/lib/async.js:144
        if (!arr.length) {
                ^
TypeError: Cannot read property 'length' of undefined
  at Object.async.eachSeries (/usr/local/lib/node_modules/cozy-monitor/node_modules/async/lib/async.js:144:17)
  at /usr/local/lib/node_modules/cozy-monitor/lib/main.js:365:22
  at /usr/local/lib/node_modules/cozy-monitor/lib/application.js:147:16
  at parseBody (/usr/local/lib/node_modules/cozy-monitor/node_modules/request-json-light/main.js:74:10)
  at IncomingMessage.<anonymous> (/usr/local/lib/node_modules/cozy-monitor/node_modules/request-json-light/main.js:99:14)
  at IncomingMessage.EventEmitter.emit (events.js:117:20)
  at _stream_readable.js:920:16
  at process._tickCallback (node.js:415:13)

Regards

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.