2018-03-15 20:22:15 +01:00
<!DOCTYPE html>
< html lang = "fr" dir = "ltr" >
< head >
< meta http-equiv = "content-type" content = "text/html; charset=UTF-8" >
< meta charset = "utf-8" / >
< title > documentation:2.0:configplack< / title > <!-- //if:usedebianlibs
< link rel = "stylesheet" type = "text/css" href = "/javascript/bootstrap/css/bootstrap.min.css" / >
//elsif:useexternallibs
< link rel = "stylesheet" type = "text/css" href = "https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" > < / script >
//elsif:cssminified
< link rel = "stylesheet" type = "text/css" href = "/static/bwr/bootstrap/dist/css/bootstrap.min.css" / >
//else --><!-- //endif -->
< meta name = "generator" content = "DokuWiki" / >
< meta name = "robots" content = "noindex,nofollow" / >
< meta name = "keywords" content = "documentation,2.0,configplack" / >
< link rel = "search" type = "application/opensearchdescription+xml" href = "lib/exe/opensearch.html" title = "LemonLDAP::NG" / >
< link rel = "start" href = "configplack.html" / >
< link rel = "contents" href = "configplack.html" title = "Sitemap" / >
< link rel = "stylesheet" type = "text/css" href = "lib/exe/css.php.t.bootstrap3.css" / >
< link rel = "stylesheet" type = "text/css" href = "/static/bwr/bootstrap/dist/css/bootstrap.css" / >
< script type = "text/javascript" > / * < ! [ C D A T A [ * / v a r N S = ' d o c u m e n t a t i o n : 2 . 0 ' ; v a r J S I N F O = { " i d " : " d o c u m e n t a t i o n : 2 . 0 : c o n f i g p l a c k " , " n a m e s p a c e " : " d o c u m e n t a t i o n : 2 . 0 " } ;
/*!]]>*/< / script >
< script type = "text/javascript" charset = "utf-8" src = "lib/exe/js.php.t.bootstrap3.js" > < / script > <!-- //if:usedebianlibs
< script type = "text/javascript" src = "/javascript/jquery/jquery.min.js" > < / script >
//elsif:useexternallibs
< script type = "text/javascript" src = "http://code.jquery.com/jquery-2.2.0.min.js" > < / script >
//elsif:jsminified
< script type = "text/javascript" src = "/static/bwr/jquery/dist/jquery.min.js" > < / script >
//else -->
< script type = "text/javascript" src = "/static/bwr/jquery/dist/jquery.js" > < / script > <!-- //endif --> <!-- //if:usedebianlibs
< script type = "text/javascript" src = "/javascript/jquery-ui/jquery-ui.min.js" > < / script >
//elsif:useexternallibs
< script type = "text/javascript" src = "http://code.jquery.com/ui/1.10.4/jquery-ui.min.js" > < / script >
//elsif:jsminified
< script type = "text/javascript" src = "/static/bwr/jquery-ui/jquery-ui.min.js" > < / script >
//else -->
< script type = "text/javascript" src = "/static/bwr/jquery-ui/jquery-ui.js" > < / script > <!-- //endif -->
< / head >
< body >
< div class = "dokuwiki export container" >
< h1 class = "sectionedit1" id = "deploy_lemonldapng_on_a_plack_server" > Deploy LemonLDAP::NG on a Plack server< / h1 >
< div class = "level1" >
< p >
2018-03-23 06:52:15 +01:00
< a href = "https://metacpan.org/release/Plack" class = "urlextern" title = "https://metacpan.org/release/Plack" rel = "nofollow" > Plack< / a > is a powerful engine that powers many very fast < a href = "http://plackperl.org/#servers" class = "urlextern" title = "http://plackperl.org/#servers" rel = "nofollow" > servers< / a > . LLNG uses some Plack libraries to run as FastCGI server. It can so easily be launched on these servers. See also < a href = "psgi.html" class = "wikilink1" title = "documentation:2.0:psgi" > Advanced PSGI usage< / a > if you want to replace LLNG FastCGI server.
2018-03-15 20:22:15 +01:00
< / p >
2018-03-23 06:52:15 +01:00
< / div > <!-- EDIT1 SECTION "Deploy LemonLDAP::NG on a Plack server" [1 - 377] -->
2018-03-15 20:22:15 +01:00
< h2 class = "sectionedit2" id = "complete_example" > Complete example< / h2 >
< div class = "level2" >
2018-03-20 19:42:50 +01:00
< dl class = "file" >
< dt > < a href = "_export/code/documentation/2.0/configplack/codeblock.0.code" title = "Download Snippet" class = "mediafile mf_psgi" > llapp.psgi< / a > < / dt >
< dd > < pre class = "code file perl" > < span class = "co1" > #!/usr/bin/perl< / span >
2018-03-15 20:22:15 +01:00
< span class = "kw2" > use< / span > Data< span class = "sy0" > ::< / span > < span class = "me2" > Dumper< / span > < span class = "sy0" > ;< / span >
< span class = "kw2" > use< / span > Plack< span class = "sy0" > ::< / span > < span class = "me2" > Builder< / span > < span class = "sy0" > ;< / span >
< span class = "co1" > # Basic test app< / span >
< span class = "kw1" > my< / span > < span class = "re0" > $testApp< / span > < span class = "sy0" > =< / span > < span class = "kw2" > sub< / span > < span class = "br0" > {< / span >
< span class = "kw1" > my< / span > < span class = "br0" > (< / span > < span class = "re0" > $env< / span > < span class = "br0" > )< / span > < span class = "sy0" > =< / span > < span class = "co5" > @_< / span > < span class = "sy0" > ;< / span >
< a href = "http://perldoc.perl.org/functions/return.html" > < span class = "kw3" > return< / span > < / a > < span class = "br0" > [< / span >
< span class = "nu0" > 200< / span > < span class = "sy0" > ,< / span >
< span class = "br0" > [< / span > < span class = "st_h" > 'Content-Type'< / span > < span class = "sy0" > => < / span > < span class = "st_h" > 'text/plain'< / span > < span class = "br0" > ]< / span > < span class = "sy0" > ,< / span >
< span class = "br0" > [< / span > < span class = "st0" > "Hello LLNG world< span class = "es0" > \n< / span > < span class = "es0" > \n< / span > "< / span > < span class = "sy0" > .< / span > Dumper< span class = "br0" > (< / span > < span class = "re0" > $env< / span > < span class = "br0" > )< / span > < span class = "br0" > ]< / span > < span class = "sy0" > ,< / span >
< span class = "br0" > ]< / span > < span class = "sy0" > ;< / span >
< span class = "br0" > }< / span > < span class = "sy0" > ;< / span >
< span class = "co1" > # Build protected app< / span >
< span class = "kw1" > my< / span > < span class = "re0" > $test< / span > < span class = "sy0" > =< / span > builder < span class = "br0" > {< / span >
enable < span class = "st0" > "Auth::LemonldapNG"< / span > < span class = "sy0" > ;< / span >
< span class = "re0" > $testApp< / span > < span class = "sy0" > ;< / span >
< span class = "br0" > }< / span > < span class = "sy0" > ;< / span >
< span class = "co1" > # Build portal app< / span >
< span class = "kw2" > use< / span > Lemonldap< span class = "sy0" > ::< / span > < span class = "me2" > NG< / span > < span class = "sy0" > ::< / span > < span class = "me2" > Portal< / span > < span class = "sy0" > ::< / span > < span class = "me2" > Main< / span > < span class = "sy0" > ;< / span >
< span class = "kw1" > my< / span > < span class = "re0" > $portal< / span > < span class = "sy0" > =< / span > builder < span class = "br0" > {< / span >
enable < span class = "st0" > "Plack::Middleware::Static"< / span > < span class = "sy0" > ,< / span >
path < span class = "sy0" > => < / span > < span class = "st_h" > '^/static/'< / span > < span class = "sy0" > ,< / span >
root < span class = "sy0" > => < / span > < span class = "st_h" > '/path/to/portal/htdocs/'< / span > < span class = "sy0" > ;< / span >
Lemonldap< span class = "sy0" > ::< / span > < span class = "me2" > NG< / span > < span class = "sy0" > ::< / span > < span class = "me2" > Portal< / span > < span class = "sy0" > ::< / span > < span class = "me2" > Main< / span > < span class = "sy0" > -> < / span > < span class = "me1" > run< / span > < span class = "br0" > (< / span > < span class = "br0" > {< / span > < span class = "br0" > }< / span > < span class = "br0" > )< / span > < span class = "sy0" > ;< / span >
< span class = "br0" > }< / span > < span class = "sy0" > ;< / span >
< span class = "co1" > # Build manager app< / span >
< span class = "kw2" > use< / span > Lemonldap< span class = "sy0" > ::< / span > < span class = "me2" > NG< / span > < span class = "sy0" > ::< / span > < span class = "me2" > Manager< / span > < span class = "sy0" > ;< / span >
< span class = "kw1" > my< / span > < span class = "re0" > $manager< / span > < span class = "sy0" > =< / span > builder < span class = "br0" > {< / span >
enable < span class = "st0" > "Plack::Middleware::Static"< / span > < span class = "sy0" > ,< / span >
path < span class = "sy0" > => < / span > < span class = "st_h" > '^/static/'< / span > < span class = "sy0" > ,< / span >
root < span class = "sy0" > => < / span > < span class = "st_h" > '/path/to/manager/htdocs/'< / span > < span class = "sy0" > ;< / span >
enable < span class = "st0" > "Plack::Middleware::Static"< / span > < span class = "sy0" > ,< / span >
path < span class = "sy0" > => < / span > < span class = "st_h" > '^/doc/'< / span > < span class = "sy0" > ,< / span >
root < span class = "sy0" > => < / span > < span class = "st_h" > '/path/to/dir/that/contains/"doc"'< / span > < span class = "sy0" > ;< / span >
enable < span class = "st0" > "Plack::Middleware::Static"< / span > < span class = "sy0" > ,< / span >
path < span class = "sy0" > => < / span > < span class = "st_h" > '^/lib/'< / span > < span class = "sy0" > ,< / span >
root < span class = "sy0" > => < / span > < span class = "st_h" > '/path/to/doc/pages/documentation/current/'< / span > < span class = "sy0" > ;< / span >
Lemonldap< span class = "sy0" > ::< / span > < span class = "me2" > NG< / span > < span class = "sy0" > ::< / span > < span class = "me2" > Manager< / span > < span class = "sy0" > -> < / span > < span class = "me1" > run< / span > < span class = "br0" > (< / span > < span class = "br0" > {< / span > < span class = "br0" > }< / span > < span class = "br0" > )< / span > < span class = "sy0" > ;< / span >
< span class = "br0" > }< / span > < span class = "sy0" > ;< / span >
< span class = "co1" > # Global app< / span >
builder < span class = "br0" > {< / span >
mount < span class = "st_h" > 'http://test1.example.com/'< / span > < span class = "sy0" > => < / span > < span class = "re0" > $test< / span > < span class = "sy0" > ;< / span >
mount < span class = "st_h" > 'http://auth.example.com/'< / span > < span class = "sy0" > => < / span > < span class = "re0" > $portal< / span > < span class = "sy0" > ;< / span >
mount < span class = "st_h" > 'http://manager.example.com/'< / span > < span class = "sy0" > => < / span > < span class = "re0" > $manager< / span > < span class = "sy0" > ;< / span >
< span class = "br0" > }< / span > < span class = "sy0" > ;< / span > < / pre >
2018-03-20 19:42:50 +01:00
< / dd > < / dl >
2018-03-15 20:22:15 +01:00
< p >
Launch it with < a href = "https://github.com/miyagawa/Starman" class = "urlextern" title = "https://github.com/miyagawa/Starman" rel = "nofollow" > Starman< / a > for example:
< / p >
< pre class = "code :bash" > < span class = "co4" > $ < / span > starman < span class = "re5" > --port< / span > < span class = "nu0" > 80< / span > < span class = "re5" > --workers< / span > < span class = "nu0" > 32< / span > llapp.psgi< / pre >
2018-03-23 06:52:15 +01:00
< / div > <!-- EDIT2 SECTION "Complete example" [378 - ] -->
2018-03-15 20:22:15 +01:00
< / div >
< / body >
< / html >