Entry tags:
Dreamhack reinstallation dilemma
As most people here will know, I'm the maintainer of the Dreamhacks service which allows you to have a Dreamwidth development environment quickly and easily.
Some people will also know that lately the reinstallation script hasn't been working for some time. It's been broken ever since the move to git and GitHub, and I recently put a check in there so that anybody trying to use it won't accidentally end up with an unuseable 'hack. (By the way, if anybody does have an unuseable 'hack because of this, please feel free to let me know and I'll gladly reinstall you by hand!)
Although it should be fairly easy to get the reinstaller script working again, I've been running into some issues that I'm not entirely sure how to address. If you have a Dreamhack account, please read inside the cut as this could quite possibly affect you.
The point of the reinstaller script back in the Mercurial days was so that if you end up with a 'hack that you didn't know how to fix, it would be possible to easily get back to a working state by reinstalling your Dreamhack account as if you were a completely new user, without you having to worry about bothering anybody. You'd lose your work in the process unless you had backed it up, but you'd be pretty much guaranteed a working 'hack and being able to get back to somewhere you knew. A lot of people used it and I've heard from a lot of people that it was really helpful.
It worked because the previous setup procedure for Dreamhacks meant getting a completely fresh copy of the code straight from the official repository, so unless any bugs had been committed into the official codebase, it would be guaranteed to work as expected.
However, this isn't the case any more - the setup process for Dreamhacks now involves forking the official repository and setting up the Dreamhack to pull from that repository instead. As a result, if you've already pushed the commits that broke your Dreamhack to your own repository, a reinstall wouldn't help because it'd just pull the broken commits straight back down. It may not even fix a broken repository, depending on the situation; all in all, there's no guarantee any more that the reinstall process would get you to a known state any more. It would all depend on what you had pushed to the repo before you reinstalled.
I have an idea for how this might be fixable, but it would require a fair amount of code on my part and I want to be sure that it's worth it, so I thought I'd come to you guys for ideas!
My own idea involves something I've been planning for a while anyway - the ability to link Dreamhack SSH accounts with GitHub via OAuth. It would take some work, but with this in place it would be possible to have a reinstallation process that could (after making VERY clear what it would do) delete your dw-free/dw-nonfree repositories on GitHub and re-fork them automatically, either as part of the process or (more likely) as a separate script which you could run beforehand. The reinstallation could then proceed using these newly re-forked repositories, and the end result would be almost exactly the same as what you would have had under the old script - code that comes straight from the horse's mouth, as it were, and an almost-sure guarantee that you would get a working 'hack out of it, bar any bugs in the official codebase.
It's probable that something like this would be best implemented as two scripts - the reinstallation script as it is right now (or at least as it would be if it were working) that uses your current GitHub repositories, and a script you could run beforehand if you wanted to to do the deleting/re-forking. I think this would be the best way, personally, because the main reason to have the reinstall process is to make it quick, easy, and not require many spoons. While having two commands to run does take some more spoons, I believe that it's worth it to stop people from accidentally wiping out all their work (since people wouldn't normally expect a reinstallation on the Dreamhack machine to affect GitHub).
However, these are just my ideas. It's quite possible that people here have better ideas, and that's why I'm here. Do you have any ideas about how the reinstallation script should work? Is the process I've outlined too easy to accidentally activate, too difficult to work with, or something else? Things like that. The Dreamhack machine is your resource and I want to make it as easy as I can to hack on the code while not getting in your way. How can I do that in this case?
Some people will also know that lately the reinstallation script hasn't been working for some time. It's been broken ever since the move to git and GitHub, and I recently put a check in there so that anybody trying to use it won't accidentally end up with an unuseable 'hack. (By the way, if anybody does have an unuseable 'hack because of this, please feel free to let me know and I'll gladly reinstall you by hand!)
Although it should be fairly easy to get the reinstaller script working again, I've been running into some issues that I'm not entirely sure how to address. If you have a Dreamhack account, please read inside the cut as this could quite possibly affect you.
The point of the reinstaller script back in the Mercurial days was so that if you end up with a 'hack that you didn't know how to fix, it would be possible to easily get back to a working state by reinstalling your Dreamhack account as if you were a completely new user, without you having to worry about bothering anybody. You'd lose your work in the process unless you had backed it up, but you'd be pretty much guaranteed a working 'hack and being able to get back to somewhere you knew. A lot of people used it and I've heard from a lot of people that it was really helpful.
It worked because the previous setup procedure for Dreamhacks meant getting a completely fresh copy of the code straight from the official repository, so unless any bugs had been committed into the official codebase, it would be guaranteed to work as expected.
However, this isn't the case any more - the setup process for Dreamhacks now involves forking the official repository and setting up the Dreamhack to pull from that repository instead. As a result, if you've already pushed the commits that broke your Dreamhack to your own repository, a reinstall wouldn't help because it'd just pull the broken commits straight back down. It may not even fix a broken repository, depending on the situation; all in all, there's no guarantee any more that the reinstall process would get you to a known state any more. It would all depend on what you had pushed to the repo before you reinstalled.
I have an idea for how this might be fixable, but it would require a fair amount of code on my part and I want to be sure that it's worth it, so I thought I'd come to you guys for ideas!
My own idea involves something I've been planning for a while anyway - the ability to link Dreamhack SSH accounts with GitHub via OAuth. It would take some work, but with this in place it would be possible to have a reinstallation process that could (after making VERY clear what it would do) delete your dw-free/dw-nonfree repositories on GitHub and re-fork them automatically, either as part of the process or (more likely) as a separate script which you could run beforehand. The reinstallation could then proceed using these newly re-forked repositories, and the end result would be almost exactly the same as what you would have had under the old script - code that comes straight from the horse's mouth, as it were, and an almost-sure guarantee that you would get a working 'hack out of it, bar any bugs in the official codebase.
It's probable that something like this would be best implemented as two scripts - the reinstallation script as it is right now (or at least as it would be if it were working) that uses your current GitHub repositories, and a script you could run beforehand if you wanted to to do the deleting/re-forking. I think this would be the best way, personally, because the main reason to have the reinstall process is to make it quick, easy, and not require many spoons. While having two commands to run does take some more spoons, I believe that it's worth it to stop people from accidentally wiping out all their work (since people wouldn't normally expect a reinstallation on the Dreamhack machine to affect GitHub).
However, these are just my ideas. It's quite possible that people here have better ideas, and that's why I'm here. Do you have any ideas about how the reinstallation script should work? Is the process I've outlined too easy to accidentally activate, too difficult to work with, or something else? Things like that. The Dreamhack machine is your resource and I want to make it as easy as I can to hack on the code while not getting in your way. How can I do that in this case?
no subject
no subject
That said, there are certainly easier ways to do it, and I think it would be perfectly reasonable to give users a set of commands to run. Something like... when you trigger a reinstallation, it first prompts you to reset your forks with some sort of "hi! to do this, this will DELETE YOUR CHANGES ON GITHUB! you have to do..." and then give them some git commands to run.
So the process would actually check out official dw-free/dw-nonfree repositories, then it would prompt the user to force push those up to their own github forks.
I think that'd be perfectly acceptable, too.
no subject
I'd be really nervous about the dreamhack reinstall script nuking your GH fork and stuff. I can see a lot of situations where you wouldn't want that to happen.
no subject
Does that make things any better?
no subject
First, a repo can have more than one remote. When you clone from a remote repo (like, for example, one on Github), git automatically creates an "origin" remote pointing back to where you cloned from. But that's just a convenience, there's nothing magic about it. You can add new ones just fine. With forked repos on Github, it's often useful to add one pointing back a the repo one forked from. In this case, that might be something like...
git remote add ur_source https://github.com/dreamwidth/dw-free.git
You can then fetch from that, base branches off of it, and if I understand the problem correctly that should do fine as the pristine starting point.
I think (but I haven't actually tested) that a reset process might go something like this, assuming ur_source is set already and the messed-up work is done on the local master branch:
1) Fetch from ur_source.
2) Rename the current master branch (git branch -m) to something predictable and auto-generated, just to keep history.
3) Create a new master branch based on remotes/ur_source/master.
4) Set the new master to track the old remotes/origin/master.
5) Push back to Github with --mirror to force it to look like the local repo.
6) Proceed working on the new master branch.
One possible drawback is that any local branches made from the messed-up master would still be based on that, and have the problems intact. I'm not sure if that would be a problem or not. Nor am I sure if all this works at all, I just think it should. It shouldn't take that long to give it a manual try, if you think it looks like it might be useful.
no subject
Firstly, a bit of background: A lot of our developers are fairly new to git, and in fact to programming in general. One of the aims of the Dreamhack box is to provide a playground to encourage messing around with the code without fear that anything you do will mess up your Dreamhack beyond repair, because if you're not sure whether you might mess things up, it can really get in the way of experimentation. Yes, people can always ask me for help (and I'm always open to helping people!), but it's a fact of human nature that you generally don't want to bother other people with problems that you consider to have been your own fault, especially if it's something that sounds like it should be major, like reinstalling your account or unbreaking your Dreamhack.
When it worked, the reinstaller script could be triggered by running a single command. Within a minute, the reinstaller would warn you what it was going to do. Within another minute, it logged you off the system, killed all your processes, deleted your user account and everything associated with it, and then set you back up again as if you were a completely new user. In total, it took about 5-10 minutes, and you would be back up and running again, being guaranteed a working Dreamhack without having to talk to a soul. That sort of guarantee is invaluable in a "playground" environment such as this. (I'd call it a sandbox, but it isn't a sandbox in the true technical sense of the word, hence "playground" instead.)
OTOH, while you're almost certain to be able to get back to a working state with git in the way you describe, there are several reasons why that might not be the best method. From a technical perspective, the local git repository may be corrupted in such a fashion that it just doesn't work as expected. From a psychological perspective, because git never throws away commits, you'll still know that your old "baggage" is still in there somewhere, which might throw you off. You would also need to make sure your old branches were deleted, otherwise you might accidentally refer to them in a future command and end up with something wholly unlike what you expected.
Deleting and re-forking on GitHub, then reinstalling the local user account, is by far the easiest way to deal with these problems. (Why not just clone the re-forked repository back to the user account? Because it's not just repository problems that can affect your Dreamhack. Each Dreamhack has their own Apache configuration file which can be edited as need be, and it's possible - though unlikely - that if you were editing the config, or removed the file totally, you could break your Dreamhack that way. While it would be easy enough to fix - and in fact I may just make a script to make it easy to replace your Apache config file if need be - it's another thing that can go wrong.)
All told, it's about three things - a guarantee that it's going to work as you expect it to, a psychological guarantee that you're not going to have anything left that could mess it up, and the knowledge that you don't have to tell anybody if you don't have the spoons for human interaction; you can just reinstall and continue hacking.
Hopefully that helps clear up why I think doing this is the best way in this case!
no subject
no subject
no subject
no subject
rm -rf $LJHOME
git clone https://github.com/dreamwidth/dw-free.git $LJHOME
cd $LJHOME
git remote rename origin dreamwidth
git remote add origin https://github.com/[username]/dw-free.git
And then prompt the user whether or not to pull from their origin? If they try it and pull, and the hack is still broken, they can run it again and not pull, and telling it not to pull will also tell them how to go about recreating their forks?
no subject
--set-upstream
branch commands, etc), but it's possible that there might be problems that are outside of the repository. I talk about that in my reply to cdybedahl above, among other things.It's definitely something I'll consider if it turns out to be something which works out better though!
no subject
It seems that there are two nearly separate things going on,
1. Nuking and re-forking the github repo
2. Producing a clean Dreamhack account with a clone of this repo.
Part 2 is something that we should absolutely have an updated script for.
Part 1... I'm not sure that it isn't best just to ask the user to do this. They already know how to fork from the main DW repo, because they had to do that when they started. So it should be very straightfoward to delete their own repo and re-fork. We could even provide instructions... but my gut instinct is that automating that away adds a lot of complexity (need for OAuth and so on) without much gain, and also risks making it harder for people to learn / understand what is going on.
Just my 2p - I'm probably not quite the target audience :-)
no subject
As for needing OAuth, I've been wanting OAuth support for some time now, because that allows for a whole load of other things too, like the possibility to have a script to let you create pull requests directly from the command line without needing to go to the website. So it wouldn't just be for this project.
Do these points make it any different for you?
no subject
I guess this is part of the "how much do we insulate people from git" discussion - and for me I kinda feel that if users don't know how to delete a repo on github and fork a repo on github (the latter being something they must have done anyway), they probably ought to learn?
Not a big deal, just a thought:-)
no subject
For me, I'm not coming at it from a "trying to insulate people from git" discussion as much as a "how to do this in a manner that conserves spoons". Deleting and re-forking on GitHub is fairly easy, true, and as you mention they would have knowledge of the forking part of it anyway. In fact, I've been going back-and-forth in my mind about how necessary the separate script is myself (vs. manually deleting and re-forking if you need to do that).
Certainly, I think more discussion is needed on this. I've given an overview of where I personally am coming from in a previous comment, and while nuking/re-forking is definitely destructive and not what most people would recommend, I think that it does have its advantages. Is it the best option? I'm still not entirely sure, but I'm leaning towards "Yes". (As a separate optional script, like I say.)
no subject
Also, given this, I think that just having one script is the better choice. With the goal of making an unsure user feel safe(r), fewer options is better.
no subject
no subject
I don't particularly have any opinion in the part about whether the first section should be a script or not. I don't think there's value in making it NOT be a script - newbies just cut-and-paste the commands anyway, without always stopping to understand. But on the other hand I don't particularly *mind* cutting-and-pasting so either would be fine as long as it gets the job done.
But anyway I wanted to post here just to say I have almost nothing on my 'hack that isn't 'stock' and I'm happy to mess around so if you're looking for a user to test things let me know :) I love that stuff!
no subject
no subject
no subject
I'll gladly reinstall you. Do you have a GitHub account? If not, you'll need one before I can reinstall you. Once you have a GitHub account, you'll also need to fork Dreamwidth's dw-free" and "dw-nonfree" repositories. To do this, after you've created your account, you'll need to go to each of these pages linked above and click "Fork" at the top right.
After doing this, you'll have your own copy of the code. Then, to reinstall I'll need to know your GitHub username, so I can set your account up with your repositories specifically. (I don't need your password.)
Also, do you have anything you want to keep from your account? The process will wipe any patches or anything you have there, so if you have anything you want to keep, you'll need to take care of that first.
no subject
My github account is also 'chebe'. I've forked the two repos (dw-free might be a bit old, hope that doesn't matter).
I don't need to keep anything there, go ahead, blast away!
*excited*
no subject
To delete the repositories from GitHub, you'll need to go to the Settings tab on your repositories at:
* https://github.com/chebe/dw-free
* https://github.com/chebe/dw-nonfree
Click on the "Settings" tab on the right, and then once at the Settings page, at the bottom you'll find a red box marked "Danger Zone", with one of the options being to delete the repository. Click that button and then type "chebe/dw-free" to confirm (and "chebe/dw-nonfree" for the other one, of course). Then, you can fork the repositories again using the instructions in the other comment.
Let me know how you want to continue and if there are any problems!
no subject
no subject
no subject
Yep, you're missing a step - you need to be somewhere within the ~/dw/ ($LJHOME) directory before you can do any git commands. The git repository you were looking at is the repository for the Dreamhack machine itself, not your Dreamhack installation.
A lot of people are getting caught out by this so I'm tempted to see if I can make something that can help in this case.
no subject
no subject