-
Notifications
You must be signed in to change notification settings - Fork 7
feat: add MLE application template #257
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
base: main
Are you sure you want to change the base?
Conversation
# Database User Password | ||
DB_PASSWORD=<%= connectionPassword %> | ||
# Connection string to your Autonomous Database/ | ||
# Oracle Database Free instance |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This might create confusion for users since the connection will not necessarily be to a free DB instance.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed to "Oracle Database instance"
# Connection string to your Autonomous Database/ | ||
# Oracle Database Free instance | ||
CONNECT_STRING=<%= connectionString %> | ||
MLE_MODULE= |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This variable is empty and does not have a replacement token, is this expected?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, this variable is updated after npm run deploy
is executed. We need to keep this for the tests in case user provided custom MLE module name.
src/index.ts
Outdated
@@ -207,7 +207,7 @@ export default class Generate extends Command { | |||
'template': Flags.string({ | |||
char: 't', | |||
description: 'Template to use', | |||
options: ['node-vanilla', 'node-react', 'node-vue', 'node-react-todo', 'node-jet', 'node-angular', 'ords-remix-jwt-sample'], | |||
options: ['node-vanilla', 'node-react', 'node-vue', 'node-react-todo', 'node-jet', 'node-angular', 'ords-remix-jwt-sample', 'mle-js-basic'], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we need to adjust the template name to have consistency with other templates and be more explicit on it's main functionality, a few proposals I have in mind:
mle-ts-sample
mle-deployment-sample
mle-todo
mle-todo-sample
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
changed to mle-ts-sample
.github/dependabot.yml
Outdated
@@ -188,3 +188,8 @@ updates: | |||
- "templates-ords-remix" | |||
commit-message: | |||
prefix: fix(deps) | |||
|
|||
- package-ecosystem: "npm" | |||
directory: "/templates/mle-js-basic/" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When the template name is defined, I'll create a label on the project so that PRs created by dependabot can be easily filtered.
This will require a minor change here, but let's define that other item first.
templates/mle-js-basic/utils/db.mjs
Outdated
} | ||
|
||
console.log(`Executing: ${filePath}...`); | ||
const sqlclCommand = `"${sqlExecutable}" -S /nolog <<'EOF' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Regarding SQLcl, one of the concerns raised when discussing with the team is the fact that this:
- This adds external dependencies.
- Users who are not used to the Oracle ecosystem will probably not have SQLcl installed on their system, which represents a barrier to the use of the template.
- We should explore the possibility of performing deployments using the
node-oracledb
driver as other templates do in the project for the DB connection.
For additional context: the objective of this generator is to help newcomers to the Oracle ecosystem by automating repetitive boilerplate tasks, eliminating setup friction, and accelerating onboarding, that why SQLcl is a concern for us.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Currently using SQLcl for MLE template project is one of our requirements. SQLcl team is working on MLE specific functionality that simplifies user's interaction with MLE. For instance, it allows users to deploy large MLE modules directly from JS file without introducing PL/SQL wrapper code. Basically our goal is exactly the same as you describe "...help newcomers to the Oracle ecosystem by automating repetitive boilerplate tasks....". SQLcl functionality is still in development. There will be more functionality in the future that will make user's life easier.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What do you think @mig8447 ? That SQLcl feature seems reasonable to avoid more complexity in the code/deployments, maybe the download, unzip, and execution of SQLcl can be automated within the template 🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For the future templates we aim to use SQLcl projects to manage state of the database objects. SQLcl is using liquibase to keep track of changes. It also allows to export current state of the database, make changes, stage and the changes will be represented in the corresponding liquibase executable SQL scripts.
For the future, we can consider automated SQLcl installation. For the basic template we propose to keep things as it is now.
templates/mle-js-basic/package.json
Outdated
"scripts": { | ||
"build": "esbuild src/index.ts --bundle --minify=false --platform=neutral --format=esm --outfile=dist/index.js", | ||
"deploy": "node deploy.mjs", | ||
"initdb": "node utils/db.mjs utils/database/initdb.sql", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How does initdb
handle the case where objects are already in the DB but the cleandb
has not been run?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
User will see the corresponding message: 00000 - "name is already used by an existing object" or 00000 - "such a referential constraint already exists in the table"
.github/dependabot.yml
Outdated
- package-ecosystem: "npm" | ||
directory: "/templates/mle-ts-sample/" | ||
schedule: | ||
interval: "monthly" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I created a new label templates-mle
in the repo, let's add the corresponding configuration to this file to make issues generated by dependabot be tagged accordingly.
As an extra note, dependencies are usually updated every quarter, so you guys don't have to send updates every month as patch releases also occur in based on this schedule, of course security bugs/CVEs are the exception.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added:
labels:
- "dependencies"
- "templates-mle"
|
||
An Always Free Autonomous Database offers the quickest way to get started. If you would like to use {Docker,Podman} Compose to get up-and-running quickly, you can refer to [Server-Side JavaScript driven by node-express](https://blogs.oracle.com/developers/post/serverside-javascript-driven-by-nodeexpress) for reference. | ||
|
||
To execute JavaScript using Oracle Multilingual Engine (MLE), a database user typically needs the CREATE SESSION privilege to connect, and may require EXECUTE ON JAVASCRIPT depending on the database version (this requirement is being deprecated). If the JavaScript code imports MLE modules, the user must have EXECUTE privileges on those specific modules. Additional privileges like CREATE PROCEDURE or data access privileges (SELECT, INSERT, etc.) may be needed based on what the JS code does. For more information please read [System and Object Privileges Required for Working with JavaScript in MLE](https://docs.oracle.com/en/database/oracle/oracle-database/23/mlejs/system-and-object-privileges-required-working-javascript-mle.html). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this something that is automated in your scripts? Or users will have to execute these manually in their DB?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is not automated. Normally, users are given a user by DBA that can be used to execute MLE JS code. If user wants to "play" with some local database installation the DB user should be created manually and corresponding privileges given.
templates/mle-js-basic/utils/db.mjs
Outdated
} | ||
|
||
console.log(`Executing: ${filePath}...`); | ||
const sqlclCommand = `"${sqlExecutable}" -S /nolog <<'EOF' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What do you think @mig8447 ? That SQLcl feature seems reasonable to avoid more complexity in the code/deployments, maybe the download, unzip, and execution of SQLcl can be automated within the template 🤔
templates/mle-ts-sample/package.json
Outdated
"typescript": "^5.7.3", | ||
"esbuild": "0.25.1", | ||
"oracledb": "^6.7.1", | ||
"vitest": "^1.0.0" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there any reason to use vitest 1.0.0
instead of the latest 3.1.2
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no specific reason, changed to 3.1.2
[PR] [Enhancement] MLE application template #255