Is it possible to run multiple instances of the deepstream.io server inside one node (computer)? Each instance will listen on different port, store in different storage, etc. Use case is when one instance is used for the production and other for the staging - production and staging use different MongoDB databases for storage.
Absolutely, just make sure to point them to two different configuration files when starting. Here's how it would work on e.g. AWS Linux:
Install deepstream
sudo wget https://bintray.com/deepstreamio/rpm/rpm -O /etc/yum.repos.d/bintray-deepstreamio-rpm.repo
sudo yum install -y deepstream.io
Copy the permission file and two versions of the config file
cp /etc/deepstream/config.yml config-dev.yml
cp /etc/deepstream/config.yml config-prod.yml
cp /etc/deepstream/permissions.yml permissions.yml
Change the ports (and anything else you'd need) in the config file
and then start both with
deepstream start -c config-dev.yml
deepstream start -c config-prod.yml
resulting in
To better handle multiple deepstream processes running on the same machine, I'd recommend using a tool like PM2
Its node-based, so you'd install it on AWS via
curl --silent --location https://rpm.nodesource.com/setup_6.x | sudo bash -
sudo yum -y install nodejs
sudo npm install -g pm2
Now you can run multiple processes with different configurations as follows
pm2 start --name ds-dev deepstream -- start -c ~/config-dev.yml
pm2 start --name ds-prod deepstream -- start -c ~/config-prod.yml
resulting in
PM2 allows you to easily start / end / restart / monitor individual processes using their IDs, e.g. pm2 stop 0
and keeps track of your logs, restarts processes etc...