I get a 404 error at starting

23 views
Skip to first unread message

David Martin

unread,
Aug 18, 2013, 12:49:17 PM8/18/13
to sil...@googlegroups.com
Hello,
I am testing Silk and just installed Silk on Ubuntu, at http://106.186.112.5:9090 but I get directly a 404 error. You can see the response header "Server:SILK JS Server" but it doesn't seem to find the index, any idea ? is there any internal proxy config to done or whatelse ?
I love javascript since more than 10 years but on client-side, and I have to say I get the graal if I can script on the server side also, your talk about your  PHP refatored app to JS, dramatically reduced nb of files and code lines doesn't surprised me, but it convinced me totally now, so thank in advance for this js server you provide, this is VERY cool ;-)


Eric Dykstra

unread,
Aug 18, 2013, 12:52:23 PM8/18/13
to sil...@googlegroups.com
David,

What do you see in the console where SilkJS is running?

Eric

David Martin

unread,
Aug 18, 2013, 12:57:15 PM8/18/13
to sil...@googlegroups.com
well the Google Groups interface is quite buggy, here is the console :
31685 Started logfile process 31687                                         
SilkJS HTTP running with 50 children on port 9090 from documentRoot httpd/docroot   

Eric Dykstra

unread,
Aug 18, 2013, 1:01:31 PM8/18/13
to sil...@googlegroups.com
David,

I have a different config than you, and a complex installation, but I have the following when I start SilkJS:

30449 Started logfile process 30451
Starting Schemas
SilkJS HTTP running with 25 children on port 3020 from documentRoot /var/www/acs/apps

Notice my documentRoot is absolute, and yours is relative. Both should be fine - but I am willing to bet something with the documentRoot config is wrong, and SilkJS is looking to a folder different than you expect. Maybe edit the config.js to use an absolute path to the documentRoot, and see if that works. Then figure out why the relative path fails.

It could even be that Silk is sourcing a different config.js too - rename yours to see if it fails?

Eric

David Martin

unread,
Aug 18, 2013, 1:15:13 PM8/18/13
to sil...@googlegroups.com
I rename the httpd/config.js to httpd/config.bak, start and get the console output so you are right that this is not this file that is red...
which other one could it be ?!

David Martin

unread,
Aug 18, 2013, 1:27:01 PM8/18/13
to sil...@googlegroups.com
well in fact, it doesn't fail if no config.js, I added a println('reading config') and it works, so it is just my file needing some configuration...I try to set absolute path and I let you know

Eric Dykstra

unread,
Aug 18, 2013, 1:27:38 PM8/18/13
to sil...@googlegroups.com
David,

I worked through the issues you are now months ago and my memory is not that great. So, I might be wrong on the following.

I bet SilkJS uses the config.js in the folder where the server.js or bootstrap.js (whichever you called it - or it is called now) unless otherwise specified at the command line when starting it. Or, maybe it uses the config where the SilkJS httpd server is? Just do a search on instances of config.js and rename them to see. (Likely only 2 instances related to Silk) Or - better yet - check the source of httpd-silkjs.js

Then, in the one that is being used, make sure that the config.js entry for Config.documentRoot points to the absolute location of the folder where the index.jst file you want to run is.

Here is how I launch my app:

silkjs /usr/local/bin/httpd-silk.js /var/www/acs/server.js

where silkjs is in my path and points to /usr/local/bin/silkjs

I can confirm that the config.js used is inside the same folder as the server.js above. So, it seems that SilkJS looks for the config in the same folder as the server.js. Make sure your documentRoot is defined there correctly.

Eric

Eric Dykstra

unread,
Aug 18, 2013, 1:31:31 PM8/18/13
to sil...@googlegroups.com
David,

Oh - I am sure that it will fail with no config.js. I bet it just used a default config.js if it can't find one in the same folder where your server.js is.

On my system, I have 2 instances of config.js:

/usr/local/silkjs/httpd/config.js (The default that comes with SilkJS)

and

/var/www/acs/config.js (In the same folder as server.js that I am running with httpd-silkjs)

Eric

David Martin

