Ruby App works with webrick but not with passenger - nginx

I'm trying to deploy a ruby app to a server running Ubuntu -> Nginx -> Passenger.
I can access the site fine using 'rails s' however passenger keeps returning the bellow error into the nginx log. I've checked that rake 12.0.0 is installed and also tried setting up a new rails project to check if passenger would provide the "your on rails" page. But that doesn't work either.
Any help would be greatly appreciated, I've tried googleing and performing various bundle updates and gem installs.
Error ID: a06f05a9
Error details saved to: /tmp/passenger-error-EVNeAF.html
Message from application: <p>It looks like Bundler could not find a gem. Maybe you didn't install all the gems that this application needs. To install your gems, please run:</p>
<pre class="commands">bundle install</pre>
<p>If that didn't work, then the problem is probably caused by your application being run under a different environment than it's supposed to. Please check the following:</p>
<ol>
<li>Is this app supposed to be run as the <code>dmn</code> user?</li>
<li>Is this app being run on the correct Ruby interpreter? Below you will
see which Ruby interpreter Phusion Passenger attempted to use.</li>
<li>Please check whether the correct RVM gemset is being used.</li>
<li>Sometimes, RVM gemsets may be broken.
Try resetting them.</li>
</ol>
<p>-------- The exception is as follows: -------</p>
Could not find rake-12.0.0 in any of the sources (Bundler::GemNotFound)
<pre> /home/dmn/.rvm/gems/ruby-2.3.3/gems/bundler-1.15.4/lib/bundler/spec_set.rb:87:in `block in materialize'
/home/dmn/.rvm/gems/ruby-2.3.3/gems/bundler-1.15.4/lib/bundler/spec_set.rb:81:in `map!'
/home/dmn/.rvm/gems/ruby-2.3.3/gems/bundler-1.15.4/lib/bundler/spec_set.rb:81:in `materialize'
/home/dmn/.rvm/gems/ruby-2.3.3/gems/bundler-1.15.4/lib/bundler/definition.rb:159:in `specs'
/home/dmn/.rvm/gems/ruby-2.3.3/gems/bundler-1.15.4/lib/bundler/definition.rb:218:in `specs_for'
/home/dmn/.rvm/gems/ruby-2.3.3/gems/bundler-1.15.4/lib/bundler/definition.rb:207:in `requested_specs'
/home/dmn/.rvm/gems/ruby-2.3.3/gems/bundler-1.15.4/lib/bundler/runtime.rb:109:in `block in definition_method'
/home/dmn/.rvm/gems/ruby-2.3.3/gems/bundler-1.15.4/lib/bundler/runtime.rb:21:in `setup'
/home/dmn/.rvm/gems/ruby-2.3.3/gems/bundler-1.15.4/lib/bundler.rb:101:in `setup'
/home/dmn/.rvm/gems/ruby-2.3.3/gems/bundler-1.15.4/lib/bundler/setup.rb:19:in `<top (required)>'
/home/dmn/.rvm/rubies/ruby-2.3.3/lib/ruby/site_ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
/home/dmn/.rvm/rubies/ruby-2.3.3/lib/ruby/site_ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
/usr/lib/ruby/vendor_ruby/phusion_passenger/loader_shared_helpers.rb:430:in `activate_gem'
/usr/lib/ruby/vendor_ruby/phusion_passenger/loader_shared_helpers.rb:297:in `block in run_load_path_setup_code'
/usr/lib/ruby/vendor_ruby/phusion_passenger/loader_shared_helpers.rb:435:in `running_bundler'
/usr/lib/ruby/vendor_ruby/phusion_passenger/loader_shared_helpers.rb:296:in `run_load_path_setup_code'
/usr/share/passenger/helper-scripts/rack-preloader.rb:100:in `preload_app'
/usr/share/passenger/helper-scripts/rack-preloader.rb:156:in `<module:App>'
/usr/share/passenger/helper-scripts/rack-preloader.rb:30:in `<module:PhusionPassenger>'
/usr/share/passenger/helper-scripts/rack-preloader.rb:29:in `<main>'</pre>"

Related

Ruby 2.5.3 to 2.6.0 leads to Policy already configured error

When I update ruby 2.5.3 to 2.6.0 and try to run RSpec specs then it's throwing policy already configured error
The error stack as follows
An error occurred while loading ./spec/controllers/example_controller_spec.rb.
Failure/Error: require File.expand_path("../../config/environment", __FILE__)
SecureHeaders::Configuration::AlreadyConfiguredError:
Policy already configured
# /Users/codecpm/.rvm/gems/ruby-2.6.0/gems/secure_headers-6.1.1/lib/secure_headers/configuration.rb:19:in `default'
# ./config/initializers/secure_header.rb:1:in `<top (required)>'
But the server was running fine.
has anybody faced this issue before?

