Giter VIP home page Giter VIP logo

cozy-dev's Introduction

Cozy Dev

Cozy Dev is a tool for Cozy Web Application developers. It makes easy to start with building an application for the Cozy Cloud Platform.

npm install cozy-dev -g
cozy new myapp --github myaccount
cd myapp

Add some features, then:

cozy-dev deploy

Requirements

Cozy Dev requires:

Managing your virtual machine

Cozy Dev helps you to manage a virtual machine through Vagrant.

cozy-dev vm:init
cozy-dev vm:start

cozy-dev vm:stop

More information about CozyCloud and virtual machines in the documentation.

Hack

Get sources:

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

Run:

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

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

cake build

License

Cozy Manager 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-dev's People

Contributors

aenario avatar bnjbvr avatar clochix avatar espitall avatar fflorent avatar frankrousseau avatar jsilvestre avatar m4dz avatar maxlath avatar nono avatar phyks avatar poupotte avatar

Stargazers

 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

cozy-dev's Issues

Prevent destroy basebox when destroying VM

Sometimes, we need to trash and bootstrap a clean VM (especially when doing some hard tests on the DS). I'm used to vm:destroy and vm:init again, but the destroy action also vaccum the basebox from the Vagrant cache.

Can we add an option (-k | --keep) that'll flush the vm but keep the basebox to prevent an extra re-download of the basebox at next vm:init?

cozy-dev deploy should check the VM is running

Here is the error message (my VM is up and running):

cozy-dev    | The provider for this Vagrant-managed machine is reporting that it
is not yet ready for SSH. Depending on your provider this can carry
different meanings. Make sure your machine is created and running and
try again. Additionally, check the output of `vagrant status` to verify
that the machine is in the state that you expect. If you continue to
get this error message, please view the documentation for the provider
you're using.

after installation, cozy-dev doesn't work

STR

$ sudo npm install -g cozy-dev
$ cozy-dev

Observed

module.js:340
    throw err;
          ^
Error: Cannot find module '/usr/local/lib/node_modules/cozy-dev/src/main'
    at Function.Module._resolveFilename (module.js:338:15)
    at Function.Module._load (module.js:280:25)
    at Module.require (module.js:364:17)
    at require (module.js:380:17)
    at Object.<anonymous> (/usr/local/lib/node_modules/cozy-dev/bin/cozy:9:1)
    at Module._compile (module.js:456:26)
    at Object.Module._extensions..js (module.js:474:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
    at Function.Module.runMain (module.js:497:10)

Add mailcatcher to VM dev

Hi,

as talked with @poupotte, it could be useful to have a tool to test the mails sent by the cozy platform during development. I'm using mailcatcher to do this in many projects. It's a ruby app that simulates a sendmail service on the host and catch all sent mails to display them in a dead-simple webmail interface.

Steps to install:

  1. install ruby > 1.9.1 and sqlite-dev libs:
apt-get install ruby1.9.3 libsqlite3-dev
  1. install mailcatcher using gem:
gem1.9.3 install mailcatcher --no-ri --no-rdoc

Steps to run:

We should start the mailcatchr app with supervisor so it will always be accessible

[program:mailcatcher]
autorestart=true
command=/usr/local/bin/mailcatcher
    --http-ip=0.0.0.0
    --smtp-port=25
    --no-quit
    --foreground
redirect_stderr=true
user=root

We also need a new forwarding rule to access the mailcatcher web interface in the Vagrantfile:

  config.vm.network :forwarded_port, guest: 1080, host: 1080 # Mailcatcher

Thanks, it'll help us a lot for debugging mailings ๐Ÿ˜„!

error when "vagrant up"

vagrant up end with :

The following SSH command responded with a non-zero exit status.
Vagrant assumes that this means the command failed!
/sbin/ifup eth1
Stdout from the command:

Stderr from the command:
stdin: is not a tty
/etc/network/interfaces:51: interface eth2 declared allow-auto twice
/sbin/ifup: couldn't read interfaces file "/etc/network/interfaces"

When I run cozy-dev vm:start, I have no error message, but I think that the process stop at this moment also because the shared folder is not set.

In order to fix this I modified my VagrantFile commenting :
#config.vm.network :private_network, ip: "192.168.50.4"
and it works :-)

