Comments (4)
Can you please check the user nginx runs as, and that said user has permission to execute the script. Also, you mention having set the hook per-app can you clarify that point a bit? For example Passenger does not support putting the passenger_ctl
directive in a server{}
block, which is commonly how per-app settings are set, but will cause an nginx config error for this directive, which we can see does not happen in the systemctl status -l nginx
output, so I am not sure how that was configured.
from passenger.
Thanks for the quick response!
Can you please check the user nginx runs as, and that said user has permission to execute the script
Nginx is running as root with the worker processes running as nobody:
[ec2-user@intercom-production-system-test-web ~]$ ps aux | grep nginx
root 1106236 0.0 0.0 82344 3248 ? Ss Nov30 0:00 nginx: master process /opt/nginx/sbin/nginx
nobody 1106237 0.0 0.0 86596 12284 ? S Nov30 0:01 nginx: worker process
nobody 1106238 0.0 0.0 86596 12336 ? S Nov30 0:01 nginx: worker process
nobody 1106239 0.0 0.0 86596 8256 ? S Nov30 0:01 nginx: worker process
nobody 1106240 0.0 0.0 86596 12272 ? S Nov30 0:01 nginx: worker process
[ec2-user@intercom-production-system-test-web ~]$ sudo -u nobody /usr/local/bin/passenger_hook_test.sh
/usr/local/bin/passenger_hook_test.sh: line 5: /tmp/hook_test.log: Permission denied
The passenger process runs as ec2-user which also has permissions to execute the script
[ec2-user@intercom-production-system-test-web ~]$ ps aux | grep passenger
root 840976 0.0 0.1 256484 30796 ? S Nov30 1:19 passenger-datadog
ec2-user 1106178 0.0 0.0 293796 15968 ? Ssl Nov30 0:00 /usr/bin/ruby /usr/local/bin/flying-passenger --socket-file=/apps/intercom/current/log/flying-passenger.sock --max-pool-size=32 --daemonize --log-file=/apps/intercom/current/log/passenger-debug.log --pid-file=/apps/intercom/current/log/flying-passenger.pid
ec2-user 1215720 0.0 0.0 119424 1004 pts/0 S+ 10:52 0:00 grep --color=auto passenger
[ec2-user@intercom-production-system-test-web ~]$ sudo -u ec2-user /usr/local/bin/passenger_hook_test.sh
You mention having set the hook per-app can you clarify that point a bit?
Yep sorry this was indeed a bit unclear on my part. We have a global nginx.conf
file and compose the configuration with additional files generated as part of our application deployment process.
Here's the abridged version of the global nginx.conf
http {
passenger_ctl hook_spawn_failed /usr/local/bin/passenger_spawn_failed.sh;
passenger_ctl hook_before_watchdog_initialization /usr/local/bin/passenger_hook_test.sh;
passenger_ctl hook_attached_process /usr/local/bin/passenger_hook_test.sh;
}
include "/opt/nginx/conf/conf.d/generated-39c9c5f82db8.conf";
Inside of generated-39c9c5f82db8.conf
the hook configuration is top-level and not inside any config block:
passenger_ctl hook_spawn_failed /usr/local/bin/passenger_spawn_failed.sh;
passenger_ctl hook_before_watchdog_initialization /usr/local/bin/passenger_hook_test.sh;
passenger_ctl hook_attached_process /usr/local/bin/passenger_hook_test.sh;
I wasn't sure whether to add these at the global level or in the composed files so added them in both during the debugging process, but it didn't work when only adding them to a single file.
from passenger.
Can you try adding --ctl "hook_spawn_failed=/usr/local/bin/passenger_spawn_failed.sh"
to your flying passenger start command? Most nginx directives that are only valid in the global context, e.g. passenger_log_level, have no effect when using Flying Passenger. Instead, you are supposed to pass these configuration directives through command line options to the Flying Passenger daemon. Configuration directives that have no effect on Flying Passenger are documented as such. You can assume that configuration directives that are not documented as such, work fine on Flying Passenger. You can also use flying-passenger --help
to see the options that it takes.
from passenger.
This is now working when using the --ctl
option. Thanks for your help.
from passenger.
Related Issues (20)
- Would be great to have a 6.0.19 release! HOT 2
- DeprecationWarning in wsgi-loader.py: imp module is deprecated in favor of importlib HOT 1
- Issues with cookies when using latest Passenger and Rack 3 (w/ Ruby on Rails 7.1) HOT 20
- mod_passenger dependency issues HOT 1
- Feature Request - Log crashes to stderr instead of files HOT 2
- Fails to recognise Nestjs app start HOT 2
- Uninitialized constant Rackup::Handler::Rack (NameError) [Rack 3] HOT 6
- Error loading libssl.so.1.1 when starting Phusion Passenger Standalone HOT 1
- Bad Signing Key for Debian Bullseye HOT 3
- Restarting doesn't remove deleted environment variables in rbenv-vars HOT 1
- String conversion while handling native Ruby support lib LoadErrors can cause errors HOT 1
- Feature request: Ability to configure path to error renderer template
- Deprecation warning with ActiveRecord 7.1.2
- passenger-install-nginx-module is running after installation as a dynamic module HOT 8
- Security update without published advisory HOT 2
- Memory leak HOT 3
- Crash when starting Ruby 3.3.0 Rails 7 application HOT 3
- Disable secure headers option for GLS HOT 1
- HTTP3/QUIC breaks passenger Python apps ( Nginx + HTTP3 + Passenger ) HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from passenger.