unread,
Aug 18, 2013, 2:04:11 PM8/18/13
to sil...@googlegroups.com
thank you Eric for your quick reply, well it is effectively a problem with doccumentRoot, I print docRoot here in config.js and I get a relative path :
                                                                                                                         
        docRoot = 'httpd/docroot';                                                                                       
                                                                                                                         
    if (!fs.exists(docRoot)) {                                                                                           
        docRoot = '/usr/local/silkjs/httpd/docroot';                                                                     
    }                                                                                                                    
    if (!fs.exists(docRoot)) {                                                                                           
        docRoot = '/usr/share/silkjs/httpd/docroot';                                                                     
    }                                                                                                                    
    include.path.unshift(docRoot);
println('reading conf docRoot : '+docRoot);
//
so as the config resides in the relative 'httpd/docroot' it won't go into the absolute declaration, you are probably right I got to set it absolutely or I need to lauch it as you tell me.
//
ok I done a find and set it hardly in config docRoot = '/usr/local/silkjs/httpd/docroot'; and it works !
so that is pretty cool !
so just my note : I followed strictly this http://www.silkjs.net/installing-silkjs/ so it may be mentionned in about the config.js so it can works straight away from the box.
Anyway thank you for your reactivity (and this group reactivity in general) it is very important for a project to be adopted ;-)

see you soon !

Michael Schwartz

unread,
Aug 18, 2013, 3:05:23 PM8/18/13
to sil...@googlegroups.com
It seems you haven't installed SIlkJS?

$ sudo make install 

from where you built SilkJS


To create a project, make a directory:

mkdir myProject
cd myProject
mkdir docroot

edit server.js:

// server.js contents
Config.documentRoot = 'docroot';
// end of server.js

myProject $ httpd-silk.js server.js

It will serve files from the docroot directory.

I can see from your debugging that SilkJS is serving documentRoot from its default location.

Regards


--
You received this message because you are subscribed to the Google Groups "SilkJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email to silkjs+un...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

David Martin

unread,
Aug 19, 2013, 9:40:18 AM8/19/13
to sil...@googlegroups.com
I did a make install from in SilkJS because I remember I had an error : I had no admin group in my etc/groups, fresh Ubunto 13 install has an 'adm' or something close but no 'admin' group, so had to add it.
But I understand better about the project structure now, it is just because I would like to make a *flash test* out of box following strictly http://www.silkjs.net/installing-silkjs/ and so had an error *by default*. I know when building our project I had to go further in the doc (well I probably red about all of it already to understand) but just IMHO, on the "install SilkJS" page, it may be added this little part you tell me about one first project config, so anybody can install and view it live in few minutes.

Well, I just have to go further with this pearl now ;-)

regards

Michael Schwartz

unread,
Aug 19, 2013, 9:57:12 AM8/19/13
to sil...@googlegroups.com
I've tried to be good about documenting how to get people up and running without hassle.  Building v8 and SilkJS from sources is enough of a hassle (but worth it!).

I'm available via google chat if you need any assistance.

There's a walkthrough directory in the silkjs github repo:


From the silkjs.net WWW site:

http://silkjs.net/http-server/

Setting up an application


The docroot directory will contain your static content and your dynamic "JSP" style pages. You might organize your docroot into a /css, a /js, an /img, directories. Your CSS files will be served by requests for /css/whatever.css, your JavaScript files will be served by requests for /js/whatever, and so on. Otherwise you'll organize your static HTML and dynamic pages as you would for a server like Apache; if you make an about/ folder, a request for /about/ will attempt to serve the directory index page for the about/ folder.

The HTTP server has a default Config object, which you can modify in your bootstrap.js script. The Config object contains the path to your documentRoot, the numChildren (number of children to pre-fork), MySQL connection parameters, and directoryIndex setup. The Config.directoryIndex member is an array of filenames that will be looked for if the request is for a directory.

David Martin

unread,
Aug 19, 2013, 10:31:34 AM8/19/13
to sil...@googlegroups.com
Ok, thank you !
Reply all
Reply to author
Forward
0 new messages