Explicitly require virtualization (BIOS setting) in set up dev env doc

I'm opening this issue in order to document the solution to a common problem encountered by persons trying to set up their dev environment. I am sorry if this is not the right place for this... (maybe cozy-docs?)

If your VM does not start (timeout at cozy-dev vm:start) it may be because virtualization is not activated on your machine.
This is easy to spot, start virtualbox and look at the general settings of the machine.
Go to settings->General->Basic->Version
If only 32bits versions are available, then virtualization is not activated on your CPU.
The cozy virtual image requires 64bit

To activate it, the first answer of this post is very clear:
http://askubuntu.com/questions/256792/how-do-i-enable-hardware-virtualization-technology-vt-x-for-use-in-virtualbox

Vagrantfile is not found when downloading it

After cozy dev:init, the Vagrantfile contains "Not Found", which isn't valid content.

2 things to be improved here in vagrant.coffee, importVagrantFile:

  1. the status should be checked: we actually hit a 404 but no err is set, so the content of the 404 page "Not Found" is saved into the Vagrantfile.
  2. the request header "Accepts" of the request shouldn't be set to json but to /, or plain text, as it is. Maybe request-json shouldn't be used for that purpose.

I don't have time to fix it now, so I will just propose a workaround in the meanwhile: download https://raw.githubusercontent.com/cozy/cozy-setup/master/dev/Vagrantfile by hand and save it locally.

vm:update-image should destroy all boxes

Got this message when running cozy-dev vm:update-image:

You requested to remove the box 'cozycloud/cozy-dev' with provider
'virtualbox'. This box has multiple versions. You must
explicitly specify which version you want to remove with
the `--box-version` flag. The available versions for this
box are:

 * 0.8.0
 * 0.9.0

[Draft] Improvements

