Where to deploy node app on ubuntu

112 views
Skip to first unread message

Clarkie

unread,
Oct 15, 2014, 1:03:15 PM10/15/14
to nod...@googlegroups.com
I'm happy with the installation of nodejs itself; my question is around where to put our actual js files. 

Does anyone have any suggested locations and reasons why they use them?

We've considered /usr/local and /opt but I'm not a linux or node expert so I'd love to hear your thoughts.

Thanks, Clarkie

Aria Stewart

unread,
Oct 15, 2014, 5:24:22 PM10/15/14
to nod...@googlegroups.com
Node apps tend to be isolated, because of how node's module system works -- everything in one directory.

That means that each app tends to be its own directory; that naturally lends itself to being put in /opt/appname for each. That's not set in stone -- it's perfectly appropriate to live in the directory of a service user that runs it, or in /var/ or just about any place. Node's not picky, the technical distinctions are pretty minimal.

It depends on what your js files _do_, really.

Aria

Jeremy Darling

unread,
Oct 15, 2014, 5:26:34 PM10/15/14
to nodejs
We create a specific limited user for execution of our application (call it appuser) and place the code in the home of that user (/home/appuser/<appname>/<version>/...) then create init script to setup and start the app under the same user.  Make sure you setup the user so it doesn't have SSH rights is a good idea.

 - Jeremy

--
Job board: http://jobs.nodejs.org/
New group rules: https://gist.github.com/othiym23/9886289#file-moderation-policy-md
Old group rules: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
---
You received this message because you are subscribed to the Google Groups "nodejs" group.
To unsubscribe from this group and stop receiving emails from it, send an email to nodejs+un...@googlegroups.com.
To post to this group, send email to nod...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/nodejs/b0bb6702-2bb0-4711-a868-6f59e572dac4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Floby

unread,
Oct 16, 2014, 4:09:41 AM10/16/14
to nod...@googlegroups.com
We deploy our apps to /opt

Ken

unread,
Oct 16, 2014, 4:41:32 PM10/16/14
to nod...@googlegroups.com
I'll second this approach, with a slight nuance, which is to create a separate user for each app, so for example if you had an app called "myapp" create a user called myapp and put the app's files in /home/myapp.  There are a couple advantages to this: first it's really easy to identify the relationships between applications and processes (e.g. when running top or ps), second you can give extremely fine grained permissions to each app, reducing the chance of privilege escalation if the security of one of your applications is breached.

Tom Boutell

unread,
Oct 19, 2014, 12:10:53 PM10/19/14
to nod...@googlegroups.com
We built a deployment tool that uses folders in /opt/stagecoach/apps, one for each node app. It's open source and very simple, you can check it out here:


It provides benefits similar to what you get with Capistrano in the Ruby world, but the deployment scripts are simple bash scripts.
Reply all
Reply to author
Forward
0 new messages