帆升降机在生产中不起作用

时间:2015-06-12 07:20:56

标签: mysql node.js amazon-web-services sails.js production

我正在部署我的第一个sails.js应用。我已经采用了AWS MySQL RDS个实例。我尝试将我的本地sails.js应用程序连接到RDS实例。我更改了config/env/production.jsconfig/models.jsconfig/connection.js中的连接参数,如下所示。

***** 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"
// }

};

当我运行sails lift --prod时,我收到以下错误。

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

我尝试将超时从20000增加到60000.它没有帮助。

我将config/env/development.js更改为指向RDS并执行了sails lift,它运行良好。

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!
    }

};

我已成功将RDS连接到MySQL Workbench

我迷路了。我在这里错过了什么吗?

0 个答案:

没有答案