You should read the documentation about
the already available services
This guide will show you how to add more services.
In the following example we will be adding MongoDB as a service,
but these steps could be modified to install other services as well.
Adding other services requires more RAM and CPU power.Please make sure the host machine meets the hardware requirementsfor running all the services.
1. Add the configuration:
Select configuration parameters for the MongoDB service.
Configuration Variable Name
Description
username
the username of the root user in the MongoDB
password
the password of the root user in the MongoDB
port
the mapped port on the host machine (default is 27017)
datapath
path on host machine to mount the data from the MongoDB container
Open the file /deploy/services/services.yml and add the configuration for MongoDB:
#!/usr/bin/node/* Install the optional platform services for DTaaS */import{$}from"execa";importchalkfrom"chalk";importfsfrom"fs";importyamlfrom"js-yaml";const$$=$({stdio:"inherit"});constlog=console.log;letconfig;try{log(chalk.blue("Load services configuration"));config=awaityaml.load(fs.readFileSync("services.yml","utf8"));log(chalk.green("configuration loading is successful and config is a valid yaml file"));}catch(e){log(chalk.red("configuration is invalid. Please rectify services.yml file"));process.exit(1);}log(chalk.blue("Start MongoDB server"));constmongodbConfig=config.services.mongodb;try{log(chalk.green("Attempt to delete any existing MongoDB server docker container"));await$$`docker stop mongodb`;await$$`docker rm mongodb`;}catch(e){}log(chalk.green("Start new Mongodb server docker container"));await$$`docker run -d -p ${mongodbConfig.port}:27017 \ --name mongodb \ -v ${mongodbConfig.datapath}:/data/db \ -e MONGO_INITDB_ROOT_USERNAME=${mongodbConfig.username} \ -e MONGO_INITDB_ROOT_PASSWORD=${mongodbConfig.password} \ --restart always \ mongo:7.0.3`;log(chalk.green("MongoDB server docker container started successfully"));
3. Run the script:
Go to the directory /deploy/services/
and run services script with the following commands: