Skip to content
This repository has been archived by the owner on Jul 14, 2021. It is now read-only.

Please add documentation for Chef shell-init #338

Closed
mattstratton opened this issue Mar 25, 2015 · 7 comments
Closed

Please add documentation for Chef shell-init #338

mattstratton opened this issue Mar 25, 2015 · 7 comments
Labels

Comments

@mattstratton
Copy link
Contributor

There is a powershell command that @smurawski has taught me about for setting up all the good pathing, etc, for ChefDK on Windows. Can this be added to the documentation page for ChefDK to make the experience more delightful for new users?

@danielsdeleo
Copy link
Contributor

@mattstratton Just on the README or on docs.opscode.com? PR for the README should be pretty easy to do. I'm wondering if we have a different Windows section or if we just say "on Windows use 'posh' as your shell name". Thoughts?

@dougireton
Copy link

Any updates on this @mattstratton @danielsdeleo? I'm using Chef on Windows and the GEM_PATH and other GEM env vars point to a network drive (my $env:HOME) which makes for painfully slow gem installs. Any Windows docs would be helpful.

@jaym
Copy link
Contributor

jaym commented Apr 29, 2015

@dougireton I'm not sure that any docs we can write will make your life easier (yet). However this is probably a common case, so maybe we can come up with an acceptable workaround that can be documented. Would you prefer to have chefdk put your gems somewhere other than your home directory?

@dougireton
Copy link

My basic issue is that HOME related env vars are set to a network drive by AD Group Policy, but USERPROFILE is set to c:\users\doug:

HOME                           P:\
HOMEDRIVE                      P:
HOMEPATH                       \

USERPROFILE                    C:\Users\doug

it seems like ChefDK defaults to Gem.user_dir which happens to be HOME.

I had to override the Ruby Gem dirs. I ended up adding this to my PowerShell profile. This speeds up bundle and chef gem install dramatically, i.e. an order of magnitude.

# get Gem paths off of network drive (P:\)
$env:GEM_HOME = "$env:USERPROFILE\.chefdk\gem\ruby\2.1.0"
$env:GEM_PATH = "$env:GEM_HOME;$env:GEM_ROOT"
$env:GEM_SPEC_CACHE = "$env:USERPROFILE\.gem\specs"

# speed up berks install
$env:BERKSHELF_PATH = "$env:USERPROFILE\.berkshelf"

@danielsdeleo
Copy link
Contributor

@dougireton that behavior is the same between UNIX and Windows; in both cases we setup rubygems to have the --user-install flag by default to avoid permissions problems. This is configured in the ChefDK package itself, not in chef shell-init.

This is set up in omnibus chef here: https://github.com/chef/omnibus-chef/blob/master/config/software/rubygems-customization.rb and here https://github.com/chef/omnibus-chef/blob/master/files/rubygems-customization/windows/operating_system.rb The --user-install flag is all or nothing, but it might be possible for us to customize this some other way. What we're looking for is a default location that will be user writeable for most/all users. Is there a better default option for Windows?

Not sure how relevant it is to your issue, but if you run chef shell init posh (no eval tricks) it'll show you the environment variable configuration ChefDK uses to make ChefDK your primary ruby.

@mattstratton
Copy link
Contributor Author

@danielsdeleo I think just in the README would be super useful. Eventually on the docs site (just thinking about the times this has come up at customer sites, and folks finding it in the two different places they might be looking would be delightful).

That said, if this is just in the README I'll be a 😄 🐼

@danielsdeleo
Copy link
Contributor

Okay, the original issue here is fixed by #365

Doug, if you have any suggested improvements on the stuff I mentioned before, could you file a new issue here or in omnibus-chef ?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Development

No branches or pull requests

6 participants