RailsEnv setting does not work in Rails Apache Passenger (it will be development)

Asked 2 years ago, Updated 2 years ago, 48 views

I use the Passenger in FreeBSD Apache.In rails4, ruby is above rvm.

When I upgraded the staging machine (RAILS_ENV=staging) from FreeBSD 9.3 RELEASE to 10.3, all the Rails apps that worked happily until now passed development that I didn't specify for some reason to RAILS_ENV.

Migrations are pending; run'bin/rakedb:migrateRAILS_ENV=development' to resolve this issue

It is now displayed as .
Again, RAILS_ENV was originally staging and has already migrated, but it is assumed that it is development for some reason after the version upgrade.

In other words, httpd-vhost.conf specifies RailsEnv staging.By the way, I run several apps in a subdirectory.
Therefore, httpd-vhost.conf is

RailsEnv staging
RailsBaseURI/app1
RailsBaseURI/app2
RailsBaseURI/app3

Both apps will see the Migrations are pending above (which works as an app)

I'm not sure if it's relevant, but if you look at the error in /var/log/httpd-error.log, you'll see

[2018-03-26 19:29:07.8404 42653/0x80540a400age/Cor/CoreMain.cpp:907]: 
Checking which to disconnect long-running connections for process 26796 , 
application/home/staging/www/webapp/app1(staging)
App 26899 stderr: PassengerAgent: environment correction; missing value for SERVER_S
App 26899 stderr: PassengerAgent: environment correction; missing value for SERVER_S

It looks like this.I am not sure if the environment error in the display means the above.Also, I googled PassengerAgent: environment corrupt and missing value for SERVER_S, but I couldn't find a clue.

I tried the Passenger version 5.1.2, 5.1.12, and 5.2.1 and it happens in both versions.Ruby is 2.2.7.

I look forward to your kind cooperation.

ruby-on-rails passenger

2022-09-30 20:23

1 Answers

Correct yourself.

The problem that RAILS_ENV always becomes development no longer occurs after creating .bash_profile in the user directory where the app is located (there was .bashrc but there was no .bash_profile).However, the causal relationship is ambiguous.Does the setting in the user directory have anything to do with it?I'm not sure.

Also, PassengerAgent: environment correction; missing value for SERVER_S did not seem to have anything to do with it.In fact, the following error occurred at the end (I overlooked it) and env was unable to start bash.

/var/log/httpd-error.log errors
↓
App 26899 stderr: env:bash: No such file or directory

Where is the error occurring?
The rvm script was /usr/local/rvm/wrappers/ruby-2.2.7/ruby.
On the first line

#!/usr/bin/env bash

Yes, /usr/bin/env cannot find bash and is No such file or directory.
/usr/local/bin PATH settings do not seem to cross for some reason.

There may be a way to fix it by modifying the rvm or the passenger configuration.
Please let me know if anyone knows.

This time, you can just pass the PATH environment variable under Apache, so you created path.env in /usr/local/etc/envars.d and wrote the PATH to /usr/local/bin. (chmod 755 path.rev →>refrev https://forums.freebsd.org/threads/right-way-to-set-path-for-startup-scripts.7221/).>)

Either way, I'm not sure.


2022-09-30 20:23

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.