INTO-CPS-Association / DTaaS

:factory: :left_right_arrow: :busts_in_silhouette: Digital Twin as a Service
https://into-cps-association.github.io/DTaaS/
Other
106 stars 51 forks source link

Improve services #828

Open prasadtalasila opened 2 weeks ago

prasadtalasila commented 2 weeks ago

The current services.js has two limitations.

  1. It is insecure
  2. It is not integrated into the deploy/docker/ installation procedures
prasadtalasila commented 2 weeks ago

The following procedure works for influxdb service.

  1. Have certificates issued by LetsEncrypt". Two files are generated: fullchain.pem and privkey.pem. Place them in /<dirpath>/certs/
  2. Change the certificate ownership to user executing docker command
  3. Change the influxdb start command in services.js to the following.
log(chalk.green("Start new InfluxDB server docker container"));
await $$`docker run -d -p ${influxdbConfig.port}:8086 \
  --name influxdb \
  --restart always \
  -v ${influxdbConfig.datapath}/data:/var/lib/influxdb2 \
  -v ${influxdbConfig.datapath}/config:/etc/influxdb2 \
  -v /<dirpath>/certs/fullchain.pem:/etc/ssl/fullchain.pem \
  -v /<dirpath>/certs/privkey.pem:/etc/ssl/privkey.pem \
  -e INFLUXD_TLS_CERT=/etc/ssl/fullchain.pem \
  -e INFLUXD_TLS_KEY=/etc/ssl/privkey.pem \
  -e DOCKER_INFLUXDB_INIT_MODE=setup \
  -e DOCKER_INFLUXDB_INIT_USERNAME=${influxdbConfig.username} \
  -e DOCKER_INFLUXDB_INIT_PASSWORD=${influxdbConfig.password} \
  -e DOCKER_INFLUXDB_INIT_ORG=dtaas \
  -e DOCKER_INFLUXDB_INIT_BUCKET=dtaas \
  influxdb:2.7`;
log(chalk.green("InfluxDB server docker container started successfully"));

Ref: stackoverflow