- Sign Up
- Get assigned a git repo
- Clone the repo locally
- Put code in the repo
- git commit and then git push
Upon pushing the code up, it will execute your server (Sometimes you'll need to write a small config file to tell it What to run) and you're done. I'm using it for Node.js along with what they call a cartridge for MongoDB. Just purring right along until yesterday, when I get this error during a git push:
remote: Stopping NodeJS cartridge remote: Warning: Application '(appname)' nodejs PID (322361) does not match '$OPENSHIFT_NODEJS_PID_DIR/cartridge.pid' (14154 remote: 390925). Use force-stop to kill. remote: An error occurred executing 'gear prereceive' (exit code: 141) remote: Error message: Failed to execute: 'control stop' for /var/lib/openshift/(username)/nodejs remote: remote: For more details about the problem, try running the command again with the '--trace' option. To ssh://(username)@(app name).rhcloud.com/~/git/(app name).git/ ! [remote rejected] master -> master (pre-receive hook declined) error: failed to push some refs to 'ssh://(username)@(app name).rhcloud.com/~/git/(app name).git/'
Well, that's annoying. I did find that I can connect in and manually restart the app by killing the running node pid (ps aux lists it, and then kill (pid) to kill it.) Because they're running 'supervisor' it'll respawn the node process. However, it didn't actually seem to get my git push either. So, I'm now re-running the old code. Not very handy. Of course, there's no way I can git push 'force-stop' and it actually be valid, so I'm left wondering what I can do to get back up and developing.
Turns out, it's not that hard to fix. Observe:
# ssh (username)@(app name).rhcloud.com (app name) (username)]> ps aux USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND 1313 315834 0.3 0.4 471888 34752 ? Sl 21:51 0:02 /usr/bin/mongod --auth -f /var/lib/openshift/(username)/mongodb//conf/mongodb. 1313 319791 0.0 0.0 104916 3120 ? S 21:52 0:00 sshd: (username)@pts/0 1313 319809 0.0 0.0 108608 2064 pts/0 Ss 21:52 0:00 /bin/bash --init-file /usr/bin/rhcsh -i 1313 322361 0.6 0.7 733380 57516 ? Sl 21:53 0:03 node server.js 1313 360061 2.0 0.0 110240 1148 pts/0 R+ 22:02 0:00 ps aux 1313 390906 8.1 0.1 1021104 9008 ? Sl Dec10 226:34 node /opt/rh/nodejs010/root/usr/bin/supervisor -e node|js|coffee -p 1000 -- server.js (app name) (username)]> vi $OPENSHIFT_NODEJS_PID_DIR/cartridge.pid
Now, that will open up vi with the pid file in it. Your PID's might vary, but you're going to want to delete whatever is in this file, and put the pid of the node process (in bold above). In my case here, it was 322361. Once I put that in there and saved it (ESC :wq <= For you non-vi types), you should be back in business. Run another git push and you should be back to your normal git output, something along these lines:
Counting objects: 8, done. Delta compression using up to 4 threads. Compressing objects: 100% (6/6), done. Writing objects: 100% (6/6), 679 bytes | 0 bytes/s, done. Total 6 (delta 4), reused 0 (delta 0) remote: Stopping NodeJS cartridge remote: Stopping MongoDB cartridge remote: Saving away previously installed Node modules remote: Building git ref 'master', commit f9d21d1 remote: Building NodeJS cartridge remote: npm info it worked if it ends with ok remote: npm info using npm@1.2.17 remote: npm info using node@v0.10.5 ... remote: npm info ok remote: Preparing build for deployment remote: Deployment id is a878ff76 remote: Activating deployment remote: Starting MongoDB cartridge remote: Starting NodeJS cartridge remote: Result: success remote: Activation status: success remote: Deployment completed with status: success
No comments:
Post a Comment