How to run puppetmaster using Apache/Passenger - rack

Running Puppet v2.7.14 on CEntOs 6 and also using Apache/Passenger instead of WEBrick. I was told that puppetmaster service is not required to be running (hence: chkconfig off puppetmaster) running when using httpd and passenger but in my case, if I don't start puppetmasterd manually, none of the agents can connect to the master. I can start httpd just fine and 'passenger' seems to start okay as well. This is my apache configuration file:
# /etc/httpd/conf.d/passenger.conf
LoadModule passenger_module modules/mod_passenger.so
<IfModule mod_passenger.c>
PassengerRoot /usr/lib/ruby/gems/1.8/gems/passenger-3.0.12
PassengerRuby /usr/bin/ruby
#PassengerTempDir /var/run/rubygem-passenger
PassengerHighPerformance on
PassengerUseGlobalQueue on
PassengerMaxPoolSize 15
PassengerPoolIdleTime 150
PassengerMaxRequests 10000
PassengerStatThrottleRate 120
RackAutoDetect Off
RailsAutoDetect Off
</IfModule>
Upon restart, I see these in the httpd_error log:
[Sat Jun 09 04:06:47 2012] [notice] caught SIGTERM, shutting down
[Sat Jun 09 09:06:51 2012] [notice] suEXEC mechanism enabled (wrapper: /usr/sbin/suexec)
[Sat Jun 09 09:06:51 2012] [notice] Digest: generating secret for digest authentication ...
[Sat Jun 09 09:06:51 2012] [notice] Digest: done
[Sat Jun 09 09:06:51 2012] [notice] Apache/2.2.15 (Unix) DAV/2 Phusion_Passenger/3.0.12 mod_ssl/2.2.15 OpenSSL/1.0.0-fips configured -- resuming normal operations
And passenger-status prints these info on the screen:
----------- General information -----------
max = 15
count = 0
active = 0
inactive = 0
Waiting on global queue: 0
----------- Application groups -----------
But still, as I said, none of my agents can actually talk to the master until I start puppetmasterd manually. Does anyone know what am I still missing? Or, is this the way it supposed too be? Cheers!!

It sounds like you may be missing an /etc/httpd/conf.d/puppetmaster.conf file that's based on https://github.com/puppetlabs/puppet/blob/master/ext/rack/files/apache2.conf
Without something like this, you're missing the glue that'll map port 8140 to rack-based pupeptmastd.
See http://docs.puppetlabs.com/guides/passenger.html
https://github.com/puppetlabs/puppet/tree/master/ext/rack
http://www.modrails.com/documentation/Users%20guide%20Apache.html#_deploying_a_rack_based_ruby_application_including_rails_gt_3

After a few days of banging head, now it's running. The main problem was with port number - the puppetmaster was running on different port than puppet agent trying to communicate on.
Another thing is: RackAutoDetect On must be executed before the dashboard vhost file. My So, I renamed passenger vhost file as: 00_passenger.conf to make sure it runs first. After that I get puppetmaster running using Apache/Passenger. Cheers!!

Related

What is NGINX Expecting To See Here?

