简体   繁体   中英

metadata.json not found when pushing to openShift git

I am trying to push a second version of my app (nodeJS + MongoDB) into my OpenShift account. It worked the first time, but now it fails with this error:

Erics-MacBook-Air:rippleRating ericg$ git push openShift master
Counting objects: 129, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (129/129), done.
Writing objects: 100% (129/129), 28.09 KiB | 0 bytes/s, done.
Total 129 (delta 94), reused 0 (delta 0)
remote: Stopping NodeJS cartridge
remote: Mon Apr 13 2015 07:53:08 GMT-0400 (EDT): Stopping application 'ripplerating' ...
remote: Mon Apr 13 2015 07:53:09 GMT-0400 (EDT): Stopped Node application 'ripplerating'
remote: Stopping MongoDB cartridge
remote: No such file or directory - /var/lib/openshift/xxxxxxxxxxxxxxxxf8000090/app-deployments/2015-04-13_07-53-10.382/metadata.json
To ssh://xxxxxxxxxxxxxxxxf8000090@ripplerating-<domain>.rhcloud.com/~/git/ripplerating.git/
! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'ssh://xxxxxxxxxxxxxxxxf8000090@ripplerating-<domain>.rhcloud.com/~/git/ripplerating.git/'

If I rhc ssh to my app, I don't see the directory 2015-04-13_07-53-19.382 , I have only app-files , current and by-id ( app-files has the metadata.json ).

BTW what would be a good place to add some files ( secret.json ) that I don't want to put in the git repo and can be used by the nodeJS app?

Thanks!

I recently came across this problem myself and wanted to share how I came to a solution.

To start, my /app-deployments directory contained the following:

by-id  current redis-cli

Using ls -l reveals that current is actually a soft link to the currently running build.

current -> 2015-07-10_22-45-22.964

However, using the command file current also revealed that:

current: broken symbolic link to `2015-07-12_22-45-22.964'

That seemed strange, but it was consistent with the fact that there was no folder in the /app-deployments directory named with the most recent build's timestamp (2015-07-10_22-45-22.964). I removed current and attempted to push. Same result as the OP however, missing folder or directory for the new build with metadata.json inside.

After poking around in by-id and redis-cli , I found that redis-cli contained it's own metadata.json file with a lot of null values in it (both 'git_sha1' and 'id' were null). I played with the git_sha1 field to match both my previous and new commits, but nothing changed. The other folder, by-id , had a soft link in it as well which pointed to the redis-cli folder.

At this point I had backed up everything I wanted and I attempted to force a refresh to defaults of the /app-deployments directory by deleting everything in it and pushing. Surprisingly, it worked! Now my /app-deployments directory looks like this:

2015-07-10_22-45-22.964  by-id  current

which is what I normally expect to see in there. Hopefully this will be helpful to someone!

As a side note, I later decided to enable openshift's support for multiple rollback versions, which you can read about here . It allows you to specify how many rollbacks you want to keep, which could be very valuable in another situation like this.

I finally got to the bottom of this one. I had created a folder under app-deployments, and that upsets the auto deployment logic in OpenShift. The current folder was deleted under app-deployments and I have to recreate it and put a metadata.json copy in it. Once I have done that I was able to deploy again using git push. I am gessing that if you have some secret data that cannot be kept in the git repo, they have to reside under app-root/data although this won't work for a scalable app... which in this case I am not sure where should I put those sensible data...

My answer is basically the one provided by @Will.R but shorter:

The problem comes from the fact that:

* app-deployments/current is a broken symbolic link to the most recent build.

If you want to fix this problem:

* Delete everything inside /app-deployments
* Push again
* :) 
* Problem fixed.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM