GladysAssistant / Gladys

A privacy-first, open-source home assistant
https://gladysassistant.com
Apache License 2.0
2.57k stars 278 forks source link

install en mode dev avant le mode production ? #7

Closed ghost closed 9 years ago

ghost commented 9 years ago

bonjour,

j'ai essayer de m'installer ma petite gladys, mais il y a un truc byzarre dans la dit il est dit :

Gladys create automatically all the tables it needs. (only in development mode, not in production, so be sure to start Gladys one time in development mode before trying production mode).

et donc on fait comment pour démarrer le mode developement pour avoir la base de donnée ?

Pierre-Gilles commented 9 years ago

Tu lance juste Gladys avec la commande node app.js ou sails lift :)

ghost commented 9 years ago

nothing start ???

Issa[~/gladys] > ls api app.js assets config Gruntfile.js LICENSE.md mailtemplates music node_modules npm-debug.log package.json README.md rpi-install.sh tasks test update.js views voicecache Issa[~/gladys] > node app.js Issa[~/gladys] >

Pierre-Gilles commented 9 years ago

If you run Gladys on a Raspberry Pi first gen it can take a little time so start.

Otherwise do you exactly follow the instructions ? all NPM modules are installed without any errors ?

ghost commented 9 years ago

ok en fait j'essai d'installer gladys sur un ubuntu 14.04 lts. mais ça ne fonctionne pas.

quand je lancer no app.js, rien ne se passe :/

issa[~/gladys] > nodejs app.js To run an app using node app.js, you usually need to have a version of sails installed in the same directory as your app. To do that, run npm install sails

Alternatively, if you have sails installed globally (i.e. you did npm install -g sails), you can use sails lift. When you run sails lift, your app will still use a local ./node_modules/sails dependency if it exists, but if it doesn't, the app will run with the global sails instead!

et quand je fait npm install sails :

issa[~/gladys] > npm install sails npm http GET https://registry.npmjs.org/sails npm http 304 https://registry.npmjs.org/sails npm WARN engine sails@0.11.0: wanted: {"node":">= 0.10.0","npm":">= 1.4.0"} (current: {"node":"v0.10.25","npm":"1.3.10"})

sails@0.11.0 preinstall /home/Issa/gladys/node_modules/sails node ./lib/preinstall_npmcheck.js

npm WARN This failure might be due to the use of legacy binary "node" npm WARN For further explanations, please read /usr/share/doc/nodejs/README.Debian

npm ERR! weird error 1 npm ERR! not ok code 0

du coup je suis perdu la, comment installler gladys sur une ubuntu 14.04 lts ?

Pierre-Gilles commented 9 years ago

Le problème vient de ton installation de node.js ! Comme le dit l'erreur, "npm WARN This failure might be due to the use of legacy binary "node" ".

Essaie d'abord de faire fonctionne node.js, et installe ensuite Gladys. ( node.js en version 0.10.xx )

Je te conseille la lecture de ce post : http://stackoverflow.com/questions/21168141/can-not-install-packages-using-node-package-manager-in-ubuntu , ça devrait t'aider :)

ghost commented 9 years ago

no way to install it on a frech ubuntu 14.04 server lts :/ alwawys error :/

ghost commented 9 years ago

now have this !

gladys@gladys:~/gladys$ node app.js module.js:338 throw err; ^ Error: Cannot find module 'sails-util-mvcsloader' at Function.Module._resolveFilename (module.js:336:15) at Function.Module._load (module.js:278:25) at Module.require (module.js:365:17) at require (module.js:384:17) at Object.exampleHooks (/home/gladys/gladys/api/hooks/example/index.js:21:17) at bound (/home/gladys/gladys/node_modules/sails/node_modules/lodash/dist/lodash.js:729:21) at prepareHook (/home/gladys/gladys/node_modules/sails/lib/app/private/loadHooks.js:51:17) at /home/gladys/gladys/node_modules/sails/lib/app/private/loadHooks.js:156:13 at /home/gladys/gladys/node_modules/sails/node_modules/async/lib/async.js:122:13 at _each (/home/gladys/gladys/node_modules/sails/node_modules/async/lib/async.js:46:13) at Object.async.each (/home/gladys/gladys/node_modules/sails/node_modules/async/lib/async.js:121:9) at Object.async.series.prepare (/home/gladys/gladys/node_modules/sails/lib/app/private/loadHooks.js:155:17) at /home/gladys/gladys/node_modules/sails/node_modules/async/lib/async.js:620:25 at iterate (/home/gladys/gladys/node_modules/sails/node_modules/async/lib/async.js:146:13) at /home/gladys/gladys/node_modules/sails/node_modules/async/lib/async.js:157:25 at /home/gladys/gladys/node_modules/sails/node_modules/async/lib/async.js:626:21

so now i want prepare a virtual machine to share it to all

Pierre-Gilles commented 9 years ago

Error: Cannot find module 'sails-util-mvcsloader'

=> means that you have to install sails-util-mvcsloader, so :

npm install sails-util-mvcsloader :)

ghost commented 9 years ago

