Bug #9612
closedcouldn't find file 'jquery_pwstrength_bootstrap' when clicking on the users tab
Description
Hi,
Currently trying to install foreman on Debian Wheezy, using compiled ruby ruby 2.0.0p598 (2014-11-13 revision 48408) (could not get it to work with 2.1 nor 2.2).
Everything works as you would expect, but when trying to manage users I get the following error 500:
I tried with a fresh db, with an import of another db, I precompiled and re-precompiled assets and locales, to no avail.
Sprockets::FileNotFound couldn't find file 'jquery_pwstrength_bootstrap' (in /var/vhost/foreman/app/assets/javascripts/password_strength.js:1) app/helpers/layout_helper.rb:24:in `block in javascript' app/helpers/layout_helper.rb:24:in `javascript' app/views/users/index.html.erb:1:in `_app_views_users_index_html_erb___3126045257622594954_23598034968100' app/models/concerns/foreman/thread_session.rb:33:in `clear_thread' lib/middleware/catch_json_parse_errors.rb:9:in `call'
Bundle list is a s follow:
/var/vhost/foreman# bundle list Gems included by the bundle: * CFPropertyList (2.2.8) * actionmailer (3.2.21) * actionpack (3.2.21) * activemodel (3.2.21) * activerecord (3.2.21) * activeresource (3.2.21) * activesupport (3.2.21) * ancestry (2.0.0) * apipie-rails (0.2.6) * arel (3.0.3) * audited (3.0.0) * audited-activerecord (3.0.0) * awesome_print (1.6.1) * bootstrap-sass (3.0.3.0) * builder (3.0.4) * bundler (1.8.3) * deep_cloneable (2.0.2) * erubis (2.7.0) * execjs (2.0.2) * facter (2.4.1) * fast_gettext (0.9.2) * flot-rails (0.0.3) * foreigner (1.4.2) * friendly_id (4.0.10.1) * gettext (2.3.9) * gettext_i18n_rails (0.10.1) * gettext_i18n_rails_js (0.0.9) * gridster-rails (0.1.5) * hike (1.2.3) * hirb (0.7.3) * hirb-unicode (0.0.5) * i18n (0.6.11) * i18n_data (0.6.0) * journey (1.0.4) * jquery-rails (2.0.3) * jquery-ui-rails (4.2.1) * jquery_pwstrength_bootstrap (1.2.2) * json (1.8.2) * kgio (2.9.3) * ldap_fluff (0.3.3) * libv8 (3.11.8.17) * locale (2.0.9) * mail (2.5.4) * mime-types (1.25.1) * minitest (4.7.5) * multi-select-rails (0.9.12) * multi_json (1.10.1) * net-ldap (0.11) * oauth (0.4.7) * paint (0.9.0) * pg (0.18.1) * po_to_json (0.1.0) * polyglot (0.3.5) * power_assert (0.2.3) * quiet_assets (1.1.0) * rabl (0.9.0) * rack (1.4.5) * rack-cache (1.2) * rack-ssl (1.3.4) * rack-test (0.6.3) * rails (3.2.21) * railties (3.2.21) * raindrops (0.13.0) * rake (10.4.2) * rdoc (3.12.2) * ref (1.0.5) * rest-client (1.6.8) * ruby2ruby (2.0.1) * ruby_parser (3.0.3) * safemode (1.2.1) * sass (3.4.13) * sass-rails (3.2.6) * scoped_search (2.7.1) * secure_headers (1.3.4) * sexp_processor (4.4.5) * spice-html5-rails (0.1.5) * sprockets (2.2.3) * sqlite3 (1.3.10) * test-unit (3.0.9) * text (1.3.0) * therubyracer (0.11.3) * thor (0.19.1) * tilt (1.4.1) * treetop (1.4.15) * tzinfo (0.3.43) * uglifier (2.7.1) * unicode-display_width (0.1.1) * unicorn (4.8.3) * uuidtools (2.1.5) * validates_lengths_from_database (0.2.0) * will_paginate (3.0.7) * wirb (1.0.3)
Updated by Dominic Cleal about 9 years ago
It appears that it isn't using the precompiled assets, assuming they exist. You should have: /var/vhost/foreman/public/assets/password_strength.js, password_strength.js.gz etc.
How are you running the application too? I wonder if it's running in the production Rails environment as it should be, usually the RAILS_ENV env var is set to "production". Maybe it's running in "development", which would lead to slightly different behaviour, as it wouldn't use precompiled assets.
Updated by Francois Conil about 9 years ago
That could be my problem.
I was precompiling my assets using the development environment because the production rake task doesn't want to run without a db present (even with initialize_on_precompile=false in my application.rb )
The reason why is because we're packaging it on a build machine, and then deploying the package later on.
How would you suggest going about it?
Updated by Dominic Cleal about 9 years ago
Ah okay, precompiling in the dev environment might not work as it's only configured in the prod env.
We do precompile our packages in the prod env, so I'm surprised that you'd get a database error. Could you run the rake task and pastebin the output please?
Updated by Francois Conil about 9 years ago
Updated by Dominic Cleal about 9 years ago
Yeah, you're right, it does. It looks like what we do in our deb and RPM builds is to copy the example database.yml.example file to database.yml, which uses SQLite (so no DB server, it'll just create db files on the fly), run the rake tasks and then delete it again.
Updated by Dominic Cleal about 9 years ago
Here's an example: https://github.com/theforeman/foreman-packaging/blob/deb/develop/debian/wheezy/foreman/rules
I forgot to mention that 1.8 will support Ruby 2.1. I'm unsure about 2.2 though, it may work.
Updated by Francois Conil about 9 years ago
Ok no worries, I'll do that then.
That was the only reason I was using the development environment.
Thanks for the help!