Author Topic: Gateway Installation Question  (Read 5097 times)

prairietech

  • NewMember
  • *
  • Posts: 19
Gateway Installation Question
« on: May 07, 2015, 09:35:40 AM »
I'm in the process of installing the Gateway on my rpi.  And yes an image would be a great help.  I'm not a coder but rather want the end product of a Moteino Gateway. 

Regarding sudo nano /etc/profile.  Where does

...
NODE_JS_HOME="/opt/node"
PATH="$PATH:$NODE_JS_HOME/bin"
export PATH
...

get placed into the existing file?  When I do a node -v, the result is -bash: node: command not found.

jra

  • Jr. Member
  • **
  • Posts: 81
  • Country: us
Re: Gateway Installation Question
« Reply #1 on: May 07, 2015, 02:40:59 PM »
Almost doesn't matter but I would put it at the bottom.  /etc/profile is read when you login so after you change it you need to logout and login again in order for the change to take effect.

prairietech

  • NewMember
  • *
  • Posts: 19
Re: Gateway Installation Question (now second problem)
« Reply #2 on: May 07, 2015, 03:49:50 PM »
That worked.  I did have the lines at the top and that didn't work.  Inserting them at the end of the file worked.
Now back to the setup and what more trouble I can get myself into.

But now I have hit another wall when trying to sudo npm install socket.io  This is the error message I get:

pi@raspberrypi ~ $ sudo npm install socket.io
npm http GET https://registry.npmjs.org/socket.io

npm ERR! Error: failed to fetch from registry: socket.io
npm ERR!     at /usr/share/npm/lib/utils/npm-registry-client/get.js:139:12
npm ERR!     at cb (/usr/share/npm/lib/utils/npm-registry-client/request.js:31:9)
npm ERR!     at Request._callback (/usr/share/npm/lib/utils/npm-registry-client/request.js:136:18)
npm ERR!     at Request.callback (/usr/lib/nodejs/request/main.js:119:22)
npm ERR!     at Request.<anonymous> (/usr/lib/nodejs/request/main.js:212:58)
npm ERR!     at Request.emit (events.js:88:20)
npm ERR!     at ClientRequest.<anonymous> (/usr/lib/nodejs/request/main.js:412:12)
npm ERR!     at ClientRequest.g (events.js:156:14)
npm ERR!     at ClientRequest.emit (events.js:67:17)
npm ERR!     at HTTPParser.parserOnIncomingClient [as onIncoming] (http.js:1256:7)
npm ERR! You may report this log at:
npm ERR!     <http://bugs.debian.org/npm>
npm ERR! or use
npm ERR!     reportbug --attach /home/pi/npm-debug.log npm
npm ERR!
npm ERR! System Linux 3.18.7-v7+
npm ERR! command "/usr/bin/nodejs" "/usr/bin/npm" "install" "socket.io"
npm ERR! cwd /home/pi
npm ERR! node -v v0.6.19
npm ERR! npm -v 1.1.4
npm ERR! message failed to fetch from registry: socket.io
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR!     /home/pi/npm-debug.log
npm not ok



Maybe I should wait for the image Felix mentioned, but I'm too anxious to get this up and running.

Thanks for your help!

Felix

  • Administrator
  • Hero Member
  • *****
  • Posts: 6866
  • Country: us
    • LowPowerLab
Re: Gateway Installation Question
« Reply #3 on: May 08, 2015, 08:36:21 AM »
Hey guys, really sorry to see all this trouble happening. I have no idea why this is so hard. I had trouble myself and after several installs I had put the guide together and that worked the last time I tried it on a new installation. I also updated it with new versions as they became available.

I will try hard to prepare the image as soon as I can, just plagued with other backlog and stuff that's really urgent.
Once I have the image I will post a link on the Source Code tab at lowpowerlab.com/gateway and will try to be consistent and link it here as well.

prairietech

  • NewMember
  • *
  • Posts: 19
Re: Gateway Installation Question
« Reply #4 on: May 08, 2015, 09:13:47 AM »
Felix,

You have done an incredible amount of work so far and I don't want to make more work for you. (but an image would be sweet)  I just need a little help figuring out all these npm errors.  I'm generally pretty good at Googling the error and finding a solution but this one has me stumped.

Randy

bauderline

  • NewMember
  • *
  • Posts: 38
Re: Gateway Installation Question
« Reply #5 on: May 09, 2015, 06:38:37 AM »

Felix,

I followed your guide and had no problems getting it up and running apart from the npm path error, which I sidestepped  by using "su - root" a bit naughty I know but a few chown and chgrp commands later all is well...

P.

prairietech

  • NewMember
  • *
  • Posts: 19
