Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


NodeJS hosting using DirectAdmin
New on LowEndTalk? Please Register and read our Community Rules.

All new Registrations are manually reviewed and approved, so a short delay after registration may occur before your account becomes active.

NodeJS hosting using DirectAdmin

Hello folks,

i feel lost, i would like to host "wiki.js" on my hosting provided by MyW.pt. On their side they support it but they are not used to deal with NodeJS apps so i would like to ask LET community for some help.

I've found some documentations aroung the web but they were related to other providers and they settings, i think. I would like some tips and advices or links to help me host wiki.js on a DirectAdmin supported by CloudLinux system.

Thanks a lot!

Thanked by 1MikePT

Comments

  • cnbeiningcnbeining Member
    edited March 2022

    CC @MikePT

    I think you can get it working by:

    • SSH to the box(ask Mike for SSH setup)
    • Put something nodejs in public_html
    • Make sure you have a .htaccess file under public_html: can be empty but must exists
    • Use Node.JS Selector, setup a service
    • Make sure you don't have node_modules folder under public_html
    • Run npm install yarn to get yarn
    • Get wiki.js to public_html
    • Folllow https://github.com/Requarks/wiki/blob/2.5.117/dev/build/Dockerfile#L17-L21 to build it
    • Setup env variables and entrypoint, which should be server
    • Stick with MySQL.
    • Error logs are located at public_html/stderr.log; stdout of Apache lives in the DA panel

    Hope you will have better mileage than me - I am trying to get https://github.com/outline/outline working but this thing only works with Postgres and the box seems to have some restrictions for outbound target ports, disallowing 5432. Will talk to Mike offline to evaluate risks of enabling this port.

    Thanked by 3nick_ MikePT o_be_one
  • MikePTMikePT Moderator, Patron Provider, Veteran

    Hey guys,

    Yep I don't deal with NodeJS that much, I can try to have a look at it Friday if the OP wants @o_be_one .

    @cnbeining thank you for helping the OP, we really appreciate it :-)

    Btw, port 5432 has been open in the DE server. If you need it open in the other servers just let us know, we'll open it :)

    Thanked by 1o_be_one
  • o_be_oneo_be_one Member
    edited March 2022

    My god Outline is even a pain using Docker at this time, i really hope they will make it easier ^^. Thanks for sharing those good information regarding my request, i really appreciate and hope the time you spent to give a step by step howto could help some other users.

    @MikePT said: I can try to have a look at it Friday if the OP wants

    Thank you so much Mike! Finally i've just hosted BookStack on few VPS i use as Docker host. I had to find a solution as some people from non-profit orgs were waiting for a wiki solution ^^. I feel like NodeJS hosting under CloudLinux with DirectAdmin is not that common. Also i didn't wanted to push you as you already provide what i pay for and helping me on this is "extra work" on your side.

    Oh you think the port had to be open? I was asking myself how this would work with DirectAdmin, like if it was aware of the NodeJS service to be like reverse proxied when you use the NodeJS app feature that is inside the panel.

  • With Cloudlinux it's easy to manage via DA:

    https://www.cloudlinux.com/getting-started-with-cloudlinux-os/42-profitability-and-php-features/959-nodejs-selector/

    And, if you're not using Cloudlinux;
    * Let your host/ install the latest version of NPM and have your host/you have to implement some form to auto update the NPM version
    * Install Supervisor or PM2 as a process manager for the webapp
    * execute your NPM commands for your NodeJS app
    * Expose it to localhost on a internal port, ie 127.0.0.1:58000 or 127.0.0.1:8080 or any unused for example
    * Setup an proxypass to the internal application in the used webserver (LS/Apache/Nginx)
    * Done

  • raviravi Member

    I have never hosted nodejs app on a DirectAdmin server.

    I prefer to host nodejs app on a VPS without any control panel or using CloudPanel.io (recently started using this, and its free).

  • @o_be_one said:
    Oh you think the port had to be open? I was asking myself how this would work with DirectAdmin, like if it was aware of the NodeJS service to be like reverse proxied when you use the NodeJS app feature that is inside the panel.

    Not necessarily.

    With my extremely limited understanding on what's happening under the hood with this DA + Node/Python/COBOL Selector is:

    • DA is nothing but a panel exposing APIs.
    • CloudLinux runs on the bare metal box and provides isolated "cage" for each user(that comes with quota management)
    • CloudLinux can utilize LiteSpeed - which is effectively Apache that some people strongly believe is much much much much faster than Apache but hey everything is faster than vanilla Apache - as web server that handles reverse proxy, FPM and CGI.
    • Apache(in @MikePT 's case, LiteSpeed) can utilize Passenger: in this case Passenger will handle process rotation, log collection and transportation and port forwarding on Apache.
    • CloudLinux's Selector will provide Passenger node binary(of specific version) and node_modules folder by setting up virtualenv inside CageFS of specific user. That's why you can use node command and can "select" versions.

    SO back to your question -

    NO there's no port that need to be opened as Passenger will arrange Apache to reverse proxy such process. And MAYBE we can manually tweak Passenger by editing .htaccess to make it run with any binary.

    CC @MikePT .

    Rant: I can totally see how shared hosting adopting Firecracker as KVM-based real jail replacing CloudLinux once quota can be setup. That's when the line between NAT VPS and Shared Hosting will diminish and OVZ/LXC will become pointless and I look forward for that day.

    Thanked by 2o_be_one bulbasaur
  • JordJord Moderator, Host Rep

    @ravi said:
    I have never hosted nodejs app on a DirectAdmin server.

    I prefer to host nodejs app on a VPS without any control panel or using CloudPanel.io (recently started using this, and its free).

    Why not? I run it currently, works perfectly fine.

  • raviravi Member

    @Jord said:

    @ravi said:
    I have never hosted nodejs app on a DirectAdmin server.

    I prefer to host nodejs app on a VPS without any control panel or using CloudPanel.io (recently started using this, and its free).

    Why not? I run it currently, works perfectly fine.

    Yes, nodejs apps should work perfectly on DA. Its just that I don't have DA with pro pack... my bad :(

  • JordJord Moderator, Host Rep
    edited March 2022

    @ravi said:

    @Jord said:

    @ravi said:
    I have never hosted nodejs app on a DirectAdmin server.

    I prefer to host nodejs app on a VPS without any control panel or using CloudPanel.io (recently started using this, and its free).

    Why not? I run it currently, works perfectly fine.

    Yes, nodejs apps should work perfectly on DA. Its just that I don't have DA with pro pack... my bad :(

    Me either haha, I use CloudLinux + litespeed works well. Not had any user complaints either.

    Thanked by 1ravi
  • @cnbeining said: With my extremely limited understanding on what's happening under the hood with this DA + Node/Python/COBOL Selector

    Woaw thank you so much for all details, it's really interesting and helpful!

  • tjntjn Member

    @o_be_one said:
    My god Outline is even a pain using Docker at this time, i really hope they will make it easier ^^.

    I have Outline deployed in production using Docker - holler if you need any help :)

    Thanked by 1o_be_one
  • @cnbeining said: I am trying to get https://github.com/outline/outline working but this thing only works with Postgres and the box seems to have some restrictions for outbound target ports, disallowing 5432. Will talk to Mike offline to evaluate risks of enabling this port.

    Interesting, selfhost Notion?

  • A new project for a non-profit just entered and i finally may use the NodeJS support from MyW.pt ^^. Pretty happy there is already so much resources here to achieve my goals!

    @elliotc said: selfhost Notion

    Yep, from my researches one of the closest to Notion that could be self-hosted.

    @tjn said: holler if you need any help

    Thank you so much! I've worked on my Traefik knowledges and i'm getting better at it, pretty sure my issue was more related to the configuration ive put in this service. I guess you used Notion in the past? What do your think about Notion vs Outline?

  • tjntjn Member

    @o_be_one said:
    Yep, from my researches one of the closest to Notion that could be self-hosted.

    I agree.

    @o_be_one said:
    Thank you so much! I've worked on my Traefik knowledges and i'm getting better at it, pretty sure my issue was more related to the configuration ive put in this service. I guess you used Notion in the past? What do your think about Notion vs Outline?

    I actually never tried Notion - went straight to using Outline with Caddy and Keycloak.
    I find Traefik pretty good, but I much prefer Caddy, it's easier to use and fits better into my bash scripts and Ansible playbooks.

    I do have some users that have tried both Outline and Notion, and although Notion is more polished and has a larger feature set, I've had no complaints regarding Outline.

    I now use it for all internal and external documentation and I really like it. I prefer it to BookStack for example, which I also had running for a while.

    Thanked by 1o_be_one
  • @elliotc said: Interesting, selfhost Notion?

    I find Outline much lighter. I don't really want to allocate any energy to "learn" Notion: all I want is something fast that can host Markdown docs with search function and Outline does this very well.

    As for deployment - shared hosting could be hard unless you can hack Redis in.

    I've got this running on Heroku - https://www.cnbeining.com/2021/12/free-personal-wiki-with-outline-on-heroku-with-personal-domain-via-cloudflare/ and https://www.cnbeining.com/2022/01/hacking-outline-wiki-making-slack-login-works-with-other-methods-like-oidc/ .

    Thanked by 2tjn o_be_one
  • @tjn said: I find Traefik pretty good, but I much prefer Caddy, it's easier to use and fits better into my bash scripts and Ansible playbooks.

    Ahah i was on Caddy before jumping on Traefik xD! I really loved Caddy but now i prefer Traefik as i feel like it's more "Docker friendly" with label configs. Probably i've missed this regarding Caddy features, i don't know. I configure my Traefik directly in it's compose (no yaml file, only env vars) so i think it's quite Ansible friendly but i may miss some requirements you had.

    Yeah regarding Outline on my side it's more for the privacy side i was interested.

  • I usually install node on a shared account like this:

    `
    #!/bin/bash
    # install node
    add_to_path()
    {
    if [[ "$PATH" =~ (^|:)"${1}"(:|$) ]]
    then
    return 0;
    fi
    export PATH=${1}:$PATH;

    sed -i "/export PATH=\/usr\/local\/sbin:\/usr\/local\/bin:\/usr\/sbin:\/usr\/bin:\/root\/bin:\/home\/$USER\/bin/d" ~/.bashrc;
    echo "export PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin:/home/$USER/bin" >> ~/.bashrc;
    source ~/.bashrc;
    }
    echo "install node";
    node_file="nodejs.tar.gz";
    cd ~;
    mkdir bin;
    cd bin;
    rm -f node;
    rm -f npm;
    rm -rf nodejs;
    wget -r -nd -l1 --no-parent -e robots=off -A "linux-x64.tar.gz" https://nodejs.org/dist/latest/;
    mv node
    linux-x64.tar.gz $node_file;
    tar -xvf $node_file;
    rm -f ./$node_file;
    mv node*linux-x64 nodejs;
    cp ./nodejs/bin/node ~/bin;
    ln -s ./nodejs/lib/node_modules/npm/bin/npm-cli.js npm;
    add_to_path $(pwd);
    node --version;
    npm --version;
    `

    Once it's installed you can do whatever.

    Thanked by 1o_be_one
Sign In or Register to comment.