Sails lift not working in production

790 views Asked by At

I am deploying my first sails.js app. I have taken up an AWS MySQL RDS instance. I tried connecting my local sails.js app to the RDS instance. I had changed the connection parameters in config/env/production.js, config/models.js and config/connection.js as shown below.

***** config/connection.js ******

  myproduction: {
        module: 'sails-mysql',
        host: 'MySQLRDSHostName',
        port: 3306,
        user: 'myUserName',
        password: 'myPassword',
        database: 'myDatabaseName'
    }




***** config/models.js ******

module.exports.models = {

/***************************************************************************
 *                                                                          *
 * Your app's default connection. i.e. the name of one of your app's        *
 * connections (see `config/connections.js`)                                *
 *                                                                          *
 ***************************************************************************/
connection: 'myproduction',

/***************************************************************************
 *                                                                          *
 * How and whether Sails will attempt to automatically rebuild the          *
 * tables/collections/etc. in your schema.                                  *
 *                                                                          *
 * See http://sailsjs.org/#/documentation/concepts/ORM/model-settings.html  *
 *                                                                          *
 ***************************************************************************/
 migrate: 'safe' //This setting applies in production environment 


};



***** config/env/production.js ******

module.exports = {

/***************************************************************************
 * Set the default database connection for models in the production        *
 * environment (see config/connections.js and config/models.js )           *
 ***************************************************************************/

models: {
    connection: 'myproduction'
},

/***************************************************************************
 * Set the port in the production environment to 80                        *
 ***************************************************************************/

port: 80

/***************************************************************************
 * Set the log level in production environment to "silent"                 *
 ***************************************************************************/

// log: {
//   level: "silent"
// }

};

When I run sails lift --prod I get the following error.

info: Starting app...

error: 
------------------------------------------------------------------------
grunt-cli: The grunt command line interface. (v0.1.13)

Fatal error: Unable to find local grunt.

If you're seeing this message, either a Gruntfile wasn't found or grunt
hasn't been installed locally to your project. For more information about
installing and configuring grunt, please see the Getting Started guide:

http://gruntjs.com/getting-started

------------------------------------------------------------------------

error: Looks like a Grunt error occurred--
error: Please fix it, then **restart Sails** to continue running tasks (e.g. watching for changes in assets)
error: Or if you're stuck, check out the troubleshooting tips below.

error: Troubleshooting tips:
error: 
error:  *-> Are "grunt" and related grunt task modules installed locally?  Run `npm install` if you're not sure.
error: 
error:  *-> You might have a malformed LESS, SASS, CoffeeScript file, etc.
error: 
error:  *-> Or maybe you don't have permissions to access the `.tmp` directory?
error:      e.g., `/home/ec2-user/pick/pick-backend/.tmp` ?
error: 
error:      If you think this might be the case, try running:
error:      sudo chown -R YOUR_COMPUTER_USER_NAME /home/ec2-user/pick/pick-backend/.tmp

I tried increasing the timeout from 20000 to 60000. It didn't help.

I changed my config/env/development.js to point to the RDS and did a sails lift, it worked perfectly.

module.exports = {

    /***************************************************************************
     * Set the default database connection for models in the development       *
     * environment (see config/connections.js and config/models.js )           *
     ***************************************************************************/

    models: {
        connection: 'myproduction' //Just to check if it works!
    }

};

I was able connect the RDS to my MySQL Workbench successfully.

I'm lost. Am I missing something here?

0

There are 0 answers