Re: Gateway Installation Question
« Reply #6 on: May 09, 2015, 09:04:42 AM »
I found the following on stackoverflow.com and it allowed me to install socket.io without any errors.  So now I will proceed to follow the Frameword Gateway setup and see what other trouble I can get myself into. ;)



Make sure You remove any nodejs/npm packages already installed.

sudo apt-get purge nodejs

sudo apt-get purge npm
Now Install Node js using the command below( Thanks to midnightcodr on github)

curl -L https://raw.github.com/midnightcodr/rpi_node_install/master/setup.sh | bash -s 0.10.24
Note that you can invoke node with command node and not nodejs.

Once node is installed , Install npm

sudo apt-get install npm

Felix

  • Administrator
  • Hero Member
  • *****
  • Posts: 6866
  • Country: us
    • LowPowerLab
Re: Gateway Installation Question
« Reply #7 on: May 11, 2015, 08:28:30 AM »
Thanks for sharing that, good to have it on the record here.

prairietech

  • NewMember
  • *
  • Posts: 19
Re: Gateway Installation Question
« Reply #8 on: May 11, 2015, 09:08:34 AM »
Well I am making progress but have another question that I can't find a solution for.

When going to https://10.0.0.1/chat.html, I get the Authentication Required.  The server https://10.0.0.1:443 requires a username and password. The server says: Restricted.  I can enter my User Name and Password from /var/www/default/.htpasswd but it is not accepted.  What am I overlooking?

Felix

  • Administrator
  • Hero Member
  • *****
  • Posts: 6866
  • Country: us
    • LowPowerLab
Re: Gateway Installation Question
« Reply #9 on: May 11, 2015, 11:07:20 AM »
THere are many moving parts in that configuration. The .htpasswd has to be in the right place and the path setup correctly in the nginx config for your default folder.
Then the password has to be generated correctly as described in the guide.
Did you generate your own SSL certificate?

andromeda

  • NewMember
  • *
  • Posts: 11
Re: Gateway Installation Question
« Reply #10 on: May 12, 2015, 06:00:01 AM »
Well I am making progress but have another question that I can't find a solution for.

When going to https://10.0.0.1/chat.html, I get the Authentication Required.  The server https://10.0.0.1:443 requires a username and password. The server says: Restricted.  I can enter my User Name and Password from /var/www/default/.htpasswd but it is not accepted.  What am I overlooking?

Have you do this from here (http://lowpowerlab.com/gateway/#pisetup) :

sudo echo -e "USERNAME:`perl -le 'print crypt("PASSWORD","SALT")'`"
and insert result into .htpassword.
sudo nano /var/www/default/.htpasswd

.htpassword contain cripted password !

Andromeda

prairietech

  • NewMember
  • *
  • Posts: 19
Re: Gateway Installation Question
« Reply #11 on: May 12, 2015, 10:49:46 AM »
This must pertain to the statement below?  I do not have any idea how to make it point to the additional site-level config files.

Yes I did generate my own SSL certificate.  After I reboot, I am able to get past the secure log in.  However my user name is not listed like it is in your example.

If you are going to make an image available, all of this is a non-issue.  However I think you will find your software application will be attracting more non-coders like myself who will continue to annoy you will elementary questions like me.



Edit the nginx server config file and make it point the additional site-level config files:


sudo nano /etc/nginx/nginx.conf
Dump this configuration in the nginx.config file, and save it:



THere are many moving parts in that configuration. The .htpasswd has to be in the right place and the path setup correctly in the nginx config for your default folder.
Then the password has to be generated correctly as described in the guide.
Did you generate your own SSL certificate?

Felix

  • Administrator
  • Hero Member
  • *****
  • Posts: 6866
  • Country: us
    • LowPowerLab
Re: Gateway Installation Question
« Reply #12 on: May 12, 2015, 10:43:28 PM »
Good news: gateway guide was updated and a link to a completely setup and ready to go Pi image was posted here. It includes the web stack install and also all the files with some sample node data so it should run out of the box and you should not have much else to do except perhaps change passwords for the Pi and for the web auth (which you should actually do to make it secure). If you want to send email/SMS you need to put your email and mobile settings in gateway.js.
Let me know if there is any issue with it.
Enjoy!
« Last Edit: May 18, 2015, 12:07:22 PM by Felix »

prairietech

  • NewMember
  • *
  • Posts: 19
Re: Gateway Installation Question
« Reply #13 on: May 13, 2015, 12:13:09 PM »
Downloaded the image and I'm up and running!!  Hurray!!
Thanks Felix for making it much much easier for us noobs. 
Now to order some Moteinos!