I've been working on trying to integrate onlyoffice with my working nextcloud app. I've attempted this many times and in many different ways. I believe I understand "most" of the mistakes I've made previously...but there always seems to be one more.
Nextcloud is running on a Ubuntu 22.04 VM. I have another VM operating nginx reverse proxy for this and the other apps I want to expose to the outside. I've decided on this attempt to also run onlyoffice on the nextcloud server but using different ports from that app.
Using the modified template suggested for SSL enabled nginx, when I attempt to start the service, I get:
bonzo#cloud:/etc/nginx/conf.d$ systemctl status nginx.service
nginx.service - A high performance web server and a reverse proxy server
Loaded: loaded (/lib/systemd/system/nginx.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Fri 2022-08-05 15:12:02 CDT; 8s ago
Docs: man:nginx(8)
Process: 7990 ExecStartPre=/usr/sbin/nginx -t -q -g daemon on; master_process on; (code=exited, status=1/FAILURE)
CPU: 26ms
Aug 05 15:12:02 cloud systemd[1]: Starting A high performance web server and a reverse proxy
server...
Aug 05 15:12:02 cloud nginx[7990]: nginx: [emerg] host not found in upstream "docservice" in
/etc/nginx/includes/ds-docservice.conf:74
Aug 05 15:12:02 cloud nginx[7990]: nginx: configuration file /etc/nginx/nginx.conf test failed
Aug 05 15:12:02 cloud systemd[1]: nginx.service: Control process exited, code=exited,
status=1/FAILURE
Aug 05 15:12:02 cloud systemd[1]: nginx.service: Failed with result 'exit-code'.
Aug 05 15:12:02 cloud systemd[1]: Failed to start A high performance web server and a reverse
proxy server.*
When I looked at the line 74 in ds-docservice.conf, it shows this:
location / {
proxy_pass http://docservice;
}
And, I'm not exactly sure what it is expecting to see there. I haven't included it in this first post but I'd be happy to share my ds.conf or any other logs/configs that would be required for help with this. I also realize this is probably going to be something silly that I've missed or messed up, I'm still new to nginx and integrating onlyoffice has been a lot more difficult than you'd think, from the literature and yt vids I've seen!
Thanks for any help

Transferring logs using syslog-ng `as is` without timestamp and hostname etc

Background
Apache server running on a machine and producing logs into /var/log/httpd/error_log
Using syslog-ng to send log to a port 5140
Eventually it will be consumed by kafka producer to be send to a topic
Settings
options {
flush_lines (0);
time_reopen (10);
log_fifo_size (1000);
long_hostnames (off);
use_dns (no);
use_fqdn (no);
create_dirs (no);
keep_hostname (no);
};
source s_apache2 {
file("/var/log/httpd/error_log" flags(no-parse));
}
destination loghost {
tcp("*.*.*.*" port(5140));
}
Problem
syslog-ng prepends timestamp and hostname to the log data which is undesirable
<13>Jan 10 11:01:03 hostname [Tue Jan 10 11:01:02 2017] [notice] Digest: generating secret for digest authentication ...
<13>Jan 10 11:01:03 hostname [Tue Jan 10 11:01:02 2017] [notice] Digest: done
<13>Jan 10 11:01:03 hostname [Tue Jan 10 11:01:02 2017] [notice] Apache/2.2.15 (Unix) DAV/2 PHP/5.4.30 mod_ssl/2.2.15 OpenSSL/1.0.0-fips configured -- resuming normal operations
Desired output (Each log line as is from error_log file)
[Tue Jan 10 11:01:02 2017] [notice] Digest: generating secret for digest authentication ...
[Tue Jan 10 11:01:02 2017] [notice] Digest: done
[Tue Jan 10 11:01:02 2017] [notice] Apache/2.2.15 (Unix) DAV/2 PHP/5.4.30 mod_ssl/2.2.15 OpenSSL/1.0.0-fips configured -- resuming normal operations
Platform
CentOS release 6.4 (Final)
syslog-ng #version:3.2
PS
Syslog-ng to Kafka Integration : Please let me know if anybody has tried this which will render my java Kafka producer redundant
when you use the flags(no-parse) option in syslog-ng, then syslog-ng does not try to parse the different fields of the message, but puts everything into the MESSAGE field of the incoming log message, and prepends a syslog header. To remove this header, use a template in your syslog-ng destination:
template t_msg_only { template("${MSG}\n"); };
destination loghost {
tcp("*.*.*.*" port(5140) template(t_msg_only) );
}
To use the Kafka destination of syslog-ng, you need a newer version of syslog-ng (I'd recommend 3.8 or 3.9). Peter Czanik has written a detailed post about installing new syslog-ng rpm for CentOS.

Setting up Virtual Host with MAMP but not mapping to directory

I tried following these instructions to setup a Virtual Host as literally as I can.
When I try to access the directory using the virtual hostname, I get a 404 Not Found page.
I found a post in the support forum on MAMP saying that a possible problem I'm having is that I can't have my root folder outside of the default folder of /Applilcations/MAMP/htdocs/
Can anyone verify that this information is correct? I can't keep spending more days trying to figure this out!
EDIT: here is what I've done
Added to bottom of httpd-vhosts.conf
<VirtualHost *:80>
ServerName abc.dev
DocumentRoot /Users/micah/Sites/abc/
<Directory /Users/micah/Sites/abc/>
DirectoryIndex index.php
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
Uncommented VH entry in httpd.conf
# Virtual hosts
Include /Applications/MAMP/conf/apache/extra/httpd-vhosts.conf
/etc/hosts file, added to 127.0.0.1
127.0.0.1 localhost abc.dev
Then I restarted the servers and all I get is 404 error.
Here's the last entry in the apache_error.log within MAMP, which doesn't seem to have any relation to whether or not I try to load abc.dev because this was more than an hour ago.
[Wed Apr 02 23:46:38 2014] [notice] caught SIGTERM, shutting down
[Wed Apr 02 23:46:42 2014] [notice] FastCGI: process manager initialized (pid 11519)
[Wed Apr 02 23:46:42 2014] [notice] Digest: generating secret for digest authentication ...
[Wed Apr 02 23:46:42 2014] [notice] Digest: done
[Wed Apr 02 23:46:42 2014] [notice] Apache/2.2.26 (Unix) mod_fastcgi/2.4.6 mod_wsgi/3.4 Python/2.7.6 PHP/5.5.10 mod_ssl/2.2.26 OpenSSL/0.9.8y DAV/2 mod_perl/2.0.8 Perl/v5.18.0 configured -- resuming normal operations
EDIT 4/4: I think I misunderstood my problem. The 404 means the hosts file is doing what it's supposed to but I can't seem to map it to the correct directory for some reason.

Self-stopping a fast-cgi application on Apache

I'm debugging a problem with Apache, Fast-CGI and our Perl application.
The root cause is that the Perl application needs to exit and be reloaded if a certain operation was done.
Under CGI it is not a problem, as the application is being loaded for every request.
However, it seen that the Fast CGI protocol did not considered this case - there is not way to signal the WebServer that you are going to exit - you just exit.
But doing so, we ran into what seemed like a race condition on the mod_fastcgi side: it recognize that the programed exited, but then tries to send it requests. eventually it gives up and return error 500 to the browser.
I see similar error messages on the web, but these are about PHP exiting after 500 requests, and the solution is to tell fastcgi to limit requests-per-process to 500. This does not fit my problem, as I need to exit on certain request and not after fixed number of requests.
Info:
Apache module loading:
LoadModule fastcgi_module libexec/apache2/mod_fastcgi.so
Two log lines: the server detects that the app exited, but then trying to connect it
[Thu Jul 05 15:02:32 2012] [warn] FastCGI: (dynamic) server "/Users/sfomberg/Sites/cgi-bin/mt/mt.cgi" (pid 9277) terminated by calling exit with status '0'
[Thu Jul 05 15:02:32 2012] [warn] FastCGI: (dynamic) server "/Users/sfomberg/Sites/cgi-bin/mt/mt.cgi" has failed to remain running for 30 seconds given 3 attempts, its restart interval has been backed off to 600 seconds
Finally, giving up:
[Thu Jul 05 15:03:07 2012] [error] [client 127.0.0.1] FastCGI: comm with (dynamic) server "/Users/sfomberg/Sites/cgi-bin/mt/mt.cgi" aborted: (first read) idle timeout (30 sec), referer: http://localhost/~sfomberg/cgi-bin/mt/mt.cgi?__mode=cfg_plugins&blog_id=0&switched=1
[Thu Jul 05 15:03:07 2012] [error] [client 127.0.0.1] FastCGI: incomplete headers (0 bytes) received from server "/Users/sfomberg/Sites/cgi-bin/mt/mt.cgi", referer: http://localhost/~sfomberg/cgi-bin/mt/mt.cgi?__mode=cfg_plugins&blog_id=0&switched=1
I tried to close the listening socket directly before ending the request, (the listening socket is fileno 0) but that didn't work.
thanks.
The problem was because mod_fastcgi was of an old version - 2.4.2
upgrading to 2.4.6 solved it.
Also, mod_fcgid does not have this problem.

Default Index Controller Not Being Called With New Zend Studio Project

I have just purchased a license for Zend Studio 9. I have only a minimal amount of experience with the Zend framework, and no previous experience with Zend Studio. I am using http://framework.zend.com/manual/en/ as a tutorial on the framework and have browsed through the resources located at http://www.zend.com/en/products/studio/resources for help with the studio software.
My main problem is that after creating a new Zend project with zstudio, I'm not seeing the initial welcome message. Here are the steps I am using:
I've already installed the Zend Server and confirmed that web apps are working (made some test files, they all parsed correctly).
Create a new project with Zend Studio.
a. File->New->Local PHP Project
b. For location, I am using C:\Program Files\Zend\Apache2\htdocs.
c. For version I used the default "Zend Framework 1.11.11 (Built-in)"
I go to http://localhost:81/projectname. Instead of the default index controller being called, I just see my directory structure.
Addition info:
OS: Windows 7
PHP version: 5.3
ERROR LOGS:
>[Wed Nov 30 14:32:30 2011] [warn] Init: Session Cache is not configured [hint: SSLSessionCache]
>[Wed Nov 30 14:32:30 2011] [warn] pid file C:/Program Files (x86)/Zend/Apache2/logs/httpd.pid overwritten -- Unclean shutdown of previous Apache run?
>[Wed Nov 30 14:32:30 2011] [notice] Digest: generating secret for digest authentication ...
>[Wed Nov 30 14:32:30 2011] [notice] Digest: done
>[Wed Nov 30 14:32:31 2011] [notice] Apache/2.2.16 (Win32) mod_ssl/2.2.16 OpenSSL/0.9.8o configured -- resuming normal operations
>[Wed Nov 30 14:32:31 2011] [notice] Server built: Aug 8 2010 16:45:53
>[Wed Nov 30 14:32:31 2011] [notice] Parent: Created child process 13788
>[Wed Nov 30 14:32:32 2011] [warn] Init: Session Cache is not configured [hint: SSLSessionCache]
>[Wed Nov 30 14:32:32 2011] [notice] Digest: generating secret for digest authentication ...
>[Wed Nov 30 14:32:32 2011] [notice] Digest: done
>[Wed Nov 30 14:32:33 2011] [notice] Child 13788: Child process is running
>[Wed Nov 30 14:32:33 2011] [notice] Child 13788: Acquired the start mutex.
>[Wed Nov 30 14:32:33 2011] [notice] Child 13788: Starting 64 worker threads.
>[Wed Nov 30 14:32:33 2011] [notice] Child 13788: Starting thread to listen on port 10081.
>[Wed Nov 30 14:32:33 2011] [notice] Child 13788: Starting thread to listen on port 81.
If you navigate to http://localhost:81/projectname/index/index does the correct screen load?
If so:
Check that the .htaccess file in your public directory contains the correct rewrite rules for Zend Framework.
Check your httpd.conf file and make sure index.php is added to the DirectoryIndex directive.
I think the solution is going to be the second bullet, but let me know what you find and I can help further if that doesn't work. Make sure to restart apache after you make any changes to httpd.conf.
Otherwise, report any errors you see when you access the controller directly, and check Apache's error_log file to see if you get any errors.