in reply to Re: Change cgi script to PSGI app
in thread Change cgi script to PSGI app

Line 166 was

 require './Config.pl' i also tried require '/var/www/myapp/Config.pl'

In my configuration for ubic service i have provided CWD path as /var/www/myapp
but ubic service status says not running
The same code runs fine if i use plackup without Starman as server.

plackup -D -r --host 10.1.1.5 --port 8080 --user perl --access-log /va +r/log/psgi/access.log --max-requests 1000 --error-log /var/log/psgi/e +rror.log --app myapp.psgi
I ran this command from /var/www/myapp/ but if i do with with --server argument it gives the same error of @INC
plackup -D -r --host 10.1.1.5 --port 8080 --user perl --access-log /va +r/log/psgi/access.log --max-requests 1000 --error-log /var/log/psgi/e +rror.log --server Starman --app myapp.psgi

Replies are listed 'Best First'.
Re^3: Change cgi script to PSGI app
by Corion (Patriarch) on Sep 12, 2014 at 08:01 UTC

    This is weird. It seems that Starman is doing something that prevents Config.pl from getting loaded, but I see no @INC manipulation. Starman inherits from Net::Server, which does some uid fiddling. Maybe when you're running plain plackup , the user does not get changed to perl, while with Starman, it gets changed?

    Consider checking the user permissions on Config.pl and all upper directories leading to it.

    Update: ... of course then, the error message should be Permission denied instead of File not found. So I'm still confused.

      I think this is more to do with ubic as it status is unkown or not running it never changed to working directory that was provided in config options
      earlier using use Ubic::Service::Starman; i was getting ubic status as not runing.. and @INC
      But now i changed it to below and ubic status is unknown.

      use Ubic::Service::Plack; my $Config={ server => "Plack::Handler::Starman", server_args => { 'listen' =>'10.1.1.5:8080', 'workers' =>16, 'backlog' =>1024, 'max-requests'=>1000, 'daemonize' =>'', 'reload' =>'', 'user' =>'perl', 'access-log' =>'/var/log/psgi/access.log', 'error-log' =>'/var/log/psgi/error.log', 'app' =>'/var/www/myapp/myapp.psgi', }, app => '/var/www/myapp/myapp.psgi', status => sub {}, ubic_log=> '/var/log/psgi/ubic.log', stdout => '/var/log/psgi/stdout.log', stderr => '/var/log/psgi/stderr.log', user =>'perl', group =>'perl', cwd =>'/var/www/myapp/', pidfile =>'/var/log/psgi/domfares.pid', }; return Ubic::Service::Plack->new($Config);
      starman service is running though ubic status is unknown
      Now ubic watchdog tries to start this service every minutes thinking it dead and service restarts every minute.
      Starman error log 2014/09/12-14:25:52 Worker processes cleaned up 2014/09/12-14:25:52 Server closing! Process Backgrounded 2014/09/12-14:26:53 Starman::Server (type Net::Server::PreFork) starti +ng! pid(20742) Binding to TCP port 8080 on host 10.1.1.5 with IPv4 2014/09/12-14:26:53 Can't connect to TCP port 8080 on 10.1.1.5 [Addres +s already in use] at line 68 in file /usr/local/share/perl5/Net/Server/Proto/TCP.pm 2014/09/12-14:26:53 Received QUIT. Running a graceful shutdown 2014/09/12-14:26:53 Worker processes cleaned up 2014/09/12-14:26:53 Server closing! ##Ubic log [Fri Sep 12 14:24:53 2014] 19878 guardian name: ubic-guardian st +arman --backlog 1024 --access-log /var/log/psgi/access.log --max-requ +ests 1000 --app /var/www/myapp/myapp.psgi --error-log /var/log/psgi/e +rror.log --workers 16 --reload --listen 10.1.1.5:8080 --user perl -- +server Plack::Handler::Starman --daemonize /var/www/myapp/myapp.psgi [Fri Sep 12 14:24:53 2014] 19878 obtaining lock... [Fri Sep 12 14:24:53 2014] 19878 got lock [Fri Sep 12 14:24:53 2014] 19878 guardian pid: 19878 [Fri Sep 12 14:24:53 2014] 19878 daemon pid: 19879 [Fri Sep 12 14:24:53 2014] 19878 child guid: 2916133834 [Fri Sep 12 14:25:52 2014] 19878 sending SIGTERM to 19879 [Fri Sep 12 14:25:52 2014] 19878 daemon 19879 exited [Fri Sep 12 14:25:52 2014] 20296 guardian name: ubic-guardian st +arman --backlog 1024 --access-log /var/log/psgi/access.log --max-requ +ests 1000 --app /var/www/myapp/myapp.psgi --error-log /var/log/psgi/e +rror.log --workers 16 --reload --listen 10.1.1.5:8080 --user perl -- +server Plack::Handler::Starman --daemonize /var/www/myapp/myapp.psgi [Fri Sep 12 14:25:52 2014] 20296 obtaining lock... [Fri Sep 12 14:25:52 2014] 20296 got lock [Fri Sep 12 14:25:52 2014] 20296 guardian pid: 20296 [Fri Sep 12 14:25:52 2014] 20296 daemon pid: 20297 [Fri Sep 12 14:25:52 2014] 20296 child guid: 2916139767 [Fri Sep 12 14:26:52 2014] 20296 sending SIGTERM to 20297 [Fri Sep 12 14:26:52 2014] 20296 daemon 20297 exited [Fri Sep 12 14:26:52 2014] 20738 guardian name: ubic-guardian st +arman --backlog 1024 --access-log /var/log/psgi/access.log --max-requ +ests 1000 --app /var/www/myapp/myapp.psgi --error-log /var/log/psgi/e +rror.log --workers 16 --reload --listen 10.1.1.5:8080 --user perl -- +server Plack::Handler::Starman --daemonize /var/www/myapp/myapp.psgi [Fri Sep 12 14:26:52 2014] 20738 obtaining lock... [Fri Sep 12 14:26:52 2014] 20738 got lock [Fri Sep 12 14:26:52 2014] 20738 guardian pid: 20738 [Fri Sep 12 14:26:52 2014] 20738 daemon pid: 20739 [Fri Sep 12 14:26:52 2014] 20738 child guid: 2916145800 [Fri Sep 12 14:26:55 2014] 20738 sending SIGTERM to 20739 [Fri Sep 12 14:26:55 2014] 20738 daemon 20739 exited
      Why ubic status is unknown?