Sure, here is our PSGI file.
We follow the one for package to sometimes adapt.

Best regards,

Le 05/03/2022 à 01:50, vinod kumar a écrit :
Dear Sir,

Thanks for your mail.
I have plack installed in my system too. But in the source package installation there is no PSGI file in my "/etc/koha" directory. If I use that available in tar package, that will not work as asking for the koha instance name, which is while we set up Koha via deb package. But in source tar installation there is no instance name so the PSGI file not working. Can you please share a sample PSGI file code, which can work for my source package installation.
I shall be thankful to you.

On Sat, Mar 5, 2022 at 12:41 AM Fridolin SOMERS <fridolin.som...@biblibre.com <mailto:fridolin.som...@biblibre.com>> wrote:

    Hi,

    We at Biblibre are using the dev install to run from git sources (in
    /home/koha/src).

    We have a SystemD unit for plack/starman.
    You can adapt it.
    Then edit your Apache configuration to use Starman as backend.

    Best regards,

    Le 03/03/2022 à 03:56, vinod kumar a écrit :
     > Hello Friends,
     >
     > I am a library professional and have been using Koha in my
    library for the
     > last 2 years. I have Koha 20.05.05 installed on Ubuntu 20.04. I have
     > installed Koha using source tar package and not using koha-common
     > installation. I have studied various koha articles to use in Koha
    to boost
     > speed. But in all articles, enabling plack steps given only for
    koha-common
     > installation only, using koha-plack command. In my case, I have
    installed
     > Koha using tar source package, so no such commands were found.
     > Can Anyone guide me how to enable the plack  package for Koha tar
    source
     > package installation. I will be thankful to you.
     > Thanks,
     > _______________________________________________
     >
     > Koha mailing list http://koha-community.org
    <http://koha-community.org>
     > Koha@lists.katipo.co.nz <mailto:Koha@lists.katipo.co.nz>
     > Unsubscribe: https://lists.katipo.co.nz/mailman/listinfo/koha
    <https://lists.katipo.co.nz/mailman/listinfo/koha>

-- Fridolin SOMERS <fridolin.som...@biblibre.com
    <mailto:fridolin.som...@biblibre.com>>
    Software and system maintainer 🦄
    BibLibre, France
    _______________________________________________

    Koha mailing list http://koha-community.org <http://koha-community.org>
    Koha@lists.katipo.co.nz <mailto:Koha@lists.katipo.co.nz>
    Unsubscribe: https://lists.katipo.co.nz/mailman/listinfo/koha
    <https://lists.katipo.co.nz/mailman/listinfo/koha>


--
Fridolin SOMERS <fridolin.som...@biblibre.com>
Software and system maintainer 🦄
BibLibre, France
#!/usr/bin/perl

# This file is part of Koha.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.

use Modern::Perl;

use Plack::Builder;
use Plack::App::CGIBin;
use Plack::App::Directory;
use Plack::App::URLMap;
use Plack::Request;

use Mojo::Server::PSGI;

# Pre-load libraries
use C4::Koha;
use C4::Languages;
use C4::Letters;
use C4::Members;
use C4::XSLT;
use Koha::Caches;
use Koha::Cache::Memory::Lite;
use Koha::Database;
use Koha::DateUtils;
use Koha::Logger;

use CGI qw(-utf8 ); # we will loose -utf8 under plack, otherwise
{
    no warnings 'redefine';
    my $old_new = \&CGI::new;
    *CGI::new = sub {
        my $q = $old_new->( @_ );
        $CGI::PARAM_UTF8 = 1;
        Koha::Caches->flush_L1_caches();
        Koha::Cache::Memory::Lite->flush();
        return $q;
    };
}

my $intranet = Plack::App::CGIBin->new(
    root => '/home/koha/src'
)->to_app;

my $opac = Plack::App::CGIBin->new(
    root => '/home/koha/src/opac'
)->to_app;

my $apiv1  = builder {
    my $server = Mojo::Server::PSGI->new;
    $server->load_app('/home/koha/src/api/v1/app.pl');
    $server->to_psgi_app;
};

builder {
    enable "ReverseProxy";
    enable "Plack::Middleware::Static";

    # + is required so Plack doesn't try to prefix Plack::Middleware::
    eval { require Koha::Middleware::SetEnv; };
    if ( !$@ ) {
        enable "+Koha::Middleware::SetEnv";
    }
    eval { require Koha::Middleware::RealIP; };
    if ( !$@ ) {
        enable "+Koha::Middleware::RealIP";
    }

    mount '/opac'          => $opac;
    mount '/intranet'      => $intranet;
    mount '/api/v1/app.pl' => $apiv1;

};
_______________________________________________

Koha mailing list  http://koha-community.org
Koha@lists.katipo.co.nz
Unsubscribe: https://lists.katipo.co.nz/mailman/listinfo/koha

Reply via email to