Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums JavaScript Deploying/Uploading node projects on Media Temple

  • This topic is empty.
Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #190537
    fooman
    Participant

    Hiya!
    I have a simple little node app running on Media Temple. Simple chat room. What else is new for a Node n00b ;) It’s up and running perfectly fine as-is.

    So my question stemmed from the basic need to use a library like node-mysql. In order to use that, you need to store your database credentials in a script somewhere, and in all examples for that module the password is plain-text in the app’s JS script.

    So I asked “what’s stopping users from simply looking at the source code and stealing my credz?” Because in most Node tutorials, the app.js, main.js, or server.js script is simply in the project root.

    This leads me to think I’m not deploying the node project in the proper location on the server.

    Should I be storing my server-side script in another directory that is not accessible to the public such as ‘usr’ or ‘etc’ or some other locked-down directory?

    I’ve Google’d Node Deployment, and most results are about Heroku, Nodejitsu, etc. I’m really wanting to stick to MT at the moment, so any help with this particular environment is most welcome!! :)

    #190548
    __
    Participant

    this is a different situation than a traditional website setup. The concept of the “web root” is fairly meaningless in the context of nodeJS. Unless you provide some way to access those files (e.g., set up a static server in node or put your project in a directory that another webserver (Apache/nginx) serves from), then they won’t be accessible.

    You mention MT, so I’m assuming that you’re running node via Apache? and this problem comes up because your node project is in Apache’s web root? That would allow Apache to serve your node app as regular files, rather than running them as an app.

    Ideally, this conflict would not exist: your node app simply wouldn’t be in a directory that another server serves files from. You need to either move those files, or tell Apache not to serve them (à la Deny from all).

    Aside; node is not well-suited to traditional hosting plans (for this and many other reasons). A VPS is the way to go.

    #190601
    fooman
    Participant

    Can you elaborate on why a traditional hosting plan is not the way to go for a Node app??

    If I were to stick with a tradional plan for the moment, simply to save some cash and hassle for my company while I wrap my head around things (talking them into a new hosting environment, $$$, etc), is there a location that would be well-suited to serve a node app from that is not accessible to serve regular files?

    #190617
    __
    Participant

    is there a location that would be well-suited to serve a node app from that is not accessible to serve regular files?

    Specifically on MT, no clue. Somewhere outside your Apache web root, but I don’t know if you could proxy to such a location. Maybe ask them.

    simply to save some cash…

    Have you looked into places like DigitalOcean? On-demand VPS, including pre-configured images, starting at $5/mo. (not affiliated, just a fan.)

    Can you elaborate on why a traditional hosting plan is not the way to go for a Node app??

    They’re simply not organized with node in mind. The trouble you’re having with overlapping web roots, plus the fact that you generally need more terminal than a shared host will normally allow. Honestly, I’m surprised that MT has node installed at all.

    But it’s up to you.

Viewing 4 posts - 1 through 4 (of 4 total)
  • The forum ‘JavaScript’ is closed to new topics and replies.