Skip to content

Conversation

Ulisseus
Copy link
Contributor

@Ulisseus Ulisseus commented Nov 16, 2020

While Redis supports creating username-password pairs with Access Control List most node.js clients still don't have this feature. Some clients allow you to authorize from node, but creating and deleting users still needs to be done via redis-cli. So Redis is not an option.

The same applies to Memcached and probably most other in-memory databases. Since these databases were designed as caches their security is either non-existent or they support only one global password. Ignite was the only one db with proper authentication out of the box (at least the only one which I could find, there are probably much more). In fact it's more than simple key-value store but in our case it's completely unnecessary.

To safely merge:

  • Apache Ignite needs to be installed (requires JDK)
  • IGNITE_HOST, IGNITE_USER and IGNITE_PASSWORD should be added to .env file. Default user-password is ignite, host is 127.0.0.1:10800

Start the server with provided configuration bash ignite.sh path-to-igniteConfig.xml. It's configured to have persistence (if server runs out of memory heap file on disk will be used, it's also a requirement for authentication for some reason) and to limit in-memory region to 200mb.

Tutorial is pretty barebones so far, additions are welcome.

@Ulisseus Ulisseus changed the title Closes #161 - add Ignite key-value in-memory database closes #161 - add Ignite key-value in-memory database Nov 16, 2020
Postgres: pgModule.userHasPgAccount,
Elasticsearch: es.createAccount,
Arango: arangoModule.createAccount,
Ignite:igniteModule.createAccount
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is a missing space between : and igniteModule.createAccount

Postgres: process.env.HOST,
Elasticsearch: process.env.ES_HOST,
Arango: process.env.ARANGO_URL,
Ignite:process.env.IGNITE_HOST
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is a missing space between : and process.env.IGNITE_HOST

lib/util.test.js Outdated
pg.userHasPgAccount = () => true;
es.checkAccount = () => true;
arango.checkIfDatabaseExists = () => true;
ignite.checkAccount = ()=>true;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you change the format to include spaces?

ignite.checkAccount = () => true

lib/util.js Outdated
if (arangoDbExists) await arango.deleteAccount(username);

const igniteDbExists = await ignite.checkAccount(username);
if(igniteDbExists) await ignite.deleteAccount(username);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add a space after the if? For codebase styling consistency. We have a prettierrc.js file that is supposed to take care of styling. Are you using prettier?

https://github.com/garageScript/databases/blob/master/.prettierrc.js

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I use prettier as default vscode formatter usually, so I forgot to check these files before submitting. I run prettier over all database files in new commit and it picked up a few inconsistencies here and there, mostly empty spaces around objects.
Everything should be fixed now.

const IgniteClientConfiguration = IgniteClient.IgniteClientConfiguration;
const CacheConfiguration = IgniteClient.CacheConfiguration;
require("dotenv").config();
let igniteModule = {};
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

igniteModule should be declared const instead of let

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.

2 participants