ok voici tout les modules à installer : npm install async request googleapis ejs google-contacts googlemaps player sails-util-mvcsloader

par contre maintenant j'ai cette erreur :

root@gladys:~/gladys# node app.js info: User hook policies loaded from /home/gladys/gladys/api/hooks/example/policies. info: User hook config loaded from /home/gladys/gladys/api/hooks/example/config. module.js:338 throw err; ^ Error: Cannot find module 'player' at Function.Module._resolveFilename (module.js:336:15) at Function.Module._load (module.js:278:25) at Module.require (module.js:365:17) at require (module.js:384:17) at Object. (/home/gladys/gladys/api/services/MusicService.js:17:15) at Module._compile (module.js:460:26) at Object.Module._extensions..js (module.js:478: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 /home/gladys/gladys/node_modules/sails/node_modules/include-all/index.js:129:29 at Array.forEach (native) at requireAll (/home/gladys/gladys/node_modules/sails/node_modules/include-all/index.js:44:9) at buildDictionary (/home/gladys/gladys/node_modules/sails/node_modules/sails-build-dictionary/index.js:68:14)

et donc j'install le player :+1:

root@gladys:~/gladys# npm install async request googleapis ejs google-contacts googlemaps player npm WARN deprecated jws@0.0.2: Security update: Versions below 3.0.0 are deprecated.

speaker@0.2.5 install /home/gladys/gladys/node_modules/player/node_modules/speaker node-gyp rebuild

make: entrant dans le répertoire « /home/gladys/gladys/node_modules/player/node_modules/speaker/build » CC(target) Release/obj.target/output/deps/mpg123/src/output/alsa.o ../deps/mpg123/src/output/alsa.c:19:28: fatal error: alsa/asoundlib.h: Aucun fichier ou dossier de ce type

include <alsa/asoundlib.h>

                        ^

compilation terminated. make: *\ [Release/obj.target/output/deps/mpg123/src/output/alsa.o] Erreur 1 make: quittant le répertoire « /home/gladys/gladys/node_modules/player/node_modules/speaker/build » gyp ERR! build error gyp ERR! stack Error: make failed with exit code: 2 gyp ERR! stack at ChildProcess.onExit (/home/gladys/.nvm/versions/v0.12.4/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:269:23) gyp ERR! stack at ChildProcess.emit (events.js:110:17) gyp ERR! stack at Process.ChildProcess._handle.onexit (child_process.js:1074:12) gyp ERR! System Linux 3.16.0-41-generic gyp ERR! command "node" "/home/gladys/.nvm/versions/v0.12.4/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild" gyp ERR! cwd /home/gladys/gladys/node_modules/player/node_modules/speaker gyp ERR! node -v v0.12.4 gyp ERR! node-gyp -v v1.0.3 gyp ERR! not ok npm WARN deprecated tap-consumer@0.0.1: This module is not supported. Please use 'tap' instead. npm WARN installMany tap-consumer was bundled with tap@0.3.3, but bundled package wasn't found in unpacked tree npm WARN deprecated tap-results@0.0.2: This module is not supported. Please use 'tap' instead.

lame@1.2.2 install /home/gladys/gladys/node_modules/player/node_modules/lame node-gyp rebuild

make: entrant dans le répertoire « /home/gladys/gladys/node_modules/player/node_modules/lame/build » deps/mpg123/test.target.mk:118: attention : écrasement des commandes pour la cible « Release/test » deps/lame/test.target.mk:126: attention : anciennes commandes ignorées pour la cible « Release/test » CC(target) Release/obj.target/mp3lame/deps/lame/libmp3lame/VbrTag.o CC(target) Release/obj.target/mp3lame/deps/lame/libmp3lame/bitstream.o ../deps/lame/libmp3lame/bitstream.c: In function ‘do_gain_analysis’: ../deps/lame/libmp3lame/bitstream.c:992:24: warning: unused variable ‘rov’ [-Wunused-variable] RpgResult_t *const rov = &gfc->ov_rpg; ^ ../deps/lame/libmp3lame/bitstream.c:991:32: warning: unused variable ‘rsv’ [-Wunused-variable]

../deps/lame/libmp3lame/vector/xmm_quantize_sub.c: In function ‘fht_SSE2’: ../deps/lame/libmp3lame/vector/xmm_quantize_sub.c:172:20: warning: variable ‘v_s2’ set but not used [-Wunused-but-set-variable] __m128 v_s2; ^ AR(target) Release/obj.target/deps/lame/liblamevectorroutines.a COPY Release/liblamevectorroutines.a CXX(target) Release/obj.target/bindings/src/bindings.o CXX(target) Release/obj.target/bindings/src/node_lame.o CXX(target) Release/obj.target/bindings/src/node_mpg123.o SOLINK_MODULE(target) Release/obj.target/bindings.node SOLINK_MODULE(target) Release/obj.target/bindings.node: Finished COPY Release/bindings.node make: quittant le répertoire « /home/gladys/gladys/node_modules/player/node_modules/lame/build » npm ERR! Linux 3.16.0-41-generic npm ERR! argv "/home/gladys/.nvm/versions/v0.12.4/bin/node" "/home/gladys/.nvm/versions/v0.12.4/bin/npm" "install" "async" "request" "googleapis" "ejs" "google-contacts" "googlemaps" "player" npm ERR! node v0.12.4 npm ERR! npm v2.10.1 npm ERR! code ELIFECYCLE

