Deploying

151 views
Skip to first unread message

anup kalburgi

unread,
Jul 27, 2012, 6:23:00 AM7/27/12
to expre...@googlegroups.com
Hi All,

Hi can you guys share how all deploying the expressjs apps\?

nodejitsu.com working fine for me. How would i deploy it on my own VPS?
I tried doing it via Haproxy. But url mapping is just messed up.

thanks



--


ben

unread,
Jul 27, 2012, 6:40:57 AM7/27/12
to expre...@googlegroups.com
Take a look at this https://github.com/dreamerslab/nodejs.production
> --
> You received this message because you are subscribed to the Google Groups
> "Express" group.
> To post to this group, send email to expre...@googlegroups.com.
> To unsubscribe from this group, send email to
> express-js+...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/express-js?hl=en.

anup kalburgi

unread,
Jul 27, 2012, 6:58:33 AM7/27/12
to expre...@googlegroups.com
Ya i did exactly the same.
But it throws me a error
Error: Failed to lookup view "admin" on redirect in the code.

but /login which is render working fine. Any idea what i am missing out ?
But the same works all fine with jitsu.
-

ben

unread,
Jul 27, 2012, 7:04:33 AM7/27/12
to expre...@googlegroups.com
at what step did this error show up?

anup kalburgi

unread,
Jul 27, 2012, 7:14:40 AM7/27/12
to expre...@googlegroups.com
When i browse,
domain.com/login works fine
but when when i submit. and it authenticates  and get redirected to the home page its not able to locate the admin.html.

On local system it working fine.
Have to got to add this html folder to static dir declaration in .conf ? (i am using swig templates )

ben

unread,
Jul 27, 2012, 7:26:46 AM7/27/12
to expre...@googlegroups.com
Do you use nginx as the static server or you use express static
middleware to serve the file?

anup kalburgi

unread,
Jul 27, 2012, 7:29:10 AM7/27/12
to expre...@googlegroups.com
I am using express static middle ware.

ben

unread,
Jul 27, 2012, 7:35:46 AM7/27/12
to expre...@googlegroups.com
I guess it might be the production config differ to the dev config in
your express app.js

anup kalburgi

unread,
Jul 27, 2012, 7:49:56 AM7/27/12
to expre...@googlegroups.com
As such i did not do any changes wrt to environment.

Can u please give me a example regarding how it should look ?
Anup P Kalburgi
Ph : +919900482935

ben

unread,
Jul 27, 2012, 7:53:56 AM7/27/12
to expre...@googlegroups.com
https://github.com/dreamerslab/express-todo-example

This is an express todo example. All the deployment script and configs
are in the doc folder.
Hope this helps.

ben :)

anup kalburgi

unread,
Jul 27, 2012, 8:22:29 AM7/27/12
to expre...@googlegroups.com
Ya right its as per the example.
I tried even give the absolute path for the templates that worked for the local server but not on server.

One thing that really disturbing is how come the /login is getting the view properly :(

ben

unread,
Jul 27, 2012, 8:24:25 AM7/27/12
to expre...@googlegroups.com
What if you deploy the sample project and see if it works?

anup kalburgi

unread,
Jul 27, 2012, 8:48:37 AM7/27/12
to expre...@googlegroups.com
is there anyway i can print where it searched for the template ? ( as it does in django)

ben

unread,
Jul 27, 2012, 9:25:51 AM7/27/12
to expre...@googlegroups.com
i guess you might need to hack a bit of the template engine you use

anup kalburgi

unread,
Jul 27, 2012, 9:31:19 AM7/27/12
to expre...@googlegroups.com
Absolute path put in place its working now.
But that not the way. Will have to see what is happening going to try out node inspector

tjholowaychuk

unread,
Jul 27, 2012, 11:38:43 AM7/27/12
to Express
linode + varnish

Rodolfo Campos

unread,
Jul 30, 2012, 10:25:25 AM7/30/12
to expre...@googlegroups.com
I hope to include some examples about deploying on my workspace at github, I'm planning to try it using Capistrano. We've used it for several projects on Symfony and Rails successfully. 

About Varnish, etc, etc... I found Varhish very powerful, but maybe just Node.js behind an Apache (using mod_proxy) with Pagespeed can make the trick for you.

Cheers,

Rodolfo.

Scott

unread,
Jul 30, 2012, 2:24:51 PM7/30/12
to expre...@googlegroups.com
I'm literally just ssh'ing into my servers and git pull (ing). Then I
restart my express process and check to see if I forgot any
dependancies :)
> --
> You received this message because you are subscribed to the Google Groups
> "Express" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/express-js/-/aVGesDdp4vIJ.

Paul Vencill

unread,
Jul 30, 2012, 2:29:20 PM7/30/12
to expre...@googlegroups.com
I much prefer a git-based deployment, pushing to the server and then letting post-deploy hooks pull the data into the live app if it's a Master deploy (not unlike heroku does).  That lets you also run npm install and such to fetch project dependencies.  

As far as architecture, I'm a big fan of nginx as the front end web server.

Scott

unread,
Jul 30, 2012, 2:35:40 PM7/30/12
to expre...@googlegroups.com
Dang, that sounds good to me. Sounds like its time for me to brush up
on git (I know just enough to get by).

I run Apache as the front end web server.

anup kalburgi

unread,
Jul 30, 2012, 2:38:23 PM7/30/12
to expre...@googlegroups.com
Am using Nginx as from end server so far all has been good.
Have not tried with Apache.

So we have to always start the app with nohup ? and leave it there ? or how is it ?

Thanks

Paul Vencill

unread,
Jul 30, 2012, 2:45:09 PM7/30/12
to expre...@googlegroups.com
Here's some getting started stuff:  http://git-scm.com/book/en/Customizing-Git-Git-Hooks

Something I didn't realize when I first got going w/ node (and not being a native linux guy) is that you can run a node file as a shell script if you want to by just making the file executable and leading off w/ the shebang:

#! /path/to/your/node/executable

at the top of the file.  As an example,  mine are:

#! /usr/local/bin/node 

So you can write your hooks in js if you want, which I find cool as hell. 

Scott

unread,
Jul 30, 2012, 2:47:05 PM7/30/12
to expre...@googlegroups.com
Regarding nohup, yes here is my start function:

export NODE_ENV=production
start() {
echo -n $"Starting express"
nohup node web/app.js > logs/express.log 2>&1
}

I created an init.d script and added it to the services list using
chkconfig on linux. Then to control it I just run: service express
start (or stop or restart) Just copy an existing script in
/etc/init.d/ and modify it for express. Once I caught all my errors
in the express app, this method has been really reliable for me.

S

Scott

unread,
Jul 30, 2012, 2:49:15 PM7/30/12
to expre...@googlegroups.com
Oh man I'm going to have fun with that. Thanks Paul!

Rodolfo Campos

unread,
Aug 2, 2012, 12:52:48 PM8/2/12
to expre...@googlegroups.com
Based on this discussion and my previous work on something similar for starting and stopping a Pentaho BI Server, I wrote this: https://github.com/camposer/express-examples/wiki/Deployment

There you can find an init script ideal for /etc/init.d ...

Cheers,

Rodolfo.

El viernes, 27 de julio de 2012 12:23:00 UTC+2, Monty0nWeb escribió:
Reply all
Reply to author
Forward
0 new messages