0

I'll keep this short. I have Deployd setup on a Linux server.

If I run "dpd" on the commandline, it starts correctly, connects to the database (located at /data/db). It shows my data and runs exactly how I would expect.

I have created a startup js file for PM2 to use.

The recommended line(s) from the Deployd docs are:

var server = deployd({
   port: process.env.PORT || 5000,
   env: 'production',
   db: {
       host: 'my.production.mongo.host',
       port: 27105,
       name: 'my-db',
       credentials: {
           username: 'username',
           password: 'password'
       }
    }
});

I don't know of any of this information because I have just been using the defaults. I was hoping to use this line instead:

var server = deployd();

When PM2 is restarted this actually starts up Deployd correctly but does not connect to the MongoDB. Does anyone know what information I should be putting in there or how at least I could find it out? I have tried some variations such as host: 'localhost', port: 27105, name: 'db' and with no credentials but I can't seem to get it to work. Are there default credentials I should be putting in?

Edit: The defaults appear to be...

{
    port: 2403,
    db: {port: 27017, host: '127.0.0.1', name: 'deployd'}
}

Which don't break when used, but still don't connect to the MongoDB, leading me to think it's not a problem with the credentials.

Varrick
  • 627
  • 1
  • 6
  • 11

2 Answers2

0

Well to solve the problem I created a bash script with the two commands:

cd /my/path;
dpd -e "production";

I then added this to PM2. This is a workaround not really a solution but I guess it will do.

Varrick
  • 627
  • 1
  • 6
  • 11
0

The dpd command handles starting a mongodb instance for you for convenience. However, this should only be used for development and quick prototyping.

For production purposes it's better if you start mongodb separately as a service either via mongod --dbpath <path> --fork or with service mongodb start and using your own startup script to connect to it.

andreialecu
  • 3,639
  • 3
  • 28
  • 36