NodeJS + PostgreSQL

Discussion in 'Installation/Configuration' started by Kemp, May 19, 2023.

  1. Kemp

    Kemp Member

    Hi,

    I have MariaDB setup for ISPConfig.

    If I install NodeJS with nvm + PostgreSQL as a root user --will I be able to use ISPConfig hosted website with NodeJS and PostgreSQL?

    Thank you!
     
  2. michelangelo

    michelangelo Active Member

    You can manually install NodeJS and PostgreSQL on a ISPConfig managed system but both are not manageable by ISPConfig.
     
  3. Kemp

    Kemp Member

    OS: Debian 11

    I have installed NodeJS with nvm + PostgreSQL as a root user --how can I use it now as a shell user? ex: web1
    node --version is working as root user
    but not as web1 user

    I have added the following to: /etc/jailkit/jk_init.ini

    [node]
    comment = NodeJS
    paths = npm, node, nodejs, /usr/lib/nodejs, /usr/share/npm, /usr/share/node-mime, /usr/lib/node_modules, /usr/local/lib/nodejs, /usr/local/lib/node_modules, elmi-to-json, /usr/local/bin/elmi-to-json
    executables = /usr/bin/npm, /usr/bin/node, /usr/bin/nodejs, /usr/local/bin/elmi-to-json
    directories = /usr/share/npm, /usr/lib/nodejs, /usr/local/lib/node_modules /usr/lib/node_modules

    I also added "node" to:
    System -> Server Config > Jailkit > Jailkit chroot app sections

    For the command:
    jk_init -c /etc/jailkit/jk_init.ini -f -k -j /var/www/clients/client0/web1 node

    I am getting the following errors:
    ERROR: /var/www/clients/client0/web1 is not owned by root:root!
    ERROR: jail directory node is not safe

    Thank you!
     
    Last edited: May 20, 2023
  4. till

    till Super Moderator Staff Member ISPConfig Developer

    The directory should be owned by root:root and it is on my systems, did you change the owner manually?
     
  5. Kemp

    Kemp Member

    No I didn't change it, I just deleted the domain and recreated it but it's giving the same error.

    Thank you!
     
  6. till

    till Super Moderator Staff Member ISPConfig Developer

    Which ISPConfig version do you use?
     
  7. Kemp

    Kemp Member

    3.2.9p1
     
  8. nhybgtvfr

    nhybgtvfr Well-Known Member HowtoForge Supporter

    could the issue be that you have added this section to jk_init.ini yourself.. ?
    i believe that you now have two node sections in that file, which may be causing issues, especially as what you've added is different to what's in my jk_init.ini file.

    it may be a difference between ubuntu and debian, but on my ubuntu instance, for 3.2.9p1, the node section is already included in the jk_init.ini file by default (using the auto-installer) and is just:

    Code:
    [node]
    comment = NodeJS
    paths = npm, npx, node, nodejs, semver, /usr/lib/nodejs, /usr/share/nodejs, /usr/share/npm, /usr/share/node-mime, /usr/lib/node_modules, /usr/local/lib/nodejs, /usr/local/lib/node_modules, /etc/npmrc, /etc/npmignore, elmi-to-json, /usr/local/bin/elmi-to-json
    
    
     
  9. Kemp

    Kemp Member

    Yes, you are right there were two node sections --I have removed the one I had added, it's still not working
    ERROR: /var/www/clients/client0/web1 is not owned by root:root!
    ERROR: jail directory node is not safe

    Thank you!
     
  10. till

    till Super Moderator Staff Member ISPConfig Developer

    There was an error with permissions and jailkit that @helmo fixed, and this fix is already part of the nightly build. But not sure if that's the problem you are seeing now.
     
  11. Kemp

    Kemp Member

    Can I edit the required file for web1 user jailkit and add the node section manually for web1 if that's what's required?

    Instead of running this command:
    jk_init -c /etc/jailkit/jk_init.ini -f -k -j /var/www/clients/client0/web1 node

    If yes please let me know what to add to what file.

    Or please let me know how to update to nightly build.

    Thank you!
     
    Last edited: May 20, 2023
  12. till

    till Super Moderator Staff Member ISPConfig Developer

    I think it's this fix:

    https://git.ispconfig.org/ispconfig/ispconfig3/-/merge_requests/1693/diffs

    Instead of updating to nightly, it might be better when you just copy over the file:

    https://git.ispconfig.org/ispconfig...le/shelluser_base_plugin.inc.php?inline=false

    to your server to replace the file /usr/local/ispconfig/server/plugins-available/shelluser_base_plugin.inc.php
    But it might be that it fixes the issue for new sites only, to fix your existing site, run:

    Code:
    chattr -i /var/www/clients/client0/web1
    chown root:root /var/www/clients/client0/web1
    chattr +i /var/www/clients/client0/web1
    And in regard to the jailkit command, you might have to use jl_update to update an existing jail as jk_init is for initializing a new jail only. And using the chattr commands as shown above might be needed as well to unlock the site root before running jailkit commands. Or did you not create a jailed shell user in ISPConfig for this site yet?
     
  13. Kemp

    Kemp Member

    I recreated the account and jailed shell user after updating the file, I am getting the following error:
    Traceback (most recent call last):
    File "/usr/sbin/jk_init", line 261, in <module>
    main()
    File "/usr/sbin/jk_init", line 258, in main
    activateConfig(config, jail, args)
    File "/usr/sbin/jk_init", line 173, in activateConfig
    ji.handle_cfg_section(config,jail,cfg,section)
    File "/usr/sbin/jk_init", line 119, in handle_cfg_section
    self.didfiles = jk_lib.copy_binaries_and_libs(chroot, paths2, config['force'], config['verbose'], check_libs=1, try_hardlink=config['hardlink'],try_glob_matching=1,handledfiles=self.didfiles)
    File "/usr/share/jailkit/jk_lib.py", line 668, in copy_binaries_and_libs
    create_parent_path(chroot,os.path.dirname(file), be_verbose, copy_permissions=1, allow_suid=allow_suid, copy_ownership=retain_owner)
    File "/usr/share/jailkit/jk_lib.py", line 485, in create_parent_path
    os.mkdir(jailpath, dir_mode)
    PermissionError: [Errno 1] Operation not permitted: '/var/www/clients/client0/web1/usr'
     
    Last edited: May 20, 2023
  14. till

    till Super Moderator Staff Member ISPConfig Developer

    Is this error from ispconfig debug output, or did you ran a jailkit command manually? If you ran jailkit manually, did you run this command to unlock the root directory:

    chattr -i /var/www/clients/client0/web1

    before you ran the jailkit command?
     
  15. Kemp

    Kemp Member

    The error was shown after I ran the following command after updating the required file and recreating the account:
    jk_init -c /etc/jailkit/jk_init.ini -f -k -j /var/www/clients/client0/web1 node

    After executing the following command:
    chattr -i /var/www/clients/client0/web1

    Now I am getting the following error:
    Trying to link /usr/share/nodejs/@popperjs/test/package.json to /var/www/clients/client0/web1/usr/share/nodejs/@popperjs/test/package.json
    ...

    Thank you!
     
    Last edited: May 21, 2023

Share This Page