-
fassembler:zeo doesn't work well if another process is using its port
from ejucovy on May 01, 2008 08:25 PMHey, As rmarianski and I discovered today, the zeo installer in fassembler really doesn't work well if zeo's port is already in use when fassembler builds zeo. That's because fassembler tries to start zeo, run a few scripts to add an openplans site, and then shut it down again before the build finishes, but it doesn't first check if the port is in use and ends up hanging there forever on the start_zeo() command. I suppose we could just fix this by having the script first try to hit zeo's port and back off, maybe with an interactive prompt, if the port's already in use. I kind of think this is the wrong approach, though -- it seems a bit too implicit and isn't really able to get at the *real* question, which isn't "can I start zeo?" but rather "do I want to run these scripts at all?". I'd rather have a flag of some sort like --parallel-deployment or --not-fresh-zodb that tells fassembler not to even try to run those scripts, or, alternatively, put the scripts in a separate fassembler command like fassembler:finish_new_databases. Does anyone have objections or alternate preferences here? I feel very strongly that explicit is better than ... magical in this case, but I don't have any particular preference for *how* to go down the explicit path. It is something we should address ASAP in any case, because it's pretty important for upgrading a site with minimal downtime. egj
- Thread Outline:
-
-
Re: fassembler:zeo doesn't work well if ...
by
ra
-
Re: fassembler:zeo doesn't work well if ...
by
ianb
-
Re: fassembler:zeo doesn't work well if ...
by
rmarianski
- Re: fassembler:zeo doesn't work well if ... by ianb
- Re: fassembler:zeo doesn't work well if ... by ra
-
Re: fassembler:zeo doesn't work well if ...
by
rmarianski
-
Re: fassembler:zeo doesn't work well if ...
by
ianb
-
Re: fassembler:zeo doesn't work well if ...
by
ra
-
Re: fassembler:zeo doesn't work well if another process is using its port
from ra on May 01, 2008 09:55 PMEthan Jucovy wrote: > Hey, > > As rmarianski and I discovered today, the zeo installer in fassembler > really doesn't work well if zeo's port is already in use when > fassembler builds zeo. That's because fassembler tries to start zeo, > run a few scripts to add an openplans site, and then shut it down > again before the build finishes, but it doesn't first check if the > port is in use and ends up hanging there forever on the start_zeo() > command. > > I suppose we could just fix this by having the script first try to hit > zeo's port and back off, maybe with an interactive prompt, if the > port's already in use. I kind of think this is the wrong approach, > though -- it seems a bit too implicit and isn't really able to get at > the *real* question, which isn't "can I start zeo?" but rather "do I > want to run these scripts at all?". I'd rather have a flag of some > sort like --parallel-deployment or --not-fresh-zodb that tells > fassembler not to even try to run those scripts, or, alternatively, > put the scripts in a separate fassembler command like > fassembler:finish_new_databases. > > Does anyone have objections or alternate preferences here? I feel > very strongly that explicit is better than ... magical in this case, > but I don't have any particular preference for *how* to go down the > explicit path. It is something we should address ASAP in any case, > because it's pretty important for upgrading a site with minimal > downtime. i'd rather not depend on having to call fassembler with explicit flags, personally. in fact, since the zopectl scripts are all idempotent, i'd be happy just with making the StartZeo task smarter; if it finds zeo is already running on the port, then it just lets it be, setting a flag so that the StopZeo step knows that it shouldn't actually try to shut down the server. if you really want to make it more explicit, the tasks in between them could be changed to ConditionalTasks. each one could do a specific check to see if it needs to be run. or maybe it could just assume that if zeo was already running then they just don't need to be run. i don't know... i really think just letting the scripts run is fine. -r
-
Re: fassembler:zeo doesn't work well if another process is using its port
from ianb on May 02, 2008 01:50 AMRob Miller wrote: > Ethan Jucovy wrote: >> Hey, >> >> As rmarianski and I discovered today, the zeo installer in fassembler >> really doesn't work well if zeo's port is already in use when >> fassembler builds zeo. That's because fassembler tries to start zeo, >> run a few scripts to add an openplans site, and then shut it down >> again before the build finishes, but it doesn't first check if the >> port is in use and ends up hanging there forever on the start_zeo() >> command. >> >> I suppose we could just fix this by having the script first try to hit >> zeo's port and back off, maybe with an interactive prompt, if the >> port's already in use. I kind of think this is the wrong approach, >> though -- it seems a bit too implicit and isn't really able to get at >> the *real* question, which isn't "can I start zeo?" but rather "do I >> want to run these scripts at all?". I'd rather have a flag of some >> sort like --parallel-deployment or --not-fresh-zodb that tells >> fassembler not to even try to run those scripts, or, alternatively, >> put the scripts in a separate fassembler command like >> fassembler:finish_new_databases. >> >> Does anyone have objections or alternate preferences here? I feel >> very strongly that explicit is better than ... magical in this case, >> but I don't have any particular preference for *how* to go down the >> explicit path. It is something we should address ASAP in any case, >> because it's pretty important for upgrading a site with minimal >> downtime. > > i'd rather not depend on having to call fassembler with explicit flags, > personally. in fact, since the zopectl scripts are all idempotent, i'd > be happy just with making the StartZeo task smarter; if it finds zeo is > already running on the port, then it just lets it be, setting a flag so > that the StopZeo step knows that it shouldn't actually try to shut down > the server. This is my inclination too. The only danger is if you run a migration against this ZEO instance while another application is still also looking at the ZEO instance, causing the existing application to get confused. Perhaps ZEO scripts should either be considered safe, or not safe, and things like the do_nothing script are safe, but migrations generally aren't. In the case of a migration, if there is an existing ZEO instance it would raise an exception. (Perhaps a setting could suppress this exception, for the case when ZEO is run outside of the build, but the deploy can confirm that it really is safe to continue -- or we could just interactively ask if it's okay to proceed). > if you really want to make it more explicit, the tasks in between them > could be changed to ConditionalTasks. each one could do a specific > check to see if it needs to be run. or maybe it could just assume that > if zeo was already running then they just don't need to be run. i don't > know... i really think just letting the scripts run is fine. I think coding this directly into StartZeo is fine, or just combining StartZeo and StopZeo with RunZopectlScript so the whole start/run-script/stop runs together. That would mean we'd unnecessarily take ZEO up and down when running multiple scripts, but we could also make RunZopectlScript take multiple script arguments. Ian
-
Re: fassembler:zeo doesn't work well if another process is using its port
from rmarianski on May 02, 2008 11:15 AMOn Fri, May 02, 2008 at 12:50:03AM -0500, Ian Bicking wrote: > Rob Miller wrote: >> Ethan Jucovy wrote: >>> Hey, >>> >>> As rmarianski and I discovered today, the zeo installer in fassembler >>> really doesn't work well if zeo's port is already in use when >>> fassembler builds zeo. That's because fassembler tries to start zeo, >>> run a few scripts to add an openplans site, and then shut it down >>> again before the build finishes, but it doesn't first check if the >>> port is in use and ends up hanging there forever on the start_zeo() >>> command. >>> >>> I suppose we could just fix this by having the script first try to hit >>> zeo's port and back off, maybe with an interactive prompt, if the >>> port's already in use. I kind of think this is the wrong approach, >>> though -- it seems a bit too implicit and isn't really able to get at >>> the *real* question, which isn't "can I start zeo?" but rather "do I >>> want to run these scripts at all?". I'd rather have a flag of some >>> sort like --parallel-deployment or --not-fresh-zodb that tells >>> fassembler not to even try to run those scripts, or, alternatively, >>> put the scripts in a separate fassembler command like >>> fassembler:finish_new_databases. >>> >>> Does anyone have objections or alternate preferences here? I feel >>> very strongly that explicit is better than ... magical in this case, >>> but I don't have any particular preference for *how* to go down the >>> explicit path. It is something we should address ASAP in any case, >>> because it's pretty important for upgrading a site with minimal >>> downtime. >> >> i'd rather not depend on having to call fassembler with explicit flags, >> personally. in fact, since the zopectl scripts are all idempotent, i'd be >> happy just with making the StartZeo task smarter; if it finds zeo is >> already running on the port, then it just lets it be, setting a flag so >> that the StopZeo step knows that it shouldn't actually try to shut down >> the server. This works great assuming we always add things to zeo that are idempotent. And when we are developing, we are usually more interested in just getting something to work. This relies on us to keep this in the back of our minds, and we are in a big surprise come deployment if we slip. This is why this makes me nervous. That being said, I think I'd be happy if the zeo script checked if something was already running, and if it was, it would *not* run any of the remaining steps. > This is my inclination too. The only danger is if you run a migration > against this ZEO instance while another application is still also looking > at the ZEO instance, causing the existing application to get confused. Currently we run migrations manually anyway. They are different for each deployment, so I think that still makes sense. > Perhaps ZEO scripts should either be considered safe, or not safe, and > things like the do_nothing script are safe, but migrations generally > aren't. In the case of a migration, if there is an existing ZEO instance > it would raise an exception. (Perhaps a setting could suppress this > exception, for the case when ZEO is run outside of the build, but the > deploy can confirm that it really is safe to continue -- or we could just > interactively ask if it's okay to proceed). I'd rather be of the mindset that running *any* zeo script is unsafe. If fassembler prompted before running each one, I think that would be ok though. >> if you really want to make it more explicit, the tasks in between them >> could be changed to ConditionalTasks. each one could do a specific check >> to see if it needs to be run. or maybe it could just assume that if zeo >> was already running then they just don't need to be run. i don't know... >> i really think just letting the scripts run is fine. > > I think coding this directly into StartZeo is fine, or just combining > StartZeo and StopZeo with RunZopectlScript so the whole > start/run-script/stop runs together. That would mean we'd unnecessarily > take ZEO up and down when running multiple scripts, but we could also make > RunZopectlScript take multiple script arguments. I'd prefer to not run anything if zeo is already running, or ask before running any zeo script. Robert > > Ian > > > -- > Archive: http://www.openplans.org/projects/fassembler/lists/fassembler-discussion/archive/2008/05/1209707412813 > To unsubscribe send an email with subject unsubscribe to fassembler-discussion@.... Please contact fassembler-discussion-manager@... for questions. > > > !DSPAM:4021,481aac12276273327367457! >
-
Re: fassembler:zeo doesn't work well if another process is using its port
from ianb on May 02, 2008 11:33 AMRobert Marianski wrote: >>> i'd rather not depend on having to call fassembler with explicit flags, >>> personally. in fact, since the zopectl scripts are all idempotent, i'd be >>> happy just with making the StartZeo task smarter; if it finds zeo is >>> already running on the port, then it just lets it be, setting a flag so >>> that the StopZeo step knows that it shouldn't actually try to shut down >>> the server. > > This works great assuming we always add things to zeo that are > idempotent. And when we are developing, we are usually more interested > in just getting something to work. This relies on us to keep this in the > back of our minds, and we are in a big surprise come deployment if we > slip. This is why this makes me nervous. That's why I thought it would be good to have to explicitly mark a script as safe, and so those scripts that get run every build and we know to be safe (like do_nothing) don't make us think unnecessarily about the state of the ZODB. Everything added after that would get marked unsafe by default, unless a developer specifically puts the thought into making it safe. (We'd have to document exactly what we mean by safe/unsafe of course) Ian
-
Re: fassembler:zeo doesn't work well if another process is using its port
from rmarianski on May 02, 2008 12:09 PM>> This works great assuming we always add things to zeo that are >> idempotent. And when we are developing, we are usually more interested >> in just getting something to work. This relies on us to keep this in the >> back of our minds, and we are in a big surprise come deployment if we >> slip. This is why this makes me nervous. > > That's why I thought it would be good to have to explicitly mark a script > as safe, and so those scripts that get run every build and we know to be > safe (like do_nothing) don't make us think unnecessarily about the state of > the ZODB. Everything added after that would get marked unsafe by default, > unless a developer specifically puts the thought into making it safe. > > (We'd have to document exactly what we mean by safe/unsafe of course) I'd be fine with us only running safe scripts. So then the zeo stuff would rougly look like: 1. if something is running on the zeo port, don't try to start zeo (remember if you started it or not) 2. run all safe scripts 3. if zeo was started through fassembler, then stop it Correct? Robert
-
Re: fassembler:zeo doesn't work well if another process is using its port
from ejucovy on May 02, 2008 12:17 PMOn Fri, May 2, 2008 at 12:09 PM, Robert Marianski <rmarianski@...> wrote: > So then the zeo stuff would rougly look like: > 1. if something is running on the zeo port, don't try to start zeo > (remember if you started it or not) If we're going to do this (presumably fassembler is in that case assuming that, since it already asked you about unavailable ports and you didn't abort the build, you know what's on zeo's port and are cool with it) I'd prefer that we move, or repeat, the "unavailable ports" question in each component's build, and maybe make it a little more explicit. An up-front "the following ports are unavailable; continue?" is somewhat easier to ignore unthinkingly than "port 10003, which I'm about to build zeo on, is already in use; continue?" Other than this, I'm alright with the "implicit check & safe scripts" approach, though I do feel like it's more work than it's worth compared to the alternative. egj
-
Re: fassembler:zeo doesn't work well if another process is using its port
from ianb on May 02, 2008 12:20 PMEthan Jucovy wrote: > On Fri, May 2, 2008 at 12:09 PM, Robert Marianski > <rmarianski@...> wrote: >> So then the zeo stuff would rougly look like: >> 1. if something is running on the zeo port, don't try to start zeo >> (remember if you started it or not) > > If we're going to do this (presumably fassembler is in that case > assuming that, since it already asked you about unavailable ports and > you didn't abort the build, you know what's on zeo's port and are cool > with it) I'd prefer that we move, or repeat, the "unavailable ports" > question in each component's build, and maybe make it a little more > explicit. An up-front "the following ports are unavailable; > continue?" is somewhat easier to ignore unthinkingly than "port 10003, > which I'm about to build zeo on, is already in use; continue?" > > Other than this, I'm alright with the "implicit check & safe scripts" > approach, though I do feel like it's more work than it's worth > compared to the alternative. What's the alternative? Ian
-
Re: fassembler:zeo doesn't work well if another process is using its port
from ejucovy on May 02, 2008 12:23 PMOn Fri, May 2, 2008 at 12:20 PM, Ian Bicking <ianb@...> wrote: > What's the alternative? Oh, just assuming all scripts are unsafe and either starting-zeo-and-running-them-all or not-starting-zeo-and-running-none.
-
-
-
Re: fassembler:zeo doesn't work well if another process is using its port
from ianb on May 02, 2008 12:18 PMRobert Marianski wrote: >>> This works great assuming we always add things to zeo that are >>> idempotent. And when we are developing, we are usually more interested >>> in just getting something to work. This relies on us to keep this in the >>> back of our minds, and we are in a big surprise come deployment if we >>> slip. This is why this makes me nervous. >> That's why I thought it would be good to have to explicitly mark a script >> as safe, and so those scripts that get run every build and we know to be >> safe (like do_nothing) don't make us think unnecessarily about the state of >> the ZODB. Everything added after that would get marked unsafe by default, >> unless a developer specifically puts the thought into making it safe. >> >> (We'd have to document exactly what we mean by safe/unsafe of course) > > I'd be fine with us only running safe scripts. > > So then the zeo stuff would rougly look like: > 1. if something is running on the zeo port, don't try to start zeo > (remember if you started it or not) > 2. run all safe scripts > 3. if zeo was started through fassembler, then stop it > > Correct? Probably ask about all the unsafe scripts too. It might be that the deployer decides to run them, or not run them, or that the build needs to be aborted because they didn't think ZEO was already running and they need to figure out what's going on (like, maybe you just forgot to shut down the other server, but you had intended to do so). Ian
-
Re: fassembler:zeo doesn't work well if another process is using its port
from ianb on May 02, 2008 01:32 PMRobert Marianski wrote: >>> This works great assuming we always add things to zeo that are >>> idempotent. And when we are developing, we are usually more interested >>> in just getting something to work. This relies on us to keep this in the >>> back of our minds, and we are in a big surprise come deployment if we >>> slip. This is why this makes me nervous. >> That's why I thought it would be good to have to explicitly mark a script >> as safe, and so those scripts that get run every build and we know to be >> safe (like do_nothing) don't make us think unnecessarily about the state of >> the ZODB. Everything added after that would get marked unsafe by default, >> unless a developer specifically puts the thought into making it safe. >> >> (We'd have to document exactly what we mean by safe/unsafe of course) > > I'd be fine with us only running safe scripts. > > So then the zeo stuff would rougly look like: > 1. if something is running on the zeo port, don't try to start zeo > (remember if you started it or not) > 2. run all safe scripts > 3. if zeo was started through fassembler, then stop it > > Correct? I realized recently in a development scenario I had this problem, except the ZEO instance already open was pointed at a different ZODB. And I really did need to run those scripts against the right ZODB. I can just figure this out with the port warnings, but is it also possible to query ZEO about what ZODB/Data.fs it is using? If it's not the right ZODB, then we need to simply abort with an error. Ian
-
Re: fassembler:zeo doesn't work well if another process is using its port
from ra on May 02, 2008 01:54 PMIan Bicking wrote: > Robert Marianski wrote: >>>> This works great assuming we always add things to zeo that are >>>> idempotent. And when we are developing, we are usually more interested >>>> in just getting something to work. This relies on us to keep this in >>>> the >>>> back of our minds, and we are in a big surprise come deployment if we >>>> slip. This is why this makes me nervous. >>> That's why I thought it would be good to have to explicitly mark a >>> script as safe, and so those scripts that get run every build and we >>> know to be safe (like do_nothing) don't make us think unnecessarily >>> about the state of the ZODB. Everything added after that would get >>> marked unsafe by default, unless a developer specifically puts the >>> thought into making it safe. >>> >>> (We'd have to document exactly what we mean by safe/unsafe of course) >> >> I'd be fine with us only running safe scripts. >> >> So then the zeo stuff would rougly look like: >> 1. if something is running on the zeo port, don't try to start zeo >> (remember if you started it or not) >> 2. run all safe scripts >> 3. if zeo was started through fassembler, then stop it >> >> Correct? > > I realized recently in a development scenario I had this problem, except > the ZEO instance already open was pointed at a different ZODB. And I > really did need to run those scripts against the right ZODB. is this during a fassembler (re)build? or a migration? we seem to be confusing the two slightly in this thread, i'd like to make sure we're on the same page. > I can just figure this out with the port warnings, but is it also > possible to query ZEO about what ZODB/Data.fs it is using? If it's not > the right ZODB, then we need to simply abort with an error. this doesn't seem possible to me, at first glance. not without embedding some sort of information into the app about what the current state of the database should be... and even then it's imperfect. consider that i have two development rigs, tracking the same branches, set up (for some reason) on the same ports. on one i run some migrations, but forget to shut down zeo when it's all done. so then i trigger the 'zopectl run' migration script on the other install. it can examine the database, but the best it's going to do is determine that the migration isn't necessary. how is it going to know that there's another, unmigrated database sitting around somewhere, for which it was originally intended? by checking the filesystem location of the current Data.fs? seems questionable. i remember in our original fassembler discussions, i made sure that having fassembler work in a case where zeo is running outside of a given build would be supported, since that's the ultimate goal for our live deployments. having the zeo built anew each time is great for bootstrapping a dev instance, but i think it's a bit of an anti-pattern for production. rather than trying to make the zeo-swapping bulletproof, i think our energy is better spent getting our production environments set up so that zeo is run outside of any particular build, handled as a separate service a'la mysql. -r
-
Re: fassembler:zeo doesn't work well if another process is using its port
from ejucovy on May 02, 2008 02:29 PMOn Fri, May 2, 2008 at 1:54 PM, Rob Miller <robm@...> wrote: > having the zeo built anew each time is great for bootstrapping a dev > instance, but i think it's a bit of an anti-pattern for production. rather > than trying to make the zeo-swapping bulletproof, i think our energy is > better spent getting our production environments set up so that zeo is run > outside of any particular build, handled as a separate service a'la mysql. +1. Robert and I tried to just not build zeo the other day but found that this didn't really succeed satisfactorily with the bare minimum of work, so we moved on to another approach in the name of expedience. But I agree that this whole conversation should just be thought of as a stopgap measure. (and hence we really don't need to make sure we have a perfect answer, since the question itself isn't perfect.) egj
-
-
-
-
-
Re: fassembler:zeo doesn't work well if another process is using its port
from ra on May 02, 2008 01:41 PMRobert Marianski wrote: > On Fri, May 02, 2008 at 12:50:03AM -0500, Ian Bicking wrote: >> Rob Miller wrote: >>> Ethan Jucovy wrote: >>>> Hey, >>>> >>>> As rmarianski and I discovered today, the zeo installer in fassembler >>>> really doesn't work well if zeo's port is already in use when >>>> fassembler builds zeo. That's because fassembler tries to start zeo, >>>> run a few scripts to add an openplans site, and then shut it down >>>> again before the build finishes, but it doesn't first check if the >>>> port is in use and ends up hanging there forever on the start_zeo() >>>> command. >>>> >>>> I suppose we could just fix this by having the script first try to hit >>>> zeo's port and back off, maybe with an interactive prompt, if the >>>> port's already in use. I kind of think this is the wrong approach, >>>> though -- it seems a bit too implicit and isn't really able to get at >>>> the *real* question, which isn't "can I start zeo?" but rather "do I >>>> want to run these scripts at all?". I'd rather have a flag of some >>>> sort like --parallel-deployment or --not-fresh-zodb that tells >>>> fassembler not to even try to run those scripts, or, alternatively, >>>> put the scripts in a separate fassembler command like >>>> fassembler:finish_new_databases. >>>> >>>> Does anyone have objections or alternate preferences here? I feel >>>> very strongly that explicit is better than ... magical in this case, >>>> but I don't have any particular preference for *how* to go down the >>>> explicit path. It is something we should address ASAP in any case, >>>> because it's pretty important for upgrading a site with minimal >>>> downtime. >>> i'd rather not depend on having to call fassembler with explicit flags, >>> personally. in fact, since the zopectl scripts are all idempotent, i'd be >>> happy just with making the StartZeo task smarter; if it finds zeo is >>> already running on the port, then it just lets it be, setting a flag so >>> that the StopZeo step knows that it shouldn't actually try to shut down >>> the server. > > This works great assuming we always add things to zeo that are > idempotent. And when we are developing, we are usually more interested > in just getting something to work. This relies on us to keep this in the > back of our minds, and we are in a big surprise come deployment if we > slip. This is why this makes me nervous. i can understand this. it still doesn't worry me a bunch, though. we're talking about initial database setup, not migrations. we don't use fassembler to run migrations. we don't add steps to the initial database setup very often. when we do, it's typically stuff that can't be done twice... it's much more likely that a poorly written initialization step (e.g. one that tries to create an 'openplans' site w/o checking to see if it's already there) is going to fail rather than cause problems to an existing site. it's also fine to just skip all of these steps if zeo is already running, though. do_nothing may be safe in this case, but it's also superfluous, it can be skipped. marking things as safe vs unsafe would be a good idea if we needed it, but for now i think it's YAGNI. finally, we SHOULD be keeping idempotence at the back of our mind. as ian and i emphatically agreed in a recent opencore-dev thread, ALL database migration scripts should pretty much ALWAYS be idempotent. if you're writing a migration script, you have to consider that it may be applied more than once, and your script has to account for that. we don't use fassembler to run migrations, and migrations are inherently fall into the "unsafe" category. IMO, there's no getting away from the need to keep this in mind. luckily, even w/ migrations, it's far more likely that the migration will simply fail, rather than actually causing problems with an already-migrated database. -r
-
Re: fassembler:zeo doesn't work well if another process is using its port
from ianb on May 02, 2008 01:47 PMRob Miller wrote: > Robert Marianski wrote: >> On Fri, May 02, 2008 at 12:50:03AM -0500, Ian Bicking wrote: >>> Rob Miller wrote: >>>> Ethan Jucovy wrote: >>>>> Hey, >>>>> >>>>> As rmarianski and I discovered today, the zeo installer in fassembler >>>>> really doesn't work well if zeo's port is already in use when >>>>> fassembler builds zeo. That's because fassembler tries to start zeo, >>>>> run a few scripts to add an openplans site, and then shut it down >>>>> again before the build finishes, but it doesn't first check if the >>>>> port is in use and ends up hanging there forever on the start_zeo() >>>>> command. >>>>> >>>>> I suppose we could just fix this by having the script first try to hit >>>>> zeo's port and back off, maybe with an interactive prompt, if the >>>>> port's already in use. I kind of think this is the wrong approach, >>>>> though -- it seems a bit too implicit and isn't really able to get at >>>>> the *real* question, which isn't "can I start zeo?" but rather "do I >>>>> want to run these scripts at all?". I'd rather have a flag of some >>>>> sort like --parallel-deployment or --not-fresh-zodb that tells >>>>> fassembler not to even try to run those scripts, or, alternatively, >>>>> put the scripts in a separate fassembler command like >>>>> fassembler:finish_new_databases. >>>>> >>>>> Does anyone have objections or alternate preferences here? I feel >>>>> very strongly that explicit is better than ... magical in this case, >>>>> but I don't have any particular preference for *how* to go down the >>>>> explicit path. It is something we should address ASAP in any case, >>>>> because it's pretty important for upgrading a site with minimal >>>>> downtime. >>>> i'd rather not depend on having to call fassembler with explicit >>>> flags, personally. in fact, since the zopectl scripts are all >>>> idempotent, i'd be happy just with making the StartZeo task smarter; >>>> if it finds zeo is already running on the port, then it just lets it >>>> be, setting a flag so that the StopZeo step knows that it shouldn't >>>> actually try to shut down the server. >> >> This works great assuming we always add things to zeo that are >> idempotent. And when we are developing, we are usually more interested >> in just getting something to work. This relies on us to keep this in the >> back of our minds, and we are in a big surprise come deployment if we >> slip. This is why this makes me nervous. > > i can understand this. it still doesn't worry me a bunch, though. > we're talking about initial database setup, not migrations. we don't > use fassembler to run migrations. we don't add steps to the initial > database setup very often. when we do, it's typically stuff that can't > be done twice... it's much more likely that a poorly written > initialization step (e.g. one that tries to create an 'openplans' site > w/o checking to see if it's already there) is going to fail rather than > cause problems to an existing site. Maybe an adaptation of the let's-just-not-do-this solution, that Ethan seems to prefer, would simply be: * Combine StartZeo/RunZopectlScript/StopZeo * Before starting ZEO, try to connect to it, and fail if we don't get connection refused. If you fail you can continue, so long as all these pieces are one task. By checking the port, the build fails explicitly (and recoverably) instead of just stalling as it currently does. I think this actually handles all the cases we currently care about. Ian
-
Re: fassembler:zeo doesn't work well if another process is using its port
from ra on May 02, 2008 01:59 PMIan Bicking wrote: > Rob Miller wrote: >> Robert Marianski wrote: >>> On Fri, May 02, 2008 at 12:50:03AM -0500, Ian Bicking wrote: >>>> Rob Miller wrote: >>>>> Ethan Jucovy wrote: >>>>>> Hey, >>>>>> >>>>>> As rmarianski and I discovered today, the zeo installer in fassembler >>>>>> really doesn't work well if zeo's port is already in use when >>>>>> fassembler builds zeo. That's because fassembler tries to start zeo, >>>>>> run a few scripts to add an openplans site, and then shut it down >>>>>> again before the build finishes, but it doesn't first check if the >>>>>> port is in use and ends up hanging there forever on the start_zeo() >>>>>> command. >>>>>> >>>>>> I suppose we could just fix this by having the script first try to >>>>>> hit >>>>>> zeo's port and back off, maybe with an interactive prompt, if the >>>>>> port's already in use. I kind of think this is the wrong approach, >>>>>> though -- it seems a bit too implicit and isn't really able to get at >>>>>> the *real* question, which isn't "can I start zeo?" but rather "do I >>>>>> want to run these scripts at all?". I'd rather have a flag of some >>>>>> sort like --parallel-deployment or --not-fresh-zodb that tells >>>>>> fassembler not to even try to run those scripts, or, alternatively, >>>>>> put the scripts in a separate fassembler command like >>>>>> fassembler:finish_new_databases. >>>>>> >>>>>> Does anyone have objections or alternate preferences here? I feel >>>>>> very strongly that explicit is better than ... magical in this case, >>>>>> but I don't have any particular preference for *how* to go down the >>>>>> explicit path. It is something we should address ASAP in any case, >>>>>> because it's pretty important for upgrading a site with minimal >>>>>> downtime. >>>>> i'd rather not depend on having to call fassembler with explicit >>>>> flags, personally. in fact, since the zopectl scripts are all >>>>> idempotent, i'd be happy just with making the StartZeo task >>>>> smarter; if it finds zeo is already running on the port, then it >>>>> just lets it be, setting a flag so that the StopZeo step knows that >>>>> it shouldn't actually try to shut down the server. >>> >>> This works great assuming we always add things to zeo that are >>> idempotent. And when we are developing, we are usually more interested >>> in just getting something to work. This relies on us to keep this in the >>> back of our minds, and we are in a big surprise come deployment if we >>> slip. This is why this makes me nervous. >> >> i can understand this. it still doesn't worry me a bunch, though. >> we're talking about initial database setup, not migrations. we don't >> use fassembler to run migrations. we don't add steps to the initial >> database setup very often. when we do, it's typically stuff that >> can't be done twice... it's much more likely that a poorly written >> initialization step (e.g. one that tries to create an 'openplans' site >> w/o checking to see if it's already there) is going to fail rather >> than cause problems to an existing site. > > Maybe an adaptation of the let's-just-not-do-this solution, that Ethan > seems to prefer, would simply be: > > * Combine StartZeo/RunZopectlScript/StopZeo > * Before starting ZEO, try to connect to it, and fail if we don't get > connection refused. If you fail you can continue, so long as all these > pieces are one task. By checking the port, the build fails explicitly > (and recoverably) instead of just stalling as it currently does. > > I think this actually handles all the cases we currently care about. so the build fails unless it can start and stop the zeo? doesn't this fail to meet our current need, which is to do a new build of the software without actually having to bring down the production instance that's already running? i'm for combining them into a single step, and if zeo is already running then just skip it. yes, there are edge cases where this isn't really what we want, but i think that it IS what we want at least 9 out of 10 times, and it's definitely what we want in the typical production build situation. -r
-
Re: fassembler:zeo doesn't work well if another process is using its port
from ianb on May 02, 2008 02:26 PMRob Miller wrote: > Ian Bicking wrote: >> Rob Miller wrote: >>> Robert Marianski wrote: >>>> On Fri, May 02, 2008 at 12:50:03AM -0500, Ian Bicking wrote: >>>>> Rob Miller wrote: >>>>>> Ethan Jucovy wrote: >>>>>>> Hey, >>>>>>> >>>>>>> As rmarianski and I discovered today, the zeo installer in >>>>>>> fassembler >>>>>>> really doesn't work well if zeo's port is already in use when >>>>>>> fassembler builds zeo. That's because fassembler tries to start >>>>>>> zeo, >>>>>>> run a few scripts to add an openplans site, and then shut it down >>>>>>> again before the build finishes, but it doesn't first check if the >>>>>>> port is in use and ends up hanging there forever on the start_zeo() >>>>>>> command. >>>>>>> >>>>>>> I suppose we could just fix this by having the script first try >>>>>>> to hit >>>>>>> zeo's port and back off, maybe with an interactive prompt, if the >>>>>>> port's already in use. I kind of think this is the wrong approach, >>>>>>> though -- it seems a bit too implicit and isn't really able to >>>>>>> get at >>>>>>> the *real* question, which isn't "can I start zeo?" but rather "do I >>>>>>> want to run these scripts at all?". I'd rather have a flag of some >>>>>>> sort like --parallel-deployment or --not-fresh-zodb that tells >>>>>>> fassembler not to even try to run those scripts, or, alternatively, >>>>>>> put the scripts in a separate fassembler command like >>>>>>> fassembler:finish_new_databases. >>>>>>> >>>>>>> Does anyone have objections or alternate preferences here? I feel >>>>>>> very strongly that explicit is better than ... magical in this case, >>>>>>> but I don't have any particular preference for *how* to go down the >>>>>>> explicit path. It is something we should address ASAP in any case, >>>>>>> because it's pretty important for upgrading a site with minimal >>>>>>> downtime. >>>>>> i'd rather not depend on having to call fassembler with explicit >>>>>> flags, personally. in fact, since the zopectl scripts are all >>>>>> idempotent, i'd be happy just with making the StartZeo task >>>>>> smarter; if it finds zeo is already running on the port, then it >>>>>> just lets it be, setting a flag so that the StopZeo step knows >>>>>> that it shouldn't actually try to shut down the server. >>>> >>>> This works great assuming we always add things to zeo that are >>>> idempotent. And when we are developing, we are usually more interested >>>> in just getting something to work. This relies on us to keep this in >>>> the >>>> back of our minds, and we are in a big surprise come deployment if we >>>> slip. This is why this makes me nervous. >>> >>> i can understand this. it still doesn't worry me a bunch, though. >>> we're talking about initial database setup, not migrations. we don't >>> use fassembler to run migrations. we don't add steps to the initial >>> database setup very often. when we do, it's typically stuff that >>> can't be done twice... it's much more likely that a poorly written >>> initialization step (e.g. one that tries to create an 'openplans' >>> site w/o checking to see if it's already there) is going to fail >>> rather than cause problems to an existing site. >> >> Maybe an adaptation of the let's-just-not-do-this solution, that Ethan >> seems to prefer, would simply be: >> >> * Combine StartZeo/RunZopectlScript/StopZeo >> * Before starting ZEO, try to connect to it, and fail if we don't get >> connection refused. If you fail you can continue, so long as all >> these pieces are one task. By checking the port, the build fails >> explicitly (and recoverably) instead of just stalling as it currently >> does. >> >> I think this actually handles all the cases we currently care about. > > so the build fails unless it can start and stop the zeo? doesn't this > fail to meet our current need, which is to do a new build of the > software without actually having to bring down the production instance > that's already running? The task gives an exception. If you know it's okay, you can continue. I think that satisfies the needs for a production deployment. We can also have it query about it, instead of an exception. The effect would be the same, but the lack of an exception would make it look less scary. Ian
-
Re: fassembler:zeo doesn't work well if another process is using its port
from ejucovy on May 02, 2008 02:26 PMOn Fri, May 2, 2008 at 1:59 PM, Rob Miller <robm@...> wrote: >> Maybe an adaptation of the let's-just-not-do-this solution, that Ethan >> seems to prefer, would simply be: >> >> * Combine StartZeo/RunZopectlScript/StopZeo >> * Before starting ZEO, try to connect to it, and fail if we don't get >> connection refused. If you fail you can continue, so long as all these >> pieces are one task. By checking the port, the build fails explicitly (and >> recoverably) instead of just stalling as it currently does. >> >> I think this actually handles all the cases we currently care about. > > so the build fails unless it can start and stop the zeo? doesn't this fail > to meet our current need, which is to do a new build of the software without > actually having to bring down the production instance that's already > running? Yes, the build fails, but it does meet our current need, because the build fails recoverably since the failure is on a single "command" -- so you just hit "c" and the build moves on to the next step. You just skip the run-zeo-scripts step, which is exactly what we want to do in the current situation. This sounds pretty good me, though I think it's a bit confusing since it *looks* like a failure rather than *asking* you if it's a failure. egj
-
Re: fassembler:zeo doesn't work well if another process is using its port
from ra on May 02, 2008 02:36 PMEthan Jucovy wrote: > On Fri, May 2, 2008 at 1:59 PM, Rob Miller <robm@...> wrote: >>> Maybe an adaptation of the let's-just-not-do-this solution, that Ethan >>> seems to prefer, would simply be: >>> >>> * Combine StartZeo/RunZopectlScript/StopZeo >>> * Before starting ZEO, try to connect to it, and fail if we don't get >>> connection refused. If you fail you can continue, so long as all these >>> pieces are one task. By checking the port, the build fails explicitly (and >>> recoverably) instead of just stalling as it currently does. >>> >>> I think this actually handles all the cases we currently care about. >> so the build fails unless it can start and stop the zeo? doesn't this fail >> to meet our current need, which is to do a new build of the software without >> actually having to bring down the production instance that's already >> running? > > Yes, the build fails, but it does meet our current need, because the > build fails recoverably since the failure is on a single "command" -- > so you just hit "c" and the build moves on to the next step. You just > skip the run-zeo-scripts step, which is exactly what we want to do in > the current situation. ah, right... i forgot about the 'c' option, sorry. i'd still lean toward not even failing, but i'd be okay with that. -r
-
Re: fassembler:zeo doesn't work well if another process is using its port
from slinkp on May 20, 2008 07:27 PMSo after all that discussion, nobody implemented anything ;-) This keeps coming up every time we deploy, so it seems worth doing. I spent some time experimenting with a branch here https://svn.openplans.org/svn/fassembler/branches/pw-batch-zopectl-scripts-20080520 ... but I couldn't get it to work with that approach; see comments in r17142 if you're curious what's broken with my first approach and what I was thinking of trying next. (Oh, and where I wrote "defaults the whole purpose" I meant "defeats"!) -- PW
-
Re: Re: fassembler:zeo doesn't work well if another process is using its port
from magicbronson on May 22, 2008 05:38 PMHey Paul (and fassembler-discussion), On Tue, May 20, 2008 at 7:27 PM, Paul Winkler <pw@...> wrote: So after all that discussion, nobody implemented anything ;-) This keeps coming up every time we deploy, so it seems worth doing. I spent some time experimenting with a branch here https://svn.openplans.org/svn/fassembler/branches/pw-batch-zopectl-scripts-20080520 ... but I couldn't get it to work with that approach; see comments in r17142 if you're curious what's broken with my first approach and what I was thinking of trying next. (Oh, and where I wrote "defaults the whole purpose" I meant "defeats"!) -- PW It actually didn't take much more to get your work working (see r17164). We got rid of the separate StartZeo and StopZeo tasks, transforming them into methods of RunZopeScriptsWithZeo which are run before and after the RunZopectlScript subtasks it was passed are run, respectively (just took some recursion to solve the problem in your comments). Before any of that happens, however, we use socket.socket.bind to check if anything is running on the zeo port, and if so, we raise an Exception. Supporting change r17165 to filemaker.Maker.handle_exception(..) added the can_retry parameter, so the user now has a chance to pop open a new shell and run "zeoctl stop", then go back and hit 'r' to retry running the scripts if desired. Alternatively, as before, the user can still hit 'c' to continue without running any of the scripts. That ought to cover us for now. Let me know how this is working or if anyone thinks it should behave differently. Thanks Paul and Ian! -- Archive: http://www.openplans.org/projects/fassembler/lists/fassembler-discussion/archive/2008/05/1211326045461 To unsubscribe send an email with subject unsubscribe to fassembler-discussion@... . Please contact fassembler-discussion-manager@... for questions.
-
Re: Re: fassembler:zeo doesn't work well if another process is using its port
from ra on May 22, 2008 06:28 PMJoshua Bronson wrote: > Hey Paul (and fassembler-discussion), > > On Tue, May 20, 2008 at 7:27 PM, Paul Winkler <pw@... > <mailto:pw@...>> wrote: > > So after all that discussion, nobody implemented anything ;-) > This keeps coming up every time we deploy, so it seems worth doing. > > I spent some time experimenting with a branch here > https://svn.openplans.org/svn/fassembler/branches/pw-batch-zopectl-scripts-20080520 > > ... but I couldn't get it to work with that approach; see comments > in r17142 > if you're curious what's broken with my first approach and what I > was thinking > of trying next. > (Oh, and where I wrote "defaults the whole purpose" I meant "defeats"!) > > -- PW > > > It actually didn't take much more to get your work working (see r17164). > We got rid of the separate StartZeo and StopZeo tasks, transforming them > into methods of RunZopeScriptsWithZeo which are run before and after the > RunZopectlScript subtasks it was passed are run, respectively (just took > some recursion to solve the problem in your comments). Before any of > that happens, however, we use socket.socket.bind to check if anything is > running on the zeo port, and if so, we raise an Exception. Supporting > change r17165 to filemaker.Maker.handle_exception(..) added the > can_retry parameter, so the user now has a chance to pop open a new > shell and run "zeoctl stop", then go back and hit 'r' to retry running > the scripts if desired. Alternatively, as before, the user can still hit > 'c' to continue without running any of the scripts. nice, thanks for doing this! this is a slight tangent, but it's worth mentioning (for those who don't follow the zope-dev list) that i think we'll be able to eliminate the 'do_nothing.py' step when we upgrade to Z2.10 and P3, there's been some work on the bug that was causing us to need this step in the interim. -r
-
-
-
-
-
-
-
-
-
-
text.html (text/html) 3.0 kB