New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Upgrade botched user accounts #797
Comments
Hi Geoff, The upgrade guide can be found in our wiki. For admins following the latest edge builds, it is paramount that they stay up to date as the upgrade script is _reset after every minor revision_. For those who upgrade less frequently, it is advised that they do not stay on the master branch, and instead drop down to a stable branch such as The source of your problems seems to be that you may have upgraded from 0 First off, back up your Redis database. We'll try to re-run the update. Secondly, drop down to the v0.2.x branch:
Once you get this far, you'll have to dive into Redis (possibly using redis commander) to restore your original users' accounts that got overwritten. |
When it comes to why this happened -- the upgrade script was cleared at some point, although I don't recall why, since there have been no minor revisions since your original commit. Alternatively, you can email us your database, and we can see if we can get it sorted out... |
Hey Julian, Thanks for the info. I wasn't aware of the upgrading policies (my fault) and performed the upgrade as I usually do. Previous to the upgrade, my admin panel listed our NodeBB version as 1.1, so we shouldn't have been upgrading from 0. Not sure if that makes any difference. Thanks for your help, too. I realize this is my doing and I made the classic mistake of not monitoring my backup script, so I hope my original post didn't come across otherwise. I'll try to drop down to 0.2 and re-run the upgrade and see how it goes. /crosses fingers |
I dropped down to v0.2.x and ran Checked out
|
The next user id used to be a global key called The upgrade script tries to read the old key and set the new key here https://github.com/designcreateplay/NodeBB/blob/v0.2.x/src/upgrade.js#L236. If it fails ie cant find the old key it will use an initial value. You can check if the upgrade successfully created those keys through redis-cli. You should get something similar to below after the upgrade.
|
@geoffb can you go into redis-cli and run this |
So, here's what I have after the upgrades:
And the result from the next command:
|
Hmm looks like the global object is missing some fields. Can you run |
Yep:
That looks about right. |
You can run these commands to fix the global object. Make sure the values are what you expect before running them. And make a backup of your db.
|
As those keys are already zsets, you can safely (liberally throwing that word out there) ignore that upgrade directive. Change this line in upgrade.js to ... then re-run |
Should I perform both of these fixes? (The posts from both @barisusakli and @julianlam) |
Try @julianlam's first then check if |
Follow @julianlam's steps with the following error:
|
https://github.com/designcreateplay/NodeBB/blob/324bec41c4ff03dce8abecfa9e5bd0d765fee834/src/upgrade.js#L364 |
@barisusakli Ran the upgrade script after making your edits and it completed with no errors. The results of |
Ok check the values you get from the |
Hopefully that should be the only things you need to do... barring fixing the overwritten user accounts, that is. I've done upgrades from v0.1.x to latest with no errors, although you do need to make a pit stop at v0.2.x as well. Once this is all said and done, would it be possible for you to send us a copy of your last known good copy of the db, so we can try running some upgrades on it for post mortem purposes? |
@barisusakli Here's what I've got:
They all look reasonable. I'm not sure what nextGid is, though. Should it be "1"? @julianlam There's only one overwritten account (which is mine, as I was the first user). The posts seem to be intact, but the user details are incorrect. How would I go about fixing that? I'll definitely send along a copy of our last known good data. Looking at my backups, it stopped updating on Nov 19 of last year. I don't think I've done any upgrades since then, but I'm not certain. Either way, I'll send along a copy of that data once I've got this all taken care of. Many, many thanks to both of you for spending time on your Friday night to help me out. :) |
To fix your user data since you are user id 1. You can do :
Just fix all the fields you need like that. |
So, I think we've got things mostly in working order. Thanks! I do have a few more issues, one of which is fairly critical:
Log warnings: warn: [socket.io] Unrecognized message: api:get_all_rooms |
Make sure you clear the browser cache that might cause those warnings. If there are no groups you might have to create the admin group manually.
If it doesnt exist create it from redis-cli.
Then do a
|
Before running Baris' commands, maybe give this a try? Looks like the "registered-users" and "admin" groups have been "merged". Give this a look:
The registered-users group is not of importance, and it should be re-created automatically by NodeBB |
Excellent! @julianlam was correct, the registered users group and administrators group had been merged into one. I fixed up the data in Redis as instructed and everything looks good on that front. I cleared my cache as @barisusakli suggested and that fixes my ACP issues as well. I can now update settings, etc. I think we're in good shape now. Thanks so much for helping me work through this. I'll be more careful next time around. :) |
Glad to hear everything is resolved 😄 |
Two items to address:
|
@julianlam @barisusakli imo I agree with the original decision to keep flushing out older upgrade paths (can you imagine how big that file will be a year from now?) instead, add a check to make sure we're not upgrading too far so something like a minver check for the last upgradable version would be best imo I'm re-opening this so we don't forget about it for 0.3.0 |
Agreed. I was thinking about how we could prevent this from happening
|
I upgrade our install of NodeBB tonight and it created a couple problems with our user data.
I've taken our forum offline while we address these issues.
Original commit: fcda27e
Upgraded commit: 324bec4
Something else odd was that after running the upgrade script, it ran me through the initial config again, but the defaults were our existing config values.
Anyway, a couple actionable things here:
Thanks for your help!
The text was updated successfully, but these errors were encountered: