Skip to content
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

Clean Vagrant+Windows Install #201

Merged
merged 8 commits into from
Mar 3, 2016
Merged

Clean Vagrant+Windows Install #201

merged 8 commits into from
Mar 3, 2016

Conversation

dahlbyk
Copy link
Member

@dahlbyk dahlbyk commented Feb 9, 2016

Here are some miscellaneous changes from getting Vagrant up and running on a clean Windows machine.

  1. .gitattributes for EOL consistency
  2. Remove pwd (for debugging) from postinstall (Windows doesn't like the &&)
  3. Further adjust how postinstall calls bower to be more Windows-friendly - @discorick can you confirm cd ember-app && npm install works as expected if you remove their cache dirs?
  4. Add provision.sh for extra provisiony stuff, starting with adding Puppet exec to add cd /srv/huboard to .bashrc
  5. Force downgrade bundler to 1.9.6.
    • It feels like there should be a better way to do this, but I can't tell exactly where the bundler gem is being installed.
    • @rauhryan, are you able to fill in background on why newer versions won't work?

@dahlbyk
Copy link
Member Author

dahlbyk commented Feb 9, 2016

@dahlbyk dahlbyk deployed to huboard-rails-pr-201 February 9, 2016 17:57 Active
@@ -11,7 +11,7 @@
"start": "ember server",
"build": "ember build",
"test": "ember test",
"postinstall": "pwd && ../node_modules/.bin/bower install"
"postinstall": "node ../node_modules/bower/bin/bower install"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wasn't aware that npm on windows and npm on unix differed in this convention.

This might not work for a heroku deployment

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It does, as far as I can tell: https://huboard-rails-pr-201.herokuapp.com/

@dahlbyk
Copy link
Member Author

dahlbyk commented Feb 18, 2016

Would appreciate some eyes one this next round of Local Dev updates based on some challenges getting another Windows machine up and running: https://github.com/huboard/huboard/wiki/Local-Development/_compare/52ab3eeee097c72688b1ad6b5e4d26612c7c3156...c8e5cb7b6328054ab0e1ed6518d8fca13e4dd353?short_path=459bc87#diff-459bc87850f2ab005ca4943e7253122c

@dahlbyk dahlbyk deployed to huboard-rails-pr-201 February 18, 2016 20:54 Active
@discorick
Copy link
Member

@dahlbyk were you planning on removing the app.json file from source control ?

@dahlbyk
Copy link
Member Author

dahlbyk commented Feb 19, 2016

were you planning on removing the app.json file from source control ?

Have to commit it for Heroku per-PR deploy to work. I can revert it here and move to a separate PR for addressing #183 if you'd prefer.


The last thing we need to figure out here is why we still end up with Bundler 1.11.2 after a vagrant up, despite provision.sh being executed with:

gem uninstall --ignore-dependencies --executables --quiet bundler
gem install bundler --version 1.9.6 --no-ri --no-rdoc

If I vagrant ssh into the box and run the above I end up using the correct version, and bundle install works as expected. Any ideas?


Finally, setting my bundler issues aside: why doesn't vagrant provision handle the bundle install?

@dahlbyk
Copy link
Member Author

dahlbyk commented Feb 20, 2016

The last thing we need to figure out here is why we still end up with Bundler 1.11.2 after a vagrant up

Alright, so within provision.sh I get:

$ gem env
RubyGems Environment:
  - RUBYGEMS VERSION: 1.8.23
  - RUBY VERSION: 1.9.3 (2013-11-22 patchlevel 484) [x86_64-linux]
  - INSTALLATION DIRECTORY: /var/lib/gems/1.9.1
  - RUBY EXECUTABLE: /usr/bin/ruby1.9.1
  - EXECUTABLE DIRECTORY: /usr/local/bin
  - RUBYGEMS PLATFORMS:
    - ruby
    - x86_64-linux
  - GEM PATHS:
     - /var/lib/gems/1.9.1
     - /root/.gem/ruby/1.9.1
  - GEM CONFIGURATION:
     - :update_sources => true
     - :verbose => true
     - :benchmark => false
     - :backtrace => false
     - :bulk_threshold => 1000
  - REMOTE SOURCES:
     - http://rubygems.org/
$ gem list
bundler (1.9.6)
semver (1.0.1)

While vagrant ssh'd:

vagrant@localhost:/srv/huboard$ gem env
RubyGems Environment:
  - RUBYGEMS VERSION: 2.4.5
  - RUBY VERSION: 2.2.1 (2015-02-26 patchlevel 85) [x86_64-linux]
  - INSTALLATION DIRECTORY: /home/vagrant/.rbenv/versions/2.2.1/lib/ruby/gems/2.2.0
  - RUBY EXECUTABLE: /home/vagrant/.rbenv/versions/2.2.1/bin/ruby
  - EXECUTABLE DIRECTORY: /home/vagrant/.rbenv/versions/2.2.1/bin
  - SPEC CACHE DIRECTORY: /home/vagrant/.gem/specs
  - SYSTEM CONFIGURATION DIRECTORY: /home/vagrant/.rbenv/versions/2.2.1/etc
  - RUBYGEMS PLATFORMS:
    - ruby
    - x86_64-linux
  - GEM PATHS:
     - /home/vagrant/.rbenv/versions/2.2.1/lib/ruby/gems/2.2.0
     - /home/vagrant/.gem/ruby/2.2.0
  - GEM CONFIGURATION:
     - :update_sources => true
     - :verbose => true
     - :backtrace => false
     - :bulk_threshold => 1000
  - REMOTE SOURCES:
     - https://rubygems.org/
  - SHELL PATH:
     - /home/vagrant/.rbenv/versions/2.2.1/bin
     - /home/vagrant/.rbenv/libexec
     - /home/vagrant/.rbenv/plugins/ruby-build/bin
     - /home/vagrant/.rbenv/shims
     - /home/vagrant/.rbenv/bin
     - /usr/local/node/node-default/bin
     - /usr/local/sbin
     - /usr/local/bin
     - /usr/sbin
     - /usr/bin
     - /sbin
     - /bin
     - /usr/games
     - /usr/local/games
vagrant@localhost:/srv/huboard$ gem list

*** LOCAL GEMS ***

bigdecimal (1.2.6)
bundler (1.11.2)
io-console (0.4.3)
json (1.8.1)
minitest (5.4.3)
power_assert (0.2.2)
psych (2.0.8)
rake (10.4.2)
rdoc (4.2.0)
test-unit (3.0.8)

So my current hack won't work. Any ideas?

@dahlbyk
Copy link
Member Author

dahlbyk commented Feb 23, 2016

So it looks like bundler is being installed with rbenv, which is interesting because I stumbled on huboard/puppet-rbenv@dedcf98. @rauhryan any ideas?

@discorick
Copy link
Member

@dahlbyk are you asking how to get bundler to install on provision ?

@dahlbyk dahlbyk deployed to huboard-rails-pr-201 February 26, 2016 02:58 Active
@dahlbyk dahlbyk deployed to huboard-rails-pr-201 February 26, 2016 03:50 Active
@dahlbyk dahlbyk deployed to huboard-rails-pr-201 February 26, 2016 04:18 Active
@dahlbyk dahlbyk deployed to huboard-rails-pr-201 February 26, 2016 04:30 Active
@dahlbyk dahlbyk deployed to huboard-rails-pr-201 February 26, 2016 04:51 Active
@dahlbyk dahlbyk deployed to huboard-rails-pr-201 February 26, 2016 04:51 Active
@dahlbyk dahlbyk deployed to huboard-rails-pr-201 February 26, 2016 05:06 Active
@dahlbyk dahlbyk mentioned this pull request Feb 26, 2016
3 tasks
@dahlbyk
Copy link
Member Author

dahlbyk commented Feb 26, 2016

Alright, I've moved the commits related to #183 over into #214 so we can focus on the Vagrant and Windows story. After #213, we're tentatively cool with Bundler > 1.10, so I've dropped my misguided attempts to downgrade to 1.9.6.

This also commits the much-maligned BUNDLED WITH. That change will need to be reverted in enterprise until we can figure out how to upgrade Bundler in HB:E.


are you asking how to get bundler to install on provision ?

I was asking this, yes, but we can defer that discussion.

@dahlbyk
Copy link
Member Author

dahlbyk commented Feb 26, 2016

I've deployed latest here to https://huboard-rails.herokuapp.com/ for a sanity check.

@@ -0,0 +1,2 @@
# Switch to /srv/huboard on login
echo "cd /srv/huboard" >> /home/vagrant/.bashrc
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lets pair together on moving this to puppet, its probably best to keep our provisioning unified.

@discorick
Copy link
Member

As we move provision.sh to puppet, we can also instruct puppet to run bundle install

exec { "echo 'cd /srv/huboard' >> .bashrc":
cwd => "/home/vagrant",
path => "/usr/bin:/usr/sbin:/bin",
unless => "grep -q '^cd /srv/huboard$' .bashrc"
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lets pair together on moving this to puppet, its probably best to keep our provisioning unified.

Better?

@dahlbyk
Copy link
Member Author

dahlbyk commented Feb 29, 2016

we can also instruct puppet to run bundle install

I tried a bunch of iterations along the lines of:

diff --git a/puppet/manifests/base.pp b/puppet/manifests/base.pp
index 5fee4ee..4663669 100644
--- a/puppet/manifests/base.pp
+++ b/puppet/manifests/base.pp
@@ -13,6 +13,12 @@ package {
     ruby_version => "2.2.1",
   }

+  exec { 'bundle install':
+    cwd  => "/home/vagrant",
+    path => "/usr/bin:/usr/sbin:/bin:/home/vagrant/.rbenv/bin:/home/vagrant/.rbenv/shims",
+    require => Class['ruby_install']
+  }
+
   class { 'wkhtmltox':
     ensure => 'present' 
   }

I tried rbenv shell 2.2.1 && bundle install, I tried dumping rbenv versions in its own step (only version shown is "system"). I am confused.

Here's the full Vagrant/Puppet debug log for ruby_install and bundle install:

==> default: Notice: /Stage[main]/Ruby_install/Rbenv::Compile[vagrant/2.2.1]/Rbenv::Plugin::Rubybuild[rbenv::rubybuild::vagrant]/Rbenv::Plugin[rbenv::plugin::rubybuild::vagrant]/File[rbenv::plugins vagrant]/ensure: created
==> default: Debug: /Stage[main]/Ruby_install/Rbenv::Compile[vagrant/2.2.1]/Rbenv::Plugin::Rubybuild[rbenv::rubybuild::vagrant]/Rbenv::Plugin[rbenv::plugin::rubybuild::vagrant]/File[rbenv::plugins vagrant]: The container Rbenv::Plugin[rbenv::plugin::rubybuild::vagrant] will propagate my refresh event
==> default: Debug: Exec[rbenv::plugin::checkout vagrant ruby-build](provider=posix): Executing 'git clone git://github.com/sstephenson/ruby-build.git /home/vagrant/.rbenv/plugins/ruby-build'
==> default: Debug: Executing 'git clone git://github.com/sstephenson/ruby-build.git /home/vagrant/.rbenv/plugins/ruby-build'
==> default: Notice: /Stage[main]/Ruby_install/Rbenv::Compile[vagrant/2.2.1]/Rbenv::Plugin::Rubybuild[rbenv::rubybuild::vagrant]/Rbenv::Plugin[rbenv::plugin::rubybuild::vagrant]/Exec[rbenv::plugin::checkout vagrant ruby-build]/returns: executed successfully
==> default: Debug: /Stage[main]/Ruby_install/Rbenv::Compile[vagrant/2.2.1]/Rbenv::Plugin::Rubybuild[rbenv::rubybuild::vagrant]/Rbenv::Plugin[rbenv::plugin::rubybuild::vagrant]/Exec[rbenv::plugin::checkout vagrant ruby-build]: The container Rbenv::Plugin[rbenv::plugin::rubybuild::vagrant] will propagate my refresh event
==> default: Debug: Rbenv::Plugin[rbenv::plugin::rubybuild::vagrant]: The container Rbenv::Plugin::Rubybuild[rbenv::rubybuild::vagrant] will propagate my refresh event
==> default: Debug: Rbenv::Plugin::Rubybuild[rbenv::rubybuild::vagrant]: The container Rbenv::Compile[vagrant/2.2.1] will propagate my refresh event
==> default: Debug: Exec[rbenv::compile vagrant 2.2.1](provider=posix): Executing 'rbenv install 2.2.1 && touch /home/vagrant/.rbenv/.rehash'
==> default: Debug: Executing 'rbenv install 2.2.1 && touch /home/vagrant/.rbenv/.rehash'
==> default: Notice: /Stage[main]/Ruby_install/Rbenv::Compile[vagrant/2.2.1]/Exec[rbenv::compile vagrant 2.2.1]/returns: executed successfully
==> default: Debug: /Stage[main]/Ruby_install/Rbenv::Compile[vagrant/2.2.1]/Exec[rbenv::compile vagrant 2.2.1]: The container Rbenv::Compile[vagrant/2.2.1] will propagate my refresh event
==> default: Debug: Executing '/bin/su - vagrant -c RBENV_VERSION=2.2.1 /home/vagrant/.rbenv/versions/2.2.1/bin/gem list --local bundler$'
==> default: Debug: Executing '/bin/su - vagrant -c RBENV_VERSION=2.2.1 /home/vagrant/.rbenv/versions/2.2.1/bin/gem install --no-rdoc --no-ri bundler'
==> default: Notice: /Stage[main]/Ruby_install/Rbenv::Compile[vagrant/2.2.1]/Rbenv::Gem[rbenv::bundler vagrant 2.2.1]/Rbenvgem[vagrant/2.2.1/bundler/present]/ensure: created
==> default: Debug: /Stage[main]/Ruby_install/Rbenv::Compile[vagrant/2.2.1]/Rbenv::Gem[rbenv::bundler vagrant 2.2.1]/Rbenvgem[vagrant/2.2.1/bundler/present]: The container Rbenv::Gem[rbenv::bundler vagrant 2.2.1] will propagate my refresh event
==> default: Debug: Rbenv::Gem[rbenv::bundler vagrant 2.2.1]: The container Rbenv::Compile[vagrant/2.2.1] will propagate my refresh event
==> default: Debug: Exec[rbenv::rehash vagrant 2.2.1](provider=posix): Executing check '[ -e '/home/vagrant/.rbenv/.rehash' ]'
==> default: Debug: Executing '[ -e '/home/vagrant/.rbenv/.rehash' ]'
==> default: Debug: Exec[rbenv::rehash vagrant 2.2.1](provider=posix): Executing 'rbenv rehash && rm -f /home/vagrant/.rbenv/.rehash'
==> default: Debug: Executing 'rbenv rehash && rm -f /home/vagrant/.rbenv/.rehash'
==> default: Notice: /Stage[main]/Ruby_install/Rbenv::Compile[vagrant/2.2.1]/Exec[rbenv::rehash vagrant 2.2.1]/returns:executed successfully
==> default: Debug: /Stage[main]/Ruby_install/Rbenv::Compile[vagrant/2.2.1]/Exec[rbenv::rehash vagrant 2.2.1]: The container Rbenv::Compile[vagrant/2.2.1] will propagate my refresh event
==> default: Debug: Rbenv::Compile[vagrant/2.2.1]: The container Class[Ruby_install] will propagate my refresh event
==> default: Debug: Class[Ruby_install]: The container Stage[main] will propagate my refresh event
==> default: Debug: Exec[bundle install](provider=posix): Executing 'bundle install'
==> default: Debug: Executing 'bundle install'
==> default: Error: rbenv: bundle: command not found
==> default:
==> default: The `bundle' command exists in these Ruby versions:
==> default:   2.2.1
==> default:
==> default: Error: /Stage[main]/Main/Exec[bundle install]/returns: change from notrun to 0 failed: rbenv: bundle: command not found
==> default:
==> default: The `bundle' command exists in these Ruby versions:
==> default:   2.2.1

@discorick
Copy link
Member

Let's punt on adding bundler to this PR, and have a more general 'update puppet manifest' PR at a later date

:shipit:

discorick added a commit that referenced this pull request Mar 3, 2016
Clean Vagrant+Windows Install
@discorick discorick merged commit 92bda6c into master Mar 3, 2016
@discorick discorick deleted the clean-install branch March 3, 2016 17:14
@dahlbyk dahlbyk mentioned this pull request May 15, 2016
3 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants