Skip to content

Deploy NodeJS + MongoDB + Nginx (CTM stack)

John Sundarraj edited this page Sep 10, 2024 · 2 revisions

Modify hosts

Windows

# Modify hosts configuration.
$ notepad C:\Windows\System32\drivers\etc\hosts
192.168.101.6  app.ctm.sloopstash.dv app-static.ctm.sloopstash.dv
192.168.101.6  app.ctm.sloopstash.qaa app-static.ctm.sloopstash.qaa
192.168.101.6  app.ctm.sloopstash.qab app-static.ctm.sloopstash.qab

Mac and Linux

# Modify hosts configuration.
$ sudo nano /etc/hosts
192.168.101.6  app.ctm.sloopstash.dv  app-static.ctm.sloopstash.dv
192.168.101.6  app.ctm.sloopstash.qaa app-static.ctm.sloopstash.qaa
192.168.101.6  app.ctm.sloopstash.qab app-static.ctm.sloopstash.qab

Configure environment variables

Supported environment variables

# Allowed values for $ENVIRONMENT variable.
* dev
* qaa
* qab

Set environment variables

# Store environment variables.
$ export ENVIRONMENT=dev

Bootstrap CTM stack environment

Docker

# Switch to Docker starter-kit directory.
$ cd /opt/kickstart-docker

# Provision OCI containers using Docker compose.
$ sudo docker compose -f compose/ctm.yml --env-file compose/${ENVIRONMENT^^}.env -p sloopstash-${ENVIRONMENT}-ctm up -d

Manage CTM stack environments

Docker

# Switch to Docker starter-kit directory.
$ cd /opt/kickstart-docker

# Stop OCI containers using Docker compose.
$ sudo docker compose -f compose/ctm.yml --env-file compose/${ENVIRONMENT^^}.env -p sloopstash-${ENVIRONMENT}-ctm down

# Restart OCI containers using Docker compose.
$ sudo docker compose -f compose/ctm.yml --env-file compose/${ENVIRONMENT^^}.env -p sloopstash-${ENVIRONMENT}-ctm restart