The Staging Repository runs on top of NodeJS and uses a No-SQL database for storage. By default it uses MongoDB.
1, Install NodeJS.
2. Install MongoDB.
3. Install Git.
4. Check out the project with git or download it from here.
git fetch && git checkout develop
5. Configure npm to connect to Search Technologies artifactory repository for local dependencies:
- Open cmd as Administrator.
npm install npmrc npmrc -c local npm config set registry https://repository.searchtechnologies.com/artifactory/api/npm/npm-virtual
6. Get the Authentication token.
curl -u<USERNAME>:<PASSWORD> https://repository.searchtechnologies.com/artifactory/api/npm/auth
7. Append response to: C:\Users\<USERNAME>\.npmrcs\local
8. Save the file.
9. Install dependencies:
npm install
10. Start MongoDB.
mongod
11. Launch the Staging Repository.
node server.js
Storage
The Staging Repository data is stored in a No-SQL database. By default, the Staging Repository uses MongoDB as its storage option. Custom plugins can be developed for other No-SQL databases.
The Staging Repository will create the database and all necessary collections (contents, transactions, settings, foreignkeys, and reprocesses) automatically that are used by each Storage Unit.
Environment Configurations
The Staging Repository can hold the configuration for multiple environments. The config/env
folder holds the different configuration files for all environments. An environment configuration will inherit the configuration present in the config/env/all.js
file and can overwrite any configuration field by redefining it on the environments file. New configuration fields can be added to the environment file.
All configuration example:
'use strict'; module.exports = { app: { title: 'Staging Repository', description: 'Staging Repository', keywords: 'MongoDB, Express, Node.js' }, port: process.env.PORT || 3000, templateEngine: 'swig', dbConn: { type: 'mongo', hbase:{ server: 'hadoop-thrift-server', port: 9090 }, mongo:{ server:'localhost', port: 27017, sharding: false } }, keyManager:{ type:'filebased', keysNumber: 1000, filebased:{ masterKeyLocation: 'config/MasterKey.txt' } }, reqBodySize: '1gb', reprocessQueue:{ batchSize: 20, querySize: 40, timeout: 3000 }, clusterMode: false };
Environment specific configuration (secure.js)
In this example, the port and clusterMode parameter will be overridden. authList, logging, keyLocation, certLocation, caLocation, and passphrase will be added to the applications configuration.
'use strict'; module.exports = { port: 44300, authList :[ 'Aspire', 'testuser' ], logging:{ express: { request: [ 'connection.remoteAddress', 'authorizedCN' ], response: [ ] }, transports:{ console:{ level: 'debug', enable: false }, file:{ level: 'info', enable: true } } }, keyLocation: 'config/sslcerts/sr_server_key.pem', certLocation: 'config/sslcerts/sr_server_cert.crt', caLocation: 'config/sslcerts/cacert.crt', passphrase: '123456abC', clusterMode: true };
To start the Staging Repository with a specific environment configuration:
- Set the environment configuration name to the NODE_ENV environment variable.
- If the variable is not set, the application will start with the development configuration by default.