"Environment data not found in the schema." with database-cleaner when calling cucumber repeatedly on Rails 6

Note: This is NOT a dupe of Rails 5, Rspec: Environment data not found in the schema, though it is similar. The affected versions are different, and the solve doesn't work for me.
My Rails setup is as follows:
Rails 6.0.1
cucumber-rails 2.0.0
database_cleaner 1.7.0
Whenever I run cucumber a second or subsequent time, I get this error:
3924 ~/fork/my-proj$ bundle exec cucumber
rails aborted!
ActiveRecord::NoEnvironmentInSchemaError:
Environment data not found in the schema. To resolve this issue, run:
rails db:environment:set RAILS_ENV=test
/Users/grantb/.rvm/gems/ruby-2.6.5/gems/activerecord-6.0.1/lib/active_record/migration.rb:1151:in `last_stored_environment'
/Users/grantb/.rvm/gems/ruby-2.6.5/gems/activerecord-6.0.1/lib/active_record/tasks/database_tasks.rb:60:in `check_protected_environments!'
/Users/grantb/.rvm/gems/ruby-2.6.5/gems/activerecord-6.0.1/lib/active_record/railties/databases.rake:15:in `block (2 levels) in <main>'
/Users/grantb/.rvm/gems/ruby-2.6.5/gems/activerecord-6.0.1/lib/active_record/railties/databases.rake:491:in `block (3 levels) in <main>'
/Users/grantb/.rvm/gems/ruby-2.6.5/gems/railties-6.0.1/lib/rails/commands/rake/rake_command.rb:23:in `block in perform'
/Users/grantb/.rvm/gems/ruby-2.6.5/gems/railties-6.0.1/lib/rails/commands/rake/rake_command.rb:20:in `perform'
/Users/grantb/.rvm/gems/ruby-2.6.5/gems/railties-6.0.1/lib/rails/command.rb:48:in `invoke'
/Users/grantb/.rvm/gems/ruby-2.6.5/gems/railties-6.0.1/lib/rails/commands.rb:18:in `<main>'
/Users/grantb/.rvm/gems/ruby-2.6.5/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require'
/Users/grantb/.rvm/gems/ruby-2.6.5/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `block in require_with_bootsnap_lfi'
/Users/grantb/.rvm/gems/ruby-2.6.5/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in `register'
/Users/grantb/.rvm/gems/ruby-2.6.5/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:21:in `require_with_bootsnap_lfi'
/Users/grantb/.rvm/gems/ruby-2.6.5/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in `require'
/Users/grantb/.rvm/gems/ruby-2.6.5/gems/activesupport-6.0.1/lib/active_support/dependencies.rb:325:in `block in require'
/Users/grantb/.rvm/gems/ruby-2.6.5/gems/activesupport-6.0.1/lib/active_support/dependencies.rb:291:in `load_dependency'
/Users/grantb/.rvm/gems/ruby-2.6.5/gems/activesupport-6.0.1/lib/active_support/dependencies.rb:325:in `require'
bin/rails:4:in `<main>'
Tasks: TOP => db:test:load => db:test:purge => db:check_protected_environments
(See full trace by running task with --trace)
Using the default profile...
[...cucumber continues as normal...]
How the heck can I get rid of that?
If I run rails db:environment:set RAILS_ENV=test, it'll get rid of it for the next run of cucumber, but it will always come back on the run after that.
I found one other answer that suggested adding this to my config, but it did exactly nothing:
# This did NOT fix my problem:
DatabaseCleaner.clean_with(
:truncation,
except: %w(ar_internal_metadata)
)
Clearly database_cleaner is deleting environment data, but I don't know how to make it stop.
Can anyone help me get rid of this annoying warning?
Turns out this problem was specific to database_cleaner 1.7.
A recent upgrade to 1.8.3 made this error stop happening.
(associated Github issue)

Restore fails for a drupal app on openshift