npm ERR! speaker@0.2.5 install: node-gyp rebuild npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the speaker@0.2.5 install script 'node-gyp rebuild'. npm ERR! This is most likely a problem with the speaker package, npm ERR! not with npm itself. npm ERR! Tell the author that this fails on your system: npm ERR! node-gyp rebuild npm ERR! You can get their info via: npm ERR! npm owner ls speaker npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request: npm ERR! /home/gladys/gladys/npm-debug.log

Pierre-Gilles commented 9 years ago

C'est normal, ta version de node est la "node v0.12.4", or Gladys tourne en node 0.10.xx pour justement ces problèmes de dépendances !

Il faut avoir node en version 0.10.xx :)

ghost commented 9 years ago

ouch,

je recommence mon install :/

ghost commented 9 years ago

ok what is wrong now ?

root@gladys:~/gladys# nvm use 0.10.38 Now using node v0.10.38 root@gladys:~/gladys# node app.js info: User hook policies loaded from /home/gladys/gladys/api/hooks/example/policies. info: User hook config loaded from /home/gladys/gladys/api/hooks/example/config.

module.js:340 throw err; ^ Error: Cannot find module 'player' 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. (/home/gladys/gladys/api/services/MusicService.js:17:15) 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 Module.require (module.js:364:17) at require (module.js:380:17) at /home/gladys/gladys/node_modules/sails/node_modules/include-all/index.js:129:29 at Array.forEach (native) at requireAll (/home/gladys/gladys/node_modules/sails/node_modules/include-all/index.js:44:9) at buildDictionary (/home/gladys/gladys/node_modules/sails/node_modules/sails-build-dictionary/index.js:68:14) at Function.module.exports.optional (/home/gladys/gladys/node_modules/sails/node_modules/sails-build-dictionary/index.js:160:9)

ghost commented 9 years ago

So i m restart installation from frech ubuntu server 14.04 lts install

1> Update the system

sudo apt-get update
sudo apt-get upgrade 
sudo apt-get dist-upgrade

2> install preequis :

sudo apt-get install build-essential git libssl-dev libasound2-dev

3> Install nodeJs vielle version car la nouvelle version n'est pas compatible (c'est pas problématique ça ???? )

curl https://raw.githubusercontent.com/creationix/nvm/v0.16.1/install.sh | sh
source ~/.profile
nvm ls-remote
nvm install 0.10.39
nvm use 0.10.39
node -v
npm install sails-util-mvcsloader

4> Install Gladys

# Clone the repository
$ git clone https://github.com/GladysProject/Gladys.git gladys
$ cd gladys

# Install NPM dependencies
$ npm install

5> Désactiver l'option du son pour un serveur

You need to change the file config/machine.js. Go to line 21 and change the line soundCapable : true to soundCapable : false.

6> Créer une base de donnée mysql

sudo apt-get install mysql-server
mysql -u root -p
mysql>  CREATE USER "gladys"@"localhost";
mysql>  SET password FOR "gladys"@"localhost" = password('password');
mysql>  CREATE DATABSE gladys;
mysql>  GRANT ALL ON gladys.* TO "gladys"@"localhost";

7> Paramétrer Gladys

nano config/connections.js

modifier :

sailsmysql: {
    adapter: 'sails-mysql',
    host: 'localhost',
    port: 3306,
    user: 'gladys',
    password: 'password',
    database: 'gladys'
  },

8 > Démarage de l' IA gladys :)

node app.js

Et la ça marche :


gladys@gladys:~/gladys$ node app.js
info: User hook policies loaded from /home/gladys/gladys/api/hooks/example/policies.
info: User hook config loaded from /home/gladys/gladys/api/hooks/example/config.
info: User hook models loaded from /home/gladys/gladys/api/hooks/example/lib/../models.
info: User hook services loaded from /home/gladys/gladys/api/hooks/example/lib/../services.
info: User hook controllers loaded from /home/gladys/gladys/api/hooks/example/lib/../models.
info:
info:                .-..-.
info:
info:    Sails              <|    .-..-.
info:    v0.11.0             |\
info:                       /|.\
info:                      / || \
info:                    ,'  |'  \
info:                 .-'.-==|/_--'
info:                 `--'-------'
info:    __---___--___---___--___---___--___
info:  ____---___--___---___--___---___--___-__
info:
info: Server lifted in `/home/gladys/gladys`
info: To see your app, visit http://localhost:1337
info: To shut down Sails, press <CTRL> + C at any time.

debug: --------------------------------------------------------
debug: :: Tue Jun 23 2015 19:25:02 GMT+0200 (CEST)

debug: Environment : development
debug: Port        : 1337
debug: --------------------------------------------------------

Donc maintenant je cherche à uploader la vm pour que tout le monde puisse tester ça !!!