I suggest we list here the improvements we want to see in order to test feasibility and just get them done if possible.

  • better support for Windows / share folder (see #26)
  • better development workflow :
cozy-dev new myapp --coffee
cd myapp/
cozy-dev start myapp # start a nodemon in /vagrant/myapp, create authorization and stuff
# log is displayed here OR it's available somewhere else (e.g. cozy-dev log == cozy-monitor log but for /vagrant/app/log/development.log)
# brunch must still be started in another terminal
  • rename "dev:*" commands to be easier to understand/use
  • rename "light-update" command to "update"
  • doesn't depend on Github anymore, can use any Git provider (see #17)
  • proxy support (well that's a more general issue related to the platform itself too) (see #20)

request-json 0.3.4 prevents from downloading Vagrantfile

I couldn't run cozy-dev dev:start correctly because of an issue when downloading the Vagrantfile file from github.
Indeed, the command cozy-dev dev:init created that file, but its content was simply "Not found".

After having investigated, it looks like the version of request-json (0.3.4) used by this project contains a bug that is fixed in more recent versions, and which is the cause of this issue. This bug adds two HTTP headers to the request ("authorization" and "x-auth-token"), both set to "undefined".

How about upgrading the request-json API?

Florent

cozy-dev deploy with client-side apps

Hi,

I am trying to use cozy-dev with a client-side app. As far as I understood the deploy documentation, I should run

$ cozy-dev deploy dist

from the root of my application (typically the root of https://github.com/Phyks/cozy-RSVP) and where dist is the place where my built files reside in my app folder.

However, I get a

path.js:7
    throw new TypeError('Path must be a string. Received ' + inspect(path));
    ^

TypeError: Path must be a string. Received null
  at assertPath (path.js:7:11)
  at Object.relative (path.js:1228:5)
  at /home/phyks/Code/cozy/cozy-dev/lib/application.js:306:39
  at /home/phyks/Code/cozy/cozy-dev/node_modules/parentpath/lib/parentpath.js:45:13
  at FSReqWrap.oncomplete (fs.js:123:15)

The app is installed in my cozy-dev VM, but gets a 404 not found whenever I try to open it.

Thanks

Add a manifest generator

It would be cool to have a command that generates a package.json, especially for "static" applications.

vagrant minimum version fails version check

When the installed version of vagrant exactly matches the minimum version (currently 1.5.0), the version check fails and vm:init exits with the error, "cozy-dev requires Vagrant 1.5.0 or later."

Deploy command looks broken

A user reports that running the deploy command at the end of the tutorial leads to an error. It's related to the configuration file. I don't have the exact error message. This bug requires more investigation.

cozy-dev dev:init fails to add the box properly

Hello,

When running the cozy-dev dev:init command, I am faced to this error message:

This command was not invoked properly. The help for this command is
available below.

Usage: vagrant box add <name> <url> [--provider provider] [-h]

I could solve the issue with this patch in lib/vagrant.js:

@@ -18,6 +18,7 @@

     function VagrantManager() {
       this.baseBoxName = 'cozycloud/cozy-dev';
+      this.boxUrl = "https://vagrantcloud.com/cozycloud/cozy-dev/version/1/provider/virtualbox.box";
       this.docURL = "http://cozy.io/hack/getting-started/setup-environment.html";
     }

@@ -41,7 +42,7 @@
       cmds = [];
       cmds.push({
         name: 'vagrant',
-        args: ['box', 'add', this.baseBoxName]
+        args: ['box', 'add', this.baseBoxName, this.boxUrl]
       });
       console.log(cmds);
       return helpers.spawnUntilEmpty(cmds, function() {

Note: I use Vagrant 1.4.3.

Hope it could help.

Florent

status and install commands fail

For memo. it looks like the host is not well set on the clien when running the status command.

url.js:107
    throw new TypeError("Parameter 'url' must be a string, not " + typeof url)
          ^
TypeError: Parameter 'url' must be a string, not undefined
  at Url.parse (url.js:107:11)
  at urlParse (url.js:101:5)
  at Object.urlResolve [as resolve] (url.js:405:10)

vm:destroy does not work

~/Source/cozy-dev 673 $cozy-dev vm:destroy
? You are about to remove the virtual machine from your computer. All data will be lost and a new import will be required if you want to use the VM again: Yesn) Y

/usr/local/lib/node_modules/cozy-dev/lib/main.js:273
        if (answers.hasConfirm) {
            ^
ReferenceError: answers is not defined
    at async.waterfall.msg (/usr/local/lib/node_modules/cozy-dev/lib/main.js:273:13)
    at fn (/usr/local/lib/node_modules/cozy-dev/node_modules/async/lib/async.js:641:34)
    at Object._onImmediate (/usr/local/lib/node_modules/cozy-dev/node_modules/async/lib/async.js:557:34)
    at processImmediate [as _immediateCallback] (timers.js:345:15)

cozy-dev 1.0.11
OSX 10.9.5
Vagrant 1.5.1
VirtualBox 4.3.0

Adding commands to manage fixtures

During app development I often encounter the same issue: adding data fixtures, delete data fixtures and eventually delete views (see https://github.com/mycozycloud/cozy-data-system/wiki/Api#api-request for the call themselves).

What I would like to have:

  • cozy dev:fixtures:add path_to_fixtures_file
  • cozy dev:fixtures:delete doctype_name
  • cozy dev:fixtures:delete-request doctype_name request_name

The fixtures file format is still to be determined but I bet we can find something simple and powerful.

Also, I think the fixtures addition/deletion should be handled in a npm package so we can use it in tests.

cozy-dev proxify doesn't work

Used as described https://dev.cozy.io/clientsideapp.html#make-a-client-side-quot-hello-world-application-quot , in a client side app (mesinfosdataplayground)

toto@monpc$ cozy-dev proxify http://localhost:9104
? Cozy password for http://localhost:9104: *******
info - profixy	 | SHELL FOR 
readline.js:930
            throw err;
            ^

TypeError: Cannot read property 'url' of undefined
    at Object.module.exports.start (/home/jacquarg/opt/node/lib/node_modules/cozy-dev/lib/static-proxy.js:169:29)
    at /home/jacquarg/opt/node/lib/node_modules/cozy-dev/lib/main.js:195:26
    at PromptUI.completed (/home/jacquarg/opt/node/lib/node_modules/cozy-dev/lib/helpers.js:87:16)
    at PromptUI.onCompletion (/home/jacquarg/opt/node/lib/node_modules/cozy-dev/node_modules/inquirer/lib/ui/prompt.js:69:10)
    at AnonymousObserver.Rx.AnonymousObserver.AnonymousObserver.completed (/home/jacquarg/opt/node/lib/node_modules/cozy-dev/node_modules/inquirer/node_modules/rx/dist/rx.js:1793:12)
    at AnonymousObserver.Rx.internals.AbstractObserver.AbstractObserver.onCompleted (/home/jacquarg/opt/node/lib/node_modules/cozy-dev/node_modules/inquirer/node_modules/rx/dist/rx.js:1730:14)
    at AnonymousObserver.tryCatcher (/home/jacquarg/opt/node/lib/node_modules/cozy-dev/node_modules/inquirer/node_modules/rx/dist/rx.js:567:29)
    at AutoDetachObserverPrototype.completed (/home/jacquarg/opt/node/lib/node_modules/cozy-dev/node_modules/inquirer/node_modules/rx/dist/rx.js:5288:56)
    at AutoDetachObserver.Rx.internals.AbstractObserver.AbstractObserver.onCompleted (/home/jacquarg/opt/node/lib/node_modules/cozy-dev/node_modules/inquirer/node_modules/rx/dist/rx.js:1730:14)
    at InnerObserver.onCompleted (/home/jacquarg/opt/node/lib/node_modules/cozy-dev/node_modules/inquirer/node_modules/rx/dist/rx.js:3425:65)

deploy should have a slug parameter

We should be able to set a custom slug, for say running a File application in dev mode, while still being able to browse the "official" Files application, installed in the Cozy.

Conflicting ports with couchdb

There is a conflict between the ports used by cozy dev:start and the couchdb service, required for running cozy-fuse.

Better support shared folder

These bugs are vagrant-related, we need to investigate if they can be fixed with vagrant 1.5 and its synced folder. In the meantime this can be used for troubleshooting.

  • Can't install americano-cozy in a folder shared with Windows, the path get too long for americano-cozy/jugglingdb-adapter/request-json/request/formidable/delayed-stream/test/...
  • Bandaid : manually install jugglingdb-cozy-adapter at the top level
  • Some node module failled to install due to symlinks unavailable in the VM shared folder
  • Bandait : --no-bin-links options solve most of them but not all

Stop vm:start when there is a problem

For example, if a couchdb is started on host, vm:start log :

==> default: Clearing any previously set forwarded ports...
Vagrant cannot forward the specified ports on this VM, since they
would collide with some other application that is already listening
on these ports. The forwarded port to 5984 is already in use
on the host machine.

To fix this, modify your current projects Vagrantfile to use another
port. Example, where '1234' would be replaced by a unique host port:

  config.vm.network :forwarded_port, guest: 5984, host: 1234

Sometimes, Vagrant will attempt to auto-correct this for you. In this
case, Vagrant was unable to. This is usually because the guest machine
is in a state which doesn't allow modifying port forwarding.

After that, command continues (check status, check version, ....). Command should be stopped.

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.