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
Developer bootstrap improvements #161
Developer bootstrap improvements #161
Conversation
The sqlite example won’t work in development due to dependencies on ThinkingSphinx, which doesn’t support sqlite3. The vagrant example works fine in non-vagrant setups.
Add rake task to bootstrap dev setup. * Copy config examples in place * Perform bundle:install * Check for Sphinx install * generate Sphinx configs (via ThinkingSphinx) * generate Sphinx indices
Working on fixing travis-ci. Will update shortly. |
Not needed for travis-ci anymore
Allows `travis lint` for checking travis config
Cleans up deprecation: DEPRECATION WARNING: You are passing an instance of ActiveRecord::Base to `find`. Please pass the id of the object by calling `.id`. (called from load_episode at /home/travis/build/SUSE/hackweek/app/controllers/projects_controller.rb: 207)
Cleans up deprecation: DEPRECATION WARNING: Extra .css in SCSS file is unnecessary. Rename /home/travis/build/SUSE/hackweek/app/assets/stylesheets/strap-on.css.scs s to /home/travis/build/SUSE/hackweek/app/assets/stylesheets/strap-on.scss. (called from _app_views_projects_show_html_haml___2150580354090734029_98454160 at /home/travis/build/SUSE/hackweek/app/views/projects/show.html.haml:16) DEPRECATION WARNING: Extra .css in SCSS file is unnecessary. Rename /home/travis/build/SUSE/hackweek/app/assets/stylesheets/zoomed.css.scss to /home/travis/build/SUSE/hackweek/app/assets/stylesheets/zoomed.scss. (called from _app_views_projects_show_html_haml___2150580354090734029_98454160 at /home/travis/build/SUSE/hackweek/app/views/projects/show.html.haml:16) DEPRECATION WARNING: Extra .css in SCSS file is unnecessary. Rename /home/travis/build/SUSE/hackweek/app/assets/stylesheets/strap-on.css.scs s to /home/travis/build/SUSE/hackweek/app/assets/stylesheets/strap-on.scss. (called from _app_views_projects_show_html_haml___2150580354090734029_98454160 at /home/travis/build/SUSE/hackweek/app/views/projects/show.html.haml:16) DEPRECATION WARNING: Extra .css in SCSS file is unnecessary. Rename /home/travis/build/SUSE/hackweek/app/assets/stylesheets/zoomed.css.scss to /home/travis/build/SUSE/hackweek/app/assets/stylesheets/zoomed.scss. (called from _app_views_projects_show_html_haml___2150580354090734029_98454160 at /home/travis/build/SUSE/hackweek/app/views/projects/show.html.haml:16)
Gets all the rest of these: DEPRECATION WARNING: You are passing an instance of ActiveRecord::Base to `find`. Please pass the id of the object by calling `.id`. (called from load_episode at /Users/purp/Library/Mobile Documents/com~apple~CloudDocs/purp/work/hackweek/app/controllers/project s_controller.rb:207)
Depreciation cleanups
.travis.yml
Outdated
@@ -10,10 +12,13 @@ notifications: | |||
on_failure: change | |||
before_install: | |||
- "echo 'gem: --no-ri --no-rdoc' > ~/.gemrc" | |||
before_script: | |||
- mysql -e 'CREATE DATABASE hackweek_test;' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
bundle exec rake db:create
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agree that should work. I was following the recommendation from the Travis CI docs for MySQL with ActiveRecord. Will change to bundle exec
.travis.yml
Outdated
- RAILS_ENV=test bundle exec rake db:migrate --trace | ||
- RAILS_ENV=test bundle exec rake db:migrate --trace | ||
env: | ||
- TRAVIS=true |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
travis sets this automatically -> https://docs.travis-ci.com/user/environment-variables/#Default-Environment-Variables
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ha! I missed that, and "invented" my own. Will change.
Gemfile
Outdated
@@ -73,6 +72,8 @@ gem 'capybara', :group => [:development, :test] | |||
gem 'paperclip', '~> 4.1' | |||
# as interactive debugger in error pages | |||
gem 'web-console', '~> 2.0', group: :development | |||
# Help with travis config testing | |||
gem 'travis', :group => [:development, :test] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Too many dependencies just for a linter, we don't have to have this in the bundle I think.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fair. I'll drop it.
@@ -0,0 +1,51 @@ | |||
# Don't add any includes that aren't in the Ruby std-lib here, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We already have the vagrant box and this is duplicating bootstrap.sh a lot. Too much for my taste, sorry.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I understand, and I'm not sure I see the duplication that you do.
The rake task intends to handle only Rails-oriented environment setup. It does five main things:
- Copy required Rails config files into place
- Install required Ruby gems using the
bundle
command - Set up the required databases for the Rails app (create, migrate, and seed)
- Generate Sphinx configuration for the Rails app (first checking that Sphinx is installed)
- Generate Sphinx indexes for the Rails app
When I look at bootstrap.sh
, the only overlap I see between this rake task and bootstrap.sh
is copying the proper database configuration file in place. Perhaps I'm not seeing other parts which overlap. Could you say more about this?
Meanwhile, I think we could separate concerns into two here:
- Setting up the development machine (installing packages like mysql and sphinx, configuring the system, etc.) This should definitely be handled by
bootstrap.sh
for the OpenSUSE vagrant-based development environment. - Setting up the Rails app and Rails environment. This could be handled for all environments by the rake task here.
Doing this could DRY up a couple of things:
bootstrap.sh
could call the rake task once the development machine setup is complete- We could replace the entire
before_script
section intravis.yml
withbundle exec rake dev:bootstrap
I'm happy to extend this PR to cover those changes, as well as updating the README, if you agree with this direction.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That would be a way to make setting up in travis/vagrant more DRY yes.
However I'm not really convinced that we need to 'hide' away the standard rails env setup tasks from people. People are used to this, this is mentioned in documentation, tutorials etc. etc.
Let's do this for travis/vagrant and only mention this after the 'standard' steps like:
To make this more convenient for you we have setup a rake task that executes the above steps:
bundle exec rake dev:boostrap
Okay? :-)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like it. I'll update the PR this morning.
As @hennevogel points out, this is a default set by Travis CI.
It adds a kerjillion dependencies.
`rake` is evidently not available on the system in `before_install`
That leads to an interesting failure that I can't reproduce locally. I'm going to ponder how to debug this a bit. |
* Rails.root.join was overcomplicated * I forgot to include the actual copy command =\
Fixed in 031482c |
@purp anything left to do? |
Add hackweek 15 intro video
The sqlite example won’t work in development due to dependencies on ThinkingSphinx, which doesn’t support sqlite3. The vagrant example works fine in non-vagrant setups.
Add rake task to bootstrap dev setup. * Copy config examples in place * Perform bundle:install * Check for Sphinx install * generate Sphinx configs (via ThinkingSphinx) * generate Sphinx indices
Not needed for travis-ci anymore
Allows `travis lint` for checking travis config
As @hennevogel points out, this is a default set by Travis CI.
It adds a kerjillion dependencies.
`rake` is evidently not available on the system in `before_install`
* Rails.root.join was overcomplicated * I forgot to include the actual copy command =\
…/purp/hackweek into developer_bootstrap_improvements
Updating to catch up with upstream master, then I'll see if your fix solves the vagrant filesystem mounting issue I saw. If so, I'll finish up changes to Incidentally, the filesystem was mounting when the VM started; I was able to verify via |
Okay, testing seems to show that this works for bootstrapping as well. If it passes, I'm all done here. Thanks, @hennevogel! |
Thank you @purp for your awesome contribution 💐 🎆 🍀 |
Just a rake task to bootstrap a new developer environment.