I consistently get failures when trying to restore my drupal app to an openshift gear. The only way I have been able to restore my app is to delete it then recreate the app then add the restore data to the newly created app. It looks like a permissions error.
Anyone else having this issue or have ideas for a solution?
Here is what the process looks like:
andy#hermes:~/Siesta Solutions Projects and Files/Marias/Backups$ rhc snapshot restore mariadaycare -f mariasdaycare.tar.gz
Restoring from snapshot mariasdaycare.tar.gz to application 'mariadaycare' ...
Error in trying to restore snapshot. You can try to restore manually by running:
cat 'mariasdaycare.tar.gz' | ssh
54034e07e0b8cd2608000659#mariadaycare-siestasolutions.rhcloud.com 'restore
INCLUDE_GIT'
andy#hermes:~/Siesta Solutions Projects and Files/Marias/Backups$ cat 'mariasdaycare.tar.gz' | ssh 54034e07e0b8cd2608000659#mariadaycare-siestasolutions.rhcloud.com 'restore INCLUDE_GIT'
Removing old git repo: ~/git/mariadaycare.git/
Removing old data dir: ~/app-root/data/*
Restoring ~/git/mariadaycare.git and ~/app-root/data
/bin/tar: app-root/data/sites/default/settings.php: Cannot open: Permission denied
/bin/tar: Exiting with failure status due to previous errors
/opt/rh/ruby193/root/usr/share/gems/gems/openshift-origin-node-1.28.6/lib/openshift-origin-node/utils/shell_exec.rb:133:in `block (2 levels) in oo_spawn': Shell command '/bin/tar --strip=2 --overwrite -xmz ./*/app-root/data ./*/app-deployments ./*/git --transform="s|${OPENSHIFT_GEAR_NAME}/data|app-root/data|" --transform="s|git/.*\.git|git/${OPENSHIFT_GEAR_NAME}.git|" --exclude="./*/app-root/runtime/data" --exclude="./*/mysql/data" --exclude="./*/php/data" --exclude="./*/phpmyadmin/data" --exclude="./*/cron/data" --exclude="./*/git/*.git/hooks" 1>&2' returned an error. rc=2 (OpenShift::Runtime::Utils::ShellExecutionException)
from /opt/rh/ruby193/root/usr/share/gems/gems/openshift-origin-node-1.28.6/lib/openshift-origin-node/utils/shell_exec.rb:96:in `pipe'
from /opt/rh/ruby193/root/usr/share/gems/gems/openshift-origin-node-1.28.6/lib/openshift-origin-node/utils/shell_exec.rb:96:in `block in oo_spawn'
from /opt/rh/ruby193/root/usr/share/gems/gems/openshift-origin-node-1.28.6/lib/openshift-origin-node/utils/shell_exec.rb:95:in `pipe'
from /opt/rh/ruby193/root/usr/share/gems/gems/openshift-origin-node-1.28.6/lib/openshift-origin-node/utils/shell_exec.rb:95:in `oo_spawn'
from /opt/rh/ruby193/root/usr/share/gems/gems/openshift-origin-container-selinux-0.10.1/lib/openshift/runtime/containerization/selinux_container.rb:368:in `run_in_container_context'
from /opt/rh/ruby193/root/usr/share/gems/gems/openshift-origin-node-1.28.6/lib/openshift-origin-node/model/application_container.rb:795:in `run_in_container_context'
from /opt/rh/ruby193/root/usr/share/gems/gems/openshift-origin-node-1.28.6/lib/openshift-origin-node/model/application_container_ext/snapshots.rb:259:in `extract_restore_archive'
from /opt/rh/ruby193/root/usr/share/gems/gems/openshift-origin-node-1.28.6/lib/openshift-origin-node/model/application_container_ext/snapshots.rb:162:in `restore'
from /usr/bin/gear:585:in `block (2 levels) in <main>'
from /opt/rh/ruby193/root/usr/share/gems/gems/commander-4.0.3/lib/commander/command.rb:180:in `call'
from /opt/rh/ruby193/root/usr/share/gems/gems/commander-4.0.3/lib/commander/command.rb:180:in `call'
from /opt/rh/ruby193/root/usr/share/gems/gems/commander-4.0.3/lib/commander/command.rb:155:in `run'
from /opt/rh/ruby193/root/usr/share/gems/gems/commander-4.0.3/lib/commander/runner.rb:385:in `run_active_command'
from /opt/rh/ruby193/root/usr/share/gems/gems/commander-4.0.3/lib/commander/runner.rb:62:in `run!'
from /opt/rh/ruby193/root/usr/share/gems/gems/commander-4.0.3/lib/commander/delegates.rb:11:in `run!'
from /opt/rh/ruby193/root/usr/share/gems/gems/commander-4.0.3/lib/commander/import.rb:10:in `block in <top (required)>'
andy#hermes:~/Siesta Solutions Projects and Files/Marias/Backups$
I had the same issue many times. One time, it failed and then I login in, change the permission of the settings.php and default/ in the gear (chmod +w, not the snapshot), uploaded the snapshot to the gear and manually restore the snapshot(cat '/path/to/snapshot_file.tar.gz' | oo-restore INCLUDE_GIT). And it worked. I know it seems not logical but maybe you can try.

