From 4e09d9495413b7af132f9b884a609ffbe1219545 Mon Sep 17 00:00:00 2001 From: Maxime Besson Date: Mon, 30 Sep 2024 17:24:06 +0200 Subject: [PATCH 1/2] Allow llng.psgi to be launched by plackup --- e2e-tests/llng.psgi | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/e2e-tests/llng.psgi b/e2e-tests/llng.psgi index 48b4a5da04..4c36146788 100644 --- a/e2e-tests/llng.psgi +++ b/e2e-tests/llng.psgi @@ -6,6 +6,8 @@ use Plack::Builder; # Basic test app my $testApp = sub { my ($env) = @_; + local $Data::Dumper::Sortkeys = 1; + local $Data::Dumper::Indent = 1; return [ 200, [ 'Content-Type' => 'text/plain' ], @@ -43,9 +45,20 @@ my $manager = builder { Lemonldap::NG::Manager->run( {} ); }; +my $domain = $ENV{DNSDOMAIN} || "example.com"; + # Global app +if ( $ENV{PORT} and $ENV{DNSDOMAIN} ) { + print STDERR < $test; - mount 'http://auth.example.com/' => $portal; - mount 'http://manager.example.com/' => $manager; + mount "http://test1.$domain/" => $test; + mount "http://auth.$domain/" => $portal; + mount "http://manager.$domain/" => $manager; }; -- GitLab From 7f71dd140ed386e452d665b15cafa44c41e5faa8 Mon Sep 17 00:00:00 2001 From: Maxime Besson Date: Mon, 30 Sep 2024 17:23:24 +0200 Subject: [PATCH 2/2] Improve makefile --- Makefile | 65 ++++++++++++++++++++++++++++---------------------------- 1 file changed, 32 insertions(+), 33 deletions(-) diff --git a/Makefile b/Makefile index 05698c66b7..a9f008d528 100644 --- a/Makefile +++ b/Makefile @@ -32,7 +32,7 @@ PERLTIDY_VERSION=20220217 # External commands PERL=$$(which perl) PERLVERSION=`perl -e '$$version = $$^V; $$version =~ s/v//; print $$version'` -export PERL5LIB=$(shell echo `pwd`/${SRCCOMMONDIR}/blib/lib:`pwd`/${SRCHANDLERDIR}/blib/lib:`pwd`/${SRCMANAGERDIR}/blib/lib/:`pwd`/${SRCPORTALDIR}/blib/lib/) +export PERL5LIB=$(CURDIR)/${SRCCOMMONDIR}/blib/lib:$(CURDIR)/${SRCHANDLERDIR}/blib/lib:$(CURDIR)/${SRCMANAGERDIR}/blib/lib/:$(CURDIR)/${SRCPORTALDIR}/blib/lib/ SU=su -c COMPRESS=tar czf UNCOMPRESS=tar xzf @@ -449,24 +449,24 @@ prepare_test_server: -@mkdir e2e-tests/conf/manager e2e-tests/conf/portal e2e-tests/conf/api $(MAKE) install_webserver_conf install_test_site install_fastcgi_server \ DNSDOMAIN=$(DNSDOMAIN) \ - CONFDIR=`pwd`/e2e-tests/conf \ + CONFDIR=$(CURDIR)/e2e-tests/conf \ RCONFDIR=e2e-tests/conf \ ERASECONFIG=1 \ VHOSTLISTEN='*:$(TESTWEBSERVERPORT)' \ PORT=$(TESTWEBSERVERPORT) \ - FASTCGISOCKDIR=`pwd`/e2e-tests/conf \ - PORTALSITEDIR=`pwd`/e2e-tests/conf/portal \ - PORTALSTATICDIR=`pwd`/$(SRCPORTALDIR)/site/htdocs/static \ - MANAGERSITEDIR=`pwd`/e2e-tests/conf/manager \ - MANAGERSTATICDIR=`pwd`/$(SRCMANAGERDIR)/site/htdocs/static \ - RUNITDIR=`pwd`/e2e-tests/conf/run \ - RTMPFILESDIR=`pwd`/e2e-tests/conf/tmp \ - TESTDIR=`pwd`/e2e-tests/conf/site \ - DEFDOCDIR=`pwd`/doc \ - SBINDIR=`pwd`/e2e-tests/conf/sbin \ - MANDIR=`pwd`/e2e-tests/conf/man \ - INITDIR=`pwd`/e2e-tests/conf/init \ - ETCDEFAULTDIR=`pwd`/e2e-tests/conf/def + FASTCGISOCKDIR=$(CURDIR)/e2e-tests/conf \ + PORTALSITEDIR=$(CURDIR)/e2e-tests/conf/portal \ + PORTALSTATICDIR=$(CURDIR)/$(SRCPORTALDIR)/site/htdocs/static \ + MANAGERSITEDIR=$(CURDIR)/e2e-tests/conf/manager \ + MANAGERSTATICDIR=$(CURDIR)/$(SRCMANAGERDIR)/site/htdocs/static \ + RUNITDIR=$(CURDIR)/e2e-tests/conf/run \ + RTMPFILESDIR=$(CURDIR)/e2e-tests/conf/tmp \ + TESTDIR=$(CURDIR)/e2e-tests/conf/site \ + DEFDOCDIR=$(CURDIR)/doc \ + SBINDIR=$(CURDIR)/e2e-tests/conf/sbin \ + MANDIR=$(CURDIR)/e2e-tests/conf/man \ + INITDIR=$(CURDIR)/e2e-tests/conf/init \ + ETCDEFAULTDIR=$(CURDIR)/e2e-tests/conf/def #@cp -f e2e-tests/index.* e2e-tests/conf/ @cp -f $(SRCMANAGERDIR)/site/htdocs/manager* e2e-tests/conf/manager @cp -f $(SRCMANAGERDIR)/site/api/api* e2e-tests/conf/api @@ -475,11 +475,11 @@ prepare_test_server: @cp e2e-tests/saml-sp.xml e2e-tests/conf/site/saml-sp.xml @cp e2e-tests/rules.json e2e-tests/conf/site/test.json @for f in $$(find e2e-tests/conf -name '*.fcgi'); do \ - perl -i -pe 'if($$.==2){print "BEGIN{\n"; print qq(use lib q('`pwd`'/lemonldap-ng-$$_/blib/lib);\n) foreach qw(common handler portal manager); print "}\n"; }' $$f; \ + perl -i -pe 'if($$.==2){print "BEGIN{\n"; print qq(use lib q('$(CURDIR)'/lemonldap-ng-$$_/blib/lib);\n) foreach qw(common handler portal manager); print "}\n"; }' $$f; \ done @cp e2e-tests/lmConf-1.json e2e-tests/lemonldap-ng*.ini e2e-tests/env.conf e2e-tests/test-nginx.conf e2e-tests/conf/ @cp e2e-tests/form.html e2e-tests/conf/site - @perl -i -pe 'BEGIN{$$p=`pwd`;chomp $$p}s#__pwd__#$$p#;s#__port__#$(TESTWEBSERVERPORT)#;s#__FASTCGISOCKDIR__#$(FASTCGISOCKDIR)#;s#__domain__#$(DNSDOMAIN)#g;' \ + @perl -i -mCwd -pe 'BEGIN{$$p=Cwd::getcwd()}s#__pwd__#$$p#;s#__port__#$(TESTWEBSERVERPORT)#;s#__FASTCGISOCKDIR__#$(FASTCGISOCKDIR)#;s#__domain__#$(DNSDOMAIN)#g;' \ e2e-tests/conf/lemonldap-ng*.ini \ e2e-tests/conf/lmConf-1.json \ e2e-tests/conf/env.conf \ @@ -507,7 +507,7 @@ start_web_server: all prepare_test_server set globalStorage Apache::Session::SQLite3; \ LLNG_DEFAULTCONFFILE=e2e-tests/conf/lemonldap-ng.ini \ perl lemonldap-ng-common/scripts/lemonldap-ng-cli --yes 1 \ - addKey globalStorageOptions DataSource 'dbi:SQLite:dbname='`pwd`'/e2e-tests/conf/sessions.db'; \ + addKey globalStorageOptions DataSource 'dbi:SQLite:dbname='$(CURDIR)'/e2e-tests/conf/sessions.db'; \ fi @# Debian: make start_web_server TESTBACKEND=LDAP LLNGTESTLDAP_SCHEMA_DIR=/etc/ldap/schema LLNGTESTLDAP_SLAPADD_BIN=/usr/sbin/slapadd @if test "$(TESTBACKEND)" = "LDAP"; then \ @@ -551,17 +551,17 @@ start_web_server: all prepare_test_server else \ APACHEARGS=; \ fi; \ - LLNG_DEFAULTCONFFILE=`pwd`/e2e-tests/conf/lemonldap-ng.ini /usr/sbin/apache2 -d `pwd`/e2e-tests -f apache2.conf $$APACHEARGS -k start; \ + LLNG_DEFAULTCONFFILE=$(CURDIR)/e2e-tests/conf/lemonldap-ng.ini /usr/sbin/apache2 -d $(CURDIR)/e2e-tests -f apache2.conf $$APACHEARGS -k start; \ elif test "$(TESTWEBSERVER)" = "nginx"; then \ echo "Testing nginx conf"; \ - $(NGINX) -t -p `pwd`/e2e-tests \ - -g 'error_log '`pwd`'/e2e-tests/conf/nginx.log;' \ - -c `pwd`/e2e-tests/nginx.conf \ + $(NGINX) -t -p $(CURDIR)/e2e-tests \ + -g 'error_log '$(CURDIR)'/e2e-tests/conf/nginx.log;' \ + -c $(CURDIR)/e2e-tests/nginx.conf \ 2>&1 | grep -v 'Permission denied' || true; \ echo "Launching nginx"; \ - $(NGINX) -p `pwd`/e2e-tests \ - -g 'error_log '`pwd`'/e2e-tests/conf/nginx.log;' \ - -c `pwd`/e2e-tests/nginx.conf \ + $(NGINX) -p $(CURDIR)/e2e-tests \ + -g 'error_log '$(CURDIR)'/e2e-tests/conf/nginx.log;' \ + -c $(CURDIR)/e2e-tests/nginx.conf \ 2>&1 | grep -v 'Permission denied' || true; \ echo "Launching plackup"; \ $(MAKE) plackup; \ @@ -572,8 +572,7 @@ start_web_server: all prepare_test_server ARGS=; \ fi; \ echo "ARGS=$$ARGS"; \ - LLNG_DEFAULTCONFFILE=`pwd`/e2e-tests/conf/lemonldap-ng.ini \ - PERL5LIB=`pwd`/lemonldap-ng-common/blib/lib/:`pwd`/lemonldap-ng-handler/blib/lib/:`pwd`/lemonldap-ng-portal/blib/lib/:`pwd`/lemonldap-ng-manager/blib/lib/ \ + LLNG_DEFAULTCONFFILE=$(CURDIR)/e2e-tests/conf/lemonldap-ng.ini \ /usr/bin/start_server \ --log-file=e2e-tests/conf/starman.log \ --pid-file=e2e-tests/conf/server.pid \ @@ -591,12 +590,12 @@ start_web_server: all prepare_test_server reload_web_server: @if [ -e e2e-tests/conf/apache2.pid ]; then \ - LLNG_DEFAULTCONFFILE=`pwd`/e2e-tests/conf/lemonldap-ng.ini \ - /usr/sbin/apache2 -d `pwd`/e2e-tests -f apache2.conf -k graceful; \ + LLNG_DEFAULTCONFFILE=$(CURDIR)/e2e-tests/conf/lemonldap-ng.ini \ + /usr/sbin/apache2 -d $(CURDIR)/e2e-tests -f apache2.conf -k graceful; \ elif [ -e e2e-tests/conf/nginx.pid ]; then \ - $(NGINX) -p `pwd`/e2e-tests \ - -g 'error_log '`pwd`'/e2e-tests/conf/nginx.log;' \ - -c `pwd`/e2e-tests/nginx.conf \ + $(NGINX) -p $(CURDIR)/e2e-tests \ + -g 'error_log '$(CURDIR)'/e2e-tests/conf/nginx.log;' \ + -c $(CURDIR)/e2e-tests/nginx.conf \ -s reload \ 2>&1 | grep -v 'Permission denied' || true; \ kill `cat e2e-tests/conf/llng-fastcgi.pid` || true; \ @@ -631,7 +630,7 @@ stop_web_server: restart_web_server: start_web_server plackup: - @LLNG_DEFAULTCONFFILE=`pwd`/e2e-tests/conf/lemonldap-ng.ini \ + @LLNG_DEFAULTCONFFILE=$(CURDIR)/e2e-tests/conf/lemonldap-ng.ini \ perl -I . e2e-tests/conf/sbin/llng-fastcgi-server \ -F >e2e-tests/conf/fastcgi.log 2>&1 & -- GitLab