Ahmed farag mostafa
Ahmed farag mostafa

Reputation: 2934

sails js set environment production

i try to set node_env= production on my server it doesn't work when i try to run

sails lift --prod 

i have an error

    Warning: connect.session() MemoryStore is not
designed for a production environment, as it will leak
memory, and will not scale past a single process.
Warning: connect.session() MemoryStore is not
designed for a production environment, as it will leak
memory, and will not scale past a single process.

and sails run on port 1337 i set port forwarding using this command

sudo iptables -t nat -A PREROUTING -i eth0 -p tcp --dport 80 -j REDIRECT --to-port 3000

now i have sails app run on port 80 but still sails env development i need ti change env to manage my assets
my production.js file :-

  appUrl:'http://myserver.me/'

   models: {
    connection: 'someMysqlServer'
   },
   port: 80,

when i use

sails.config.appUrl

output :- http://localhost:1337 returned from development.js not production.js

Upvotes: 0

Views: 1939

Answers (1)

Ahmed farag mostafa
Ahmed farag mostafa

Reputation: 2934

i find solution as mentioned here : How to add production mode to sailsjs app when started using PM2

pm2 start app.js -x --prod

Upvotes: 1

Related Questions