8

I want to deploy sails.js (version 0.9.7) app to Openshift but after git push I get this log:

debug: Lowering sails...
DEBUG: Starting child process with 'node app.js'
.
.
.
info: Server lifted in `/var/lib/openshift/525ccaba5973caa65100002b/app-root/runtime/repo`
info: To see your app, visit http://127.7.215.1:8080
info: To shut down Sails, press <CTRL> + C at any time.
.
.
debug: --------------------------------------------------------
debug: :: Tue Oct 15 2013 03:03:56 GMT-0400 (EDT)
debug: 
debug: Environment      : development
debug: Host             : 127.7.215.1
debug: Port             : 8080
debug: --------------------------------------------------------
.
.
error: Server doesn't seem to be starting.
error: Perhaps something else is already running on port 8080 with hostname 127.7.215.1?
.
.
debug: Lowering sails...
DEBUG: Starting child process with 'node app.js'

Following a few tips from this thread on GitHub and also checked the sample config/local.js https://gist.github.com/chrisaiv/5938158

After test any of combination the Openshift server is just restarting over and over. I have also tested several ports like 8080, 80, 1337, ... and I don't think so are all busy. I've tried to run nodeapp.js and application surprisingly works on port 8080 but just till I try access to views/home/index, probably because from ssh I haven't enought rights.

Just in case, here how my config/local.js file looks like:

module.exports = {
        port: process.env.OPENSHIFT_NODEJS_PORT,
        host: process.env.OPENSHIFT_NODEJS_IP
        }

thank you for any advice;-)

zabumba
  • 12,172
  • 16
  • 72
  • 129
m1uan
  • 528
  • 6
  • 16
  • I have used openshift before. Its only a hassle...its better not to work on that web/cloud solution. – Merlin May 21 '14 at 15:47

1 Answers1

1

The reason your app will keep restarting over and over is because sails application create a folder called .tmp and put all assets into it. Which means your sails application will write local files. But Openshift use node-supervisor to start node application, and node-supervisor monitor all file changes after starting the application. If any file is changed, node-supervisor will restart the server.

You can try npm i supervisor -g and start your application by typing node-supervisor app.js to see the same log.

I think the solution is to make SailsJS stop writing local files, but I am not sure how to do that yet.

zabumba
  • 12,172
  • 16
  • 72
  • 129
  • Thank you for your info;-) may will help just set the path of .tmp files somewhere to tmp folder which is provide by openshift enviroment. I moved my project to Hapi library which is works fine, but for next project i would like to back to sails which seems like cool staff, thank you one more time;-) – m1uan Nov 05 '13 at 05:35