Rubymine RSpec kind of error after successful test

I am a newbie just learnt how to use RSpec. My RSpec works fine in windows terminal. However, in Rubymine build-in RSpec. It errors after giving success message. Which is really annoying.
Git: https://github.com/ivawzh/sample_app
Please help.
Thanks and best regards.
RSpec works fine in native cmd
Not sure if this matters, this is the Spork drb server
Rubymine build-in RSpec, it says the tests are passed. But errors come after success message.
Error messages:
Running specs...
Command line:
["C:\\Ruby200\\bin\\ruby.exe", "-e", "$stdout.sync=true;$stderr.sync=true;load($0=ARGV.shift)", "C:\\Ruby200\\bin/rspec", "--require", "teamcity/spec/runner/formatter/teamcity/formatter", "--format", "Spec::Runner::Formatter::TeamcityFormatter", "E:/RoR docs/sample_app/spec/controllers/pages_controller_spec.rb", "--drb", "--backtrace"]
2 examples, 0 failures, 2 passed
Finished in 0.17701 seconds
<-- Slave(1) run done!
C:/Ruby200/lib/ruby/gems/2.0.0/gems/rake-10.1.0/lib/rake/file_utils.rb:54:in `block in create_shell_runner': Command failed with status (1): [C:\Ruby200\bin\ruby.exe -e $stdout.sync=tr...] (RuntimeError)
from C:/Ruby200/lib/ruby/gems/2.0.0/gems/rake-10.1.0/lib/rake/file_utils.rb:45:in `call'
from C:/Ruby200/lib/ruby/gems/2.0.0/gems/rake-10.1.0/lib/rake/file_utils.rb:45:in `sh'
from C:/Ruby200/lib/ruby/gems/2.0.0/gems/rake-10.1.0/lib/rake/file_utils_ext.rb:37:in `sh'
from C:/Program Files (x86)/JetBrains/RubyMine 5.4.2/rb/testing/runner/specs_in_folder_runner.rb:139:in `<top (required)>'
from -e:1:in `load'
from -e:1:in `<main>'
Process finished with exit code 1
Environment:
Ruby version 2.0.0 (i386-mingw32)
RubyGems version 2.0.2
Rack version 1.5
Rails version 4.0.0
Environment development
Database adapter postgresql

Meteor 0.5.0 examples not running on Windows

Fresh install of Meteor 0.5.0 on Windows Vista. I don't get the basic examples working. No success after creating the empty'ish hello app either. The shell is running as admin. Meteor recognises that I changed a source file, but then nothing. It doesn't matter where in the filesystem i try this. Always getting
Exited with code: -1073741819:
eg
C:\Users\jawford\Meteor Apps\Examples>meteor create starter3
starter3: created.
To run your new app:
cd starter3
meteor
C:\Users\jawford\Meteor Apps\Examples>cd starter3
C:\Users\jawford\Meteor Apps\Examples\starter3>meteor
[[[[[ C:\Users\jawford\Meteor Apps\Examples\starter3 ]]]]]
Running on: http://localhost:3000/
Exited with code: -1073741819
Exited with code: -1073741819
Exited with code: -1073741819
Your application is crashing. Waiting for file change.
=> Modified -- restarting.
Exited with code: -1073741819
Exited with code: -1073741819
Exited with code: -1073741819
Your application is crashing. Waiting for file change.
^CTerminate batch job (Y/N)? y
C:\Users\jawford\Meteor Apps\Examples\starter3>
If you run into this problem using Windows 8, you will need to change compatibility mode for the node executable.
Go to the folder where you installed Meteor
Open properties for bin/node.exe
Set compatibility mode for Windows 7
You should now be able to start the application as you did earlier.
This has to do with Fibers not loading correctly. You can attempt to run app/meteor/meteor.js with bin/node, both are in the Meteor directory in Program Files. This could maybe give you more details why it is crashing. It might also be handy to run the tests in the lib/node_modules/fibers folder which might point out why Fibers is misbehaving.
The exit code -1073741819 corresponds to C0000005 which indicates an access violation.
Many users find that setting compatibility mode to "Windows 7" solves that problem, but it doesn't always and there is some evidence that it also occurs on Windows 7.
Investigating a later issue on win Meteor 0.5.9, I discovered a problem with fibers on windows that may explain this issue, and I have a tentative fix.
Please see: https://github.com/TomWij/meteor/issues/66#issuecomment-15994548 for further details.

Resources