Project

General

Profile

Feature #1878

Deployment on a Debian system

Added by Alexander Watzinger 11 days ago. Updated 3 days ago.

Status:
In Progress
Priority:
Normal
Target version:
Start date:
2022-11-16
Estimated time:

Description

For the first version release (0.1.0) I would suggest we try to figure out how to deploy it on a Debian system.

A first implementation can be seen here: https://frontend-demo-dev.openatlas.eu/

History

#1

Updated by Alexander Watzinger 11 days ago

  • Description updated (diff)
#2

Updated by Andreas Olschnögger 11 days ago

  • Assignee changed from Andreas Olschnögger to Alexander Watzinger

Thanks for reporting your problems.

Concerning the installation of the dependencies,
it is only necessary to use one package manager (either npm, yarn or pnpm)
So it would be sufficient to only execute those two commands:

npm install
npm run build

The Unsupported engine warnings you are getting might be because of an older node or npm version.
Please try it with the latest node and npm version
update node: https://phoenixnap.com/kb/update-node-js-version
update npm: npm install -g npm@latest

I will adapt the readme.md file so that it is more clear.
Could you please try again with updated node and npm version and tell me if it works.

#3

Updated by Alexander Watzinger 11 days ago

  • Status changed from Assigned to In Progress
  • Assignee changed from Alexander Watzinger to Andreas Olschnögger

Thank you for the quick reply and clarifications.
I can't solve this on my Debian machine where current nodejs is at version 12.22.12 but at least version 14.17.0 is required.
The next Debian release will be around summer 2023 and there are no backports available.

Anyway, since this is only needed to build the website I would suggest that, for now, you do it for https://demo-dev.openatlas.eu on your machine, and than give me the dist folder so I can upload it to the server.

#4

Updated by Alexander Watzinger 10 days ago

  • Subject changed from Installation issues to Installation on a Debian system
  • Description updated (diff)
  • Assignee changed from Andreas Olschnögger to Alexander Watzinger
#5

Updated by Alexander Watzinger 10 days ago

  • Description updated (diff)
#6

Updated by Alexander Watzinger 10 days ago

  • Subject changed from Installation on a Debian system to Deployment on a Debian system
#7

Updated by Alexander Watzinger 10 days ago

So I got it running with the files provided by Andi, kind of, at least it now shows an error as a website. The error in the Apache log is:

Error [ERR_REQUIRE_ESM]: Must use import to load ES Module: /home/alex/projects/www/discovery/server/index.mjs
    at Module.load (internal/modules/cjs/loader.js:861:11)
    at Function.Module._load (internal/modules/cjs/loader.js:708:14)
    at Module.require (internal/modules/cjs/loader.js:887:19)
    at require (internal/modules/cjs/helpers.js:74:18)
    at loadApplication (/usr/share/passenger/helper-scripts/node-loader.js:180:2)
    at setupEnvironment (/usr/share/passenger/helper-scripts/node-loader.js:145:2)
    at /usr/share/passenger/helper-scripts/node-loader.js:68:5
    at LineReader.readLine (/usr/share/passenger/node/phusion_passenger/line_reader.js:124:3)
    at readNextOption (/usr/share/passenger/helper-scripts/node-loader.js:66:15)
    at /usr/share/passenger/helper-scripts/node-loader.js:75:5 {
  code: 'ERR_REQUIRE_ESM'

The almighty internet had an answer for this: https://javascriptf1.com/snippet/solving-the-error-must-use-import-to-load-es-module but states there that node.js has to be at least version 14. In the standard Debian install node.js is at 12.22.12.

I'm not sure (as always) if this really is the culprit and would suggest looking together at it next week.
What I did so far was installing passenger:

apt install libapache2-mod-passenger

and used this Apache config:

 <VirtualHost *:80>
    ServerName frontend.local

    # Tell Apache and Passenger where your app's code directory is
    DocumentRoot /var/www/discovery/public
    PassengerAppRoot /var/www/discovery

    # Tell Passenger that your app is a Node.js app
    PassengerAppType node
    PassengerStartupFile server/index.mjs

    # Relax Apache security settings
    <Directory /var/www/discovery/public>
        Allow from all
        Options -MultiViews
        # Uncomment this if you're on Apache >= 2.4:
        #Require all granted
    </Directory>

    ErrorLog        /var/log/apache2/error.log
    CustomLog       /var/log/apache2/access.log combined

</VirtualHost>

#8

Updated by Alexander Watzinger 3 days ago

  • Description updated (diff)
  • Assignee changed from Alexander Watzinger to Andreas Olschnögger

Thanks a lot Andi for getting an already compiled version to run on a Debian system, that really is something!
Although there are still some issues this is absolutely good enough for a 0.1.0 release. Maybe document, how you have done it before.
As soon as the release is ready from your side I would say we go for it, I can't wait to post the news :)

Also available in: Atom PDF