collective / collective.hostout

zc.buildout deployment and remote control
22 stars 7 forks source link

Hostout does things as root when it shouldn't #2

Open aclark4life opened 13 years ago

aclark4life commented 13 years ago

I've just bin fiddling with bin/hostout run some_commands

And it works great!

But I notice it seems to have run itself as root when there is no need ; and this seems to upset the delicate non-root balance I had in my staging deployment :-)

Is this a bug or do I just need to configure differently?

Thanks for all the great work so far with hostout!

djay commented 13 years ago

Which parts specifically do you want it to not run as sudo? I've been trying to reduce the amount of sudos I make. The buildout parts should be using the buildout-user and it will want to install cert to login as that user without a password. If you need to bootrap because there is no buildout then it will also try to use sudo. I'd be interested in ways to reduce this.

aclark4life commented 13 years ago

I would say nothing should run as sudo unless requested.

djay commented 13 years ago

Well I was going to put in place interactive prompts for the bootstrap operations which is mainly what sudo is used for. the pre-commands and post-commands also run as sudo. In addition the buildout-user (which is the user that doesn't run as sudo) doesn't have a way to specify a password to use. Instead it relies of using a key which the sudo-user installs. There should be a way around that.

auspex commented 13 years ago

When bootstrapping, is there really no way to use the Plone installers? I'm trying to set-up a deployment method for my client which requires (a) they don't have sudo; and (b) they shouldn't have to execute more than 2 or 3 commands. I think I'm going to have to set up my own plugin to run the unified installer, then "deploy" won't need to run bootstrap

djay commented 13 years ago

Hi,

Just so I understand your use case, what you're after is to be allow your clients to create whole zope instances from scratch without anything being installed on the machine first? I think that could be possible as long as gcc etc are installed, but it would require a bit of rework of the fabric commands. I don't think unified installer is the way to do this (unless you put it in hostout.plone). I do already have code to use unified installer but I think a better solution is to make hostout work without sudo if need be.

To do this have a look at https://github.com/collective/collective.hostout/blob/master/collective/hostout/fabfile.py I'm about to make a change to take bootstrap from deploy which means you'd have to do a "bin/hostout host bootstrap deploy" to do a full deploy from scratch. Perhaps the way to do is to rename "user" to "bootstrap-user" and then have a setting of "bootstrap-user-sudo=False" which ensures that none of the bootstrap steps will use sudo. This means that anything that has to create a dir will fail if it doesn't have permission but thats expected. I think that's doable.

auspex commented 13 years ago

That's precisely what I need to do. They don't want to call me back just to add a new site on a new machine - and really, even though the money's good - that's not what I want to spend my time doing anyway :-)

The essential build tools will be there, but not necessarily python (I think this site had only 2.7). I installed the first site on their machine with the unified installer, so I just know I can do that without sudo. If you think you can do it without, so much the better, I just figured I could write the necessary fabfile steps to do this with the installer - but I know you then have to be able to identify your platform (in my case, guaranteed to be Linux) to get the right installer.

Perhaps the way to do is to rename "user" to "bootstrap-user" and then have a setting of "bootstrap-user-sudo=False" which ensures that none of the bootstrap steps will use sudo. This means that anything that has to create a dir will fail if it doesn't have permission but thats expected. I think that's doable.

I like that. Then the only thing necessary before the bootstrap is to

create a home directory to start in.

derek