Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Check for prerequisites on server start-up/install/upgrade #2059

Merged
merged 23 commits into from
Oct 20, 2018

Conversation

taylortom
Copy link
Member

@taylortom taylortom commented Aug 31, 2018

Fixes #880 and #1917.

Rebases #2046 and #2038 onto release/0.5.1 (have done it this way due to the dependency between the two).

Checks for the dependencies required by the application. Two levels of deps are defined.

Primary dependencies (i.e. stuff needed for the app to start):

  • grunt-cli
  • git
  • Connection api.github.com

Secondary dependencies (not necessary immediately):

  • Database connection (included here, as it's only started mid-way through the install)
  • ffmpeg (if enabled in config, and only shows a warning if not)

Important note

This does add a delay to the server starting. In my local tests it was typically ~2 secs (everything runs async). A breakdown of this is something like:

  • Node ~1ms
  • Git ~50ms
  • GitHub ~500ms
  • Grunt ~500ms
  • FFmpeg <1ms
  • DB 1000-2000ms

lc-thomasberger and others added 8 commits August 31, 2018 10:59
- git
- grunt-cli 
- github-api connection
warn if local mongo-db not found
split into check for required optional dependencies
add check for ffmpeg
change error output format
@taylortom taylortom added this to the 0.5.1 milestone Aug 31, 2018
@lc-thomasberger
Copy link
Member

lc-thomasberger commented Sep 4, 2018

When I execute node server.js without a installation before:

$ node server.js
info: [04 Sep 2018 09:52:29 +02:00] Supporting the following authentication types:
info: [04 Sep 2018 09:52:29 +02:00] - local
error: [04 Sep 2018 09:52:30 +02:00] Couldn't connect to the database, please check the connection details are valid
error: [04 Sep 2018 09:52:30 +02:00] Some of the prerequisites could not be found, see above for details.

@lc-thomasberger
Copy link
Member

When I execute node install.js on setup without an existing config.json and empty database, I get the folowing error before I can enter master tenant name.

$ node install.js

This script will install the application.
Would you like to continue?
> Continue? Y/n (Y)

We need to configure the tool before install.
Tip: just press ENTER to accept the default value in brackets.
> Server port (5000)
> Server name (localhost)
> Database host (localhost)
> Master database name (adapt-tenant-master) at-repo
> Database server port (27017)
> Database server user
> Database server password
> Database server authentication database (admin)
> Data directory path (data)
> Git repository URL to be used for the authoring tool source code (https://github.com/adaptlearning/adapt_authoring.git)
> Git repository URL to be used for the framework source code (https://github.com/adaptlearning/adapt_framework.git)
> Specific git revision to be used for the framework. Accepts any valid revision type (e.g. branch/tag/commit) (tags/v2.2.5)
> Are you using ffmpeg? y/N (N) y
> Will you be using an SMTP server? (used for sending emails) y/N (N)
Now we need to configure the master tenant.
Tip: just press ENTER to accept the default value in brackets.

(node:18708) DeprecationWarning: current URL string parser is deprecated, and will be removed in a future version. To use the new parser, pass option { useNewUrlParser: true } to MongoClient.connect.
> Set a unique name for your tenant (master) warn: [04 Sep 2018 09:54:55 +02:00] - Course Creator doesn't exist, cannot update
warn: [04 Sep 2018 09:54:55 +02:00] - Authenticated User doesn't exist, cannot update
warn: [04 Sep 2018 09:54:55 +02:00] - Product Manager doesn't exist, cannot update
warn: [04 Sep 2018 09:54:56 +02:00] - Tenant Admin doesn't exist, cannot update
warn: [04 Sep 2018 09:54:56 +02:00] - Super Admin doesn't exist, cannot update

I can proceed the installation.

It stores the masterTenantName but not the masterTenantDisplayName in config.json.

@taylortom
Copy link
Member Author

Need to wait on #2074 before this can be finished

@taylortom taylortom self-assigned this Sep 24, 2018
@taylortom taylortom added the S: in-progress Issues currently being worked on - leave these be! label Sep 24, 2018
@lc-thomasberger
Copy link
Member

@taylortom regarding delay, should we add a flag to skip the checks?
--skipVersionCheck to skip the version check for the AAT and Framework.
--skipDependencyCheck to not check the prerequisites.

@taylortom
Copy link
Member Author

taylortom commented Oct 10, 2018

@lc-thomasberger have added a skipDependencyCheck option to match the others, but they're only passed in from the server.run function rather than as cmd flags.

@tomgreenfield
Copy link
Contributor

  • I am unable to start my existing, functional server (or upgrade) due to the warnings. I was under the impression that the ffmpeg and smtp errors should be cautionary rather than blocking.
  • It appears that legacy installations with "useSmtp": "n" will trigger Mailer errors – is this appropriate?
Console output
$ node server
info: [11 Oct 2018 09:26:48 +01:00] configuration loaded from D:\adapt_authoring\conf\config.json
info: [11 Oct 2018 09:26:49 +01:00] Supporting the following authentication types:
info: [11 Oct 2018 09:26:49 +01:00] - local
warn: [11 Oct 2018 09:26:49 +01:00] You are using Node.js 10.11.0 which is not yet supported by Adapt. If you encounter issues, please downgrade to 8.x.
error: [11 Oct 2018 09:26:49 +01:00] Mailer requires the following settings to function: smtpService,smtpUsername,smtpPassword,fromAddress
error: [11 Oct 2018 09:26:49 +01:00] Local FFmpeg could not be found, please check it is installed
info: [11 Oct 2018 09:26:50 +01:00] Connection established: adapt-tenant-master
error: [11 Oct 2018 09:25:57 +01:00] Some of the prerequisites could not be found, see above for details.
config.json
{
  "outputPlugin": "adapt",
  "dbType": "mongoose",
  "auth": "local",
  "root": "D:/adapt_authoring",
  "serverPort": 5000,
  "serverName": "localhost",
  "dbHost": "localhost",
  "dbName": "adapt-tenant-master",
  "dbPort": 27017,
  "dbUser": "",
  "dbPass": "",
  "dbAuthSource": "admin",
  "dataRoot": "data",
  "sessionSecret": "your-session-secret",
  "authoringToolRepository": "https://github.com/adaptlearning/adapt_authoring.git",
  "frameworkRepository": "https://github.com/adaptlearning/adapt_framework.git",
  "frameworkRevision": "tags/v2.2.5",
  "useffmpeg": "y",
  "useSmtp": "n",
  "maxLoginAttempts": 3,
  "masterTenantName": "master",
  "masterTenantID": "57079b03794fc3a4029e30d6",
  "isProduction": false
}

@taylortom
Copy link
Member Author

taylortom commented Oct 15, 2018

@tomgreenfield fixed fatal error, not done anything about "useSmtp": "n".

@taylortom taylortom removed the S: in-progress Issues currently being worked on - leave these be! label Oct 15, 2018
lib/installHelpers.js Outdated Show resolved Hide resolved
@taylortom taylortom merged commit 6398e32 into release/0.5.1 Oct 20, 2018
@taylortom taylortom deleted the issue/880-rebased branch October 20, 2018 16:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants