From e1e57c7804c297ea81b71e8e2eab6f98dfea8015 Mon Sep 17 00:00:00 2001 From: Bodo Hugo Barwich Date: Sun, 25 Oct 2020 11:07:29 +0000 Subject: [PATCH 01/18] Container Build with SQLite Backend --- .gitignore | 11 +++++++++++ backend-sqlite.docker | 15 +++++++++++++++ 2 files changed, 26 insertions(+) create mode 100644 backend-sqlite.docker diff --git a/.gitignore b/.gitignore index 67b22fe..5fca881 100644 --- a/.gitignore +++ b/.gitignore @@ -6,3 +6,14 @@ html/* perldoc-browser.conf perldoc-browser.sqlite* hypnotoad.pid + +#Project Files +.gitignore +.project + +#Container Runtime Content +.bash_history +.cpanm +.cpanm/* +perl5 +perl5/* diff --git a/backend-sqlite.docker b/backend-sqlite.docker new file mode 100644 index 0000000..b1083a9 --- /dev/null +++ b/backend-sqlite.docker @@ -0,0 +1,15 @@ +FROM debian:buster +RUN apt-get update &&\ + apt-get -y install apt-utils gcc make openssl &&\ + apt-get -y install cpanminus perl-modules &&\ + apt-get -y install libdbi-perl libfile-pushd-perl libipc-run3-perl libmodule-runtime-perl libsort-versions-perl \ + libsyntax-keyword-try-perl libcapture-tiny-perl libhttp-tinyish-perl libnet-ssleay-perl\ + liburl-encode-perl libextutils-config-perl libextutils-helpers-perl libextutils-installpaths-perl +RUN groupadd web &&\ + useradd per1_web -g web -md /home/perldoc-browser -s /sbin/nologin &&\ + chmod a+rx /home/perldoc-browser +VOLUME /sys/fs/cgroup\ + /home/perldoc-browser +#USER per1_web +WORKDIR /home/perldoc-browser +CMD ["bash"] From 75bbbd82bc2face8a422daedc5b68f1bf26c0b83 Mon Sep 17 00:00:00 2001 From: Bodo Hugo Barwich Date: Fri, 6 Nov 2020 19:19:20 +0000 Subject: [PATCH 02/18] docker-compose configuration --- .gitignore | 3 +++ backend-sqlite.docker => Dockerfile | 6 ++++-- docker-compose.yml | 12 ++++++++++++ 3 files changed, 19 insertions(+), 2 deletions(-) rename backend-sqlite.docker => Dockerfile (65%) create mode 100644 docker-compose.yml diff --git a/.gitignore b/.gitignore index 5fca881..b462344 100644 --- a/.gitignore +++ b/.gitignore @@ -17,3 +17,6 @@ hypnotoad.pid .cpanm/* perl5 perl5/* + +#Local Docker-Compose Configuration +docker-compose_*.yml diff --git a/backend-sqlite.docker b/Dockerfile similarity index 65% rename from backend-sqlite.docker rename to Dockerfile index b1083a9..c604acd 100644 --- a/backend-sqlite.docker +++ b/Dockerfile @@ -2,9 +2,11 @@ FROM debian:buster RUN apt-get update &&\ apt-get -y install apt-utils gcc make openssl &&\ apt-get -y install cpanminus perl-modules &&\ - apt-get -y install libdbi-perl libfile-pushd-perl libipc-run3-perl libmodule-runtime-perl libsort-versions-perl \ + apt-get -y install libdbi-perl libfile-pushd-perl libipc-run3-perl libmodule-runtime-perl libsort-versions-perl libdevel-patchperl-perl libmodule-build-tiny-perl libmodule-pluggable-perl\ libsyntax-keyword-try-perl libcapture-tiny-perl libhttp-tinyish-perl libnet-ssleay-perl\ - liburl-encode-perl libextutils-config-perl libextutils-helpers-perl libextutils-installpaths-perl + liburl-encode-perl libextutils-config-perl libextutils-helpers-perl libextutils-installpaths-perl\ + libclone-choose-perl libhash-merge-perl libtest-deep-perl liburi-nested-perl\ + libsql-abstract-perl liburi-db-perl libdbd-sqlite3-perl RUN groupadd web &&\ useradd per1_web -g web -md /home/perldoc-browser -s /sbin/nologin &&\ chmod a+rx /home/perldoc-browser diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..e871fa0 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,12 @@ +version: '3' +services: + web: + container_name: 'perldoc_web' + image: perldoc_web + build: . + ports: + - "3000:3000" + volumes: + - /absolute/path/to/project:/home/perldoc-browser:Z + environment: + - COMPONENT=perldoc_web From 875aac26a766bfccb2731bd77386954ecd8ce570 Mon Sep 17 00:00:00 2001 From: Bodo Hugo Barwich Date: Sun, 8 Nov 2020 18:34:32 +0000 Subject: [PATCH 03/18] Docker Entrypoint Script --- .gitignore | 2 +- Dockerfile | 13 ++-- ...-compose.yml => docker-compose.yml.example | 0 etc/docker/entrypoint.sh | 68 +++++++++++++++++++ 4 files changed, 77 insertions(+), 6 deletions(-) rename docker-compose.yml => docker-compose.yml.example (100%) create mode 100644 etc/docker/entrypoint.sh diff --git a/.gitignore b/.gitignore index b462344..a835271 100644 --- a/.gitignore +++ b/.gitignore @@ -19,4 +19,4 @@ perl5 perl5/* #Local Docker-Compose Configuration -docker-compose_*.yml +docker-compose.yml diff --git a/Dockerfile b/Dockerfile index c604acd..6dfbe3b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -6,12 +6,15 @@ RUN apt-get update &&\ libsyntax-keyword-try-perl libcapture-tiny-perl libhttp-tinyish-perl libnet-ssleay-perl\ liburl-encode-perl libextutils-config-perl libextutils-helpers-perl libextutils-installpaths-perl\ libclone-choose-perl libhash-merge-perl libtest-deep-perl liburi-nested-perl\ - libsql-abstract-perl liburi-db-perl libdbd-sqlite3-perl + libsql-abstract-perl liburi-db-perl libdbd-sqlite3-perl +COPY etc/docker/entrypoint.sh /usr/local/bin/ +RUN chmod u+x,g+x /usr/local/bin/entrypoint.sh\ + && ln -s /usr/local/bin/entrypoint.sh /entrypoint.sh # backwards compat RUN groupadd web &&\ useradd per1_web -g web -md /home/perldoc-browser -s /sbin/nologin &&\ chmod a+rx /home/perldoc-browser -VOLUME /sys/fs/cgroup\ - /home/perldoc-browser -#USER per1_web +VOLUME /home/perldoc-browser +USER per1_web WORKDIR /home/perldoc-browser -CMD ["bash"] +ENTRYPOINT ["entrypoint.sh"] +CMD ["perldoc-browser.pl", "prefork"] diff --git a/docker-compose.yml b/docker-compose.yml.example similarity index 100% rename from docker-compose.yml rename to docker-compose.yml.example diff --git a/etc/docker/entrypoint.sh b/etc/docker/entrypoint.sh new file mode 100644 index 0000000..1759814 --- /dev/null +++ b/etc/docker/entrypoint.sh @@ -0,0 +1,68 @@ +#!/bin/sh + +# @author Bodo (Hugo) Barwich +# @version 2020-11-08 +# @package Docker Deployment +# @subpackage entrypoint.sh +# + + + +set -e + +SERVER=`cat /etc/hostname` + +MDNM=`basename $0` + +echo "Container '${SERVER}.${COMPONENT}': '$MDNM' go ..." + +echo "Container '${SERVER}.${COMPONENT}' - Network:" + +echo `cat -A /etc/hosts` + + +if [ "$1" = "perldoc-browser.pl" ]; then + echo "Command: '$@'" + + echo -n "Mojolicious Version: " + + mojolicious=`perl -MMojolicious -e 'print Mojolicious::VERSION . "\n"; ' 2>/dev/null` + + if [ -n "$mojolicious" ]; then + echo "$mojolicious" + else + echo "NONE" + fi + + echo -n "Search Backend: " + + backend=`cat perldoc-browser.conf | grep -i search_backend | cut -d"'" -f2` + + if [ -z "$backend" ]; then + echo "not recognized!" + echo "Falling back to SQLite Backend ..." + backend="sqlite" + else + echo "$backend" + fi #if [ -z "$backend" ]; then + + if [ -z "$mojolicious" ]; then + #Run cpanm Installation + echo "Installing Dependencies with cpanm ..." + + date +"%s" > log/cpanm_install_$(date +"%F").log + cpanm -vn --installdeps --with-feature=$backend . 2>&1 >> log/cpanm_install_$(date +"%F").log + cpanmrs=$? + date +"%s" >> log/cpanm_install_$(date +"%F").log + + echo "Installation finished with [$cpanmrs]" + else + echo "$mojolicious" + fi #if [ -z "$mojolicious" ]; then + + + echo "Service '$1': Launching ..." +fi #if [ "$1" = "perldoc-browser.pl" ]; then + + +exec ./$@ From f434cb990b757fecc9f798beeeb41ec4cc568c1f Mon Sep 17 00:00:00 2001 From: Bodo Hugo Barwich Date: Sat, 14 Nov 2020 14:53:32 +0000 Subject: [PATCH 04/18] Mojolicious Installation Recoginition --- Dockerfile | 4 ++-- etc/docker/entrypoint.sh | 26 +++++++++++++++----------- 2 files changed, 17 insertions(+), 13 deletions(-) diff --git a/Dockerfile b/Dockerfile index 6dfbe3b..c5cf989 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,14 +1,14 @@ FROM debian:buster RUN apt-get update &&\ apt-get -y install apt-utils gcc make openssl &&\ - apt-get -y install cpanminus perl-modules &&\ + apt-get -y install cpanminus perl-modules liblocal-lib-perl &&\ apt-get -y install libdbi-perl libfile-pushd-perl libipc-run3-perl libmodule-runtime-perl libsort-versions-perl libdevel-patchperl-perl libmodule-build-tiny-perl libmodule-pluggable-perl\ libsyntax-keyword-try-perl libcapture-tiny-perl libhttp-tinyish-perl libnet-ssleay-perl\ liburl-encode-perl libextutils-config-perl libextutils-helpers-perl libextutils-installpaths-perl\ libclone-choose-perl libhash-merge-perl libtest-deep-perl liburi-nested-perl\ libsql-abstract-perl liburi-db-perl libdbd-sqlite3-perl COPY etc/docker/entrypoint.sh /usr/local/bin/ -RUN chmod u+x,g+x /usr/local/bin/entrypoint.sh\ +RUN chmod a+x /usr/local/bin/entrypoint.sh\ && ln -s /usr/local/bin/entrypoint.sh /entrypoint.sh # backwards compat RUN groupadd web &&\ useradd per1_web -g web -md /home/perldoc-browser -s /sbin/nologin &&\ diff --git a/etc/docker/entrypoint.sh b/etc/docker/entrypoint.sh index 1759814..3364154 100644 --- a/etc/docker/entrypoint.sh +++ b/etc/docker/entrypoint.sh @@ -1,11 +1,5 @@ #!/bin/sh -# @author Bodo (Hugo) Barwich -# @version 2020-11-08 -# @package Docker Deployment -# @subpackage entrypoint.sh -# - set -e @@ -26,20 +20,26 @@ if [ "$1" = "perldoc-browser.pl" ]; then echo -n "Mojolicious Version: " - mojolicious=`perl -MMojolicious -e 'print Mojolicious::VERSION . "\n"; ' 2>/dev/null` + perl -MMojolicious -e 'print Mojolicious::VERSION . "\n"; ' 2>/dev/null 1>log/perl_mojolicious.log ||\ + iresult=$? + + mojolicious=`cat log/perl_mojolicious.log` if [ -n "$mojolicious" ]; then - echo "$mojolicious" + echo "$mojolicious [Code: '$iresult']" else - echo "NONE" + echo "NONE [Code: '$iresult']" fi echo -n "Search Backend: " - backend=`cat perldoc-browser.conf | grep -i search_backend | cut -d"'" -f2` + cat perldoc-browser.conf 2>/dev/null | grep -i search_backend | cut -d"'" -f2 >log/web_backend.log ||\ + iresult=$? + + backend=`cat log/web_backend.log` if [ -z "$backend" ]; then - echo "not recognized!" + echo "not recognized [Code: '$iresult']!" echo "Falling back to SQLite Backend ..." backend="sqlite" else @@ -50,6 +50,10 @@ if [ "$1" = "perldoc-browser.pl" ]; then #Run cpanm Installation echo "Installing Dependencies with cpanm ..." + echo "Configuring Local Installation ..." + perl -Mlocal::lib ; + eval $(perl -I ~/perl5/lib/perl5/ -Mlocal::lib) ; + date +"%s" > log/cpanm_install_$(date +"%F").log cpanm -vn --installdeps --with-feature=$backend . 2>&1 >> log/cpanm_install_$(date +"%F").log cpanmrs=$? From 13879e8ee6921cd156074f4c1490bf828f339ad7 Mon Sep 17 00:00:00 2001 From: Bodo Hugo Barwich Date: Sat, 14 Nov 2020 15:04:12 +0000 Subject: [PATCH 05/18] Permitting any other Command than Mojolicious --- etc/docker/entrypoint.sh | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/etc/docker/entrypoint.sh b/etc/docker/entrypoint.sh index 3364154..8e279b7 100644 --- a/etc/docker/entrypoint.sh +++ b/etc/docker/entrypoint.sh @@ -66,7 +66,12 @@ if [ "$1" = "perldoc-browser.pl" ]; then echo "Service '$1': Launching ..." + + #Executing the Mojolicious Application + exec ./$@ + fi #if [ "$1" = "perldoc-browser.pl" ]; then -exec ./$@ +#Launching any other Command +exec $@ From 0fcdc3a8908da58e7ac62db403210623489d1709 Mon Sep 17 00:00:00 2001 From: Bodo Hugo Barwich Date: Sat, 14 Nov 2020 16:11:54 +0000 Subject: [PATCH 06/18] Recognizing Local Module Installation --- etc/docker/entrypoint.sh | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/etc/docker/entrypoint.sh b/etc/docker/entrypoint.sh index 8e279b7..6506859 100644 --- a/etc/docker/entrypoint.sh +++ b/etc/docker/entrypoint.sh @@ -18,11 +18,19 @@ echo `cat -A /etc/hosts` if [ "$1" = "perldoc-browser.pl" ]; then echo "Command: '$@'" + echo "Configuring Local Installation ..." + perl -Mlocal::lib ; + eval $(perl -I ~/perl5/lib/perl5/ -Mlocal::lib) ; + echo -n "Mojolicious Version: " - perl -MMojolicious -e 'print Mojolicious::VERSION . "\n"; ' 2>/dev/null 1>log/perl_mojolicious.log ||\ + perl -MMojolicious -e 'print $Mojolicious::VERSION; ' 2>/dev/null 1>log/perl_mojolicious.log ||\ iresult=$? + if [ -z "$iresult" ]; then + iresult=0 + fi + mojolicious=`cat log/perl_mojolicious.log` if [ -n "$mojolicious" ]; then @@ -50,18 +58,12 @@ if [ "$1" = "perldoc-browser.pl" ]; then #Run cpanm Installation echo "Installing Dependencies with cpanm ..." - echo "Configuring Local Installation ..." - perl -Mlocal::lib ; - eval $(perl -I ~/perl5/lib/perl5/ -Mlocal::lib) ; - date +"%s" > log/cpanm_install_$(date +"%F").log cpanm -vn --installdeps --with-feature=$backend . 2>&1 >> log/cpanm_install_$(date +"%F").log cpanmrs=$? date +"%s" >> log/cpanm_install_$(date +"%F").log echo "Installation finished with [$cpanmrs]" - else - echo "$mojolicious" fi #if [ -z "$mojolicious" ]; then From 5b048a4625071cfc1cea5963a404c1d3b3396993 Mon Sep 17 00:00:00 2001 From: Bodo Hugo Barwich Date: Sat, 14 Nov 2020 16:44:06 +0000 Subject: [PATCH 07/18] Search Backend Recognition --- etc/docker/entrypoint.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/etc/docker/entrypoint.sh b/etc/docker/entrypoint.sh index 6506859..4816950 100644 --- a/etc/docker/entrypoint.sh +++ b/etc/docker/entrypoint.sh @@ -41,7 +41,7 @@ if [ "$1" = "perldoc-browser.pl" ]; then echo -n "Search Backend: " - cat perldoc-browser.conf 2>/dev/null | grep -i search_backend | cut -d"'" -f2 >log/web_backend.log ||\ + cat perldoc-browser.conf 2>/dev/null | grep -i search_backend | cut -d"=" -f2 | cut -d"'" -f2 >log/web_backend.log ||\ iresult=$? backend=`cat log/web_backend.log` From aec4246e480b59568223f76b0d59a18b82c37e47 Mon Sep 17 00:00:00 2001 From: Bodo Hugo Barwich Date: Mon, 23 Nov 2020 12:06:48 +0000 Subject: [PATCH 08/18] Docker Installation and Build Guide --- etc/docker/README.pod | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 etc/docker/README.pod diff --git a/etc/docker/README.pod b/etc/docker/README.pod new file mode 100644 index 0000000..51075eb --- /dev/null +++ b/etc/docker/README.pod @@ -0,0 +1,24 @@ +=head1 NAME + +Perldoc Browser - Docker Deployment + +=head1 DESCRIPTION + +The Objective of the C is to be able to run the C Command in +a seperate Docker Container. +It can be useful to run C Test Suites. + +=head1 REQUIREMENTS + +To build and run the Docker Container the Minimum Requirement is to have the C Service installed. +Additionally the C Command can provide a nice enhancement to ease the Operation +of the Docker Container. + +=head1 INSTALLATION + +To run the Docker Container with the C Command the C Package should +be installed first. The C Package is provided by most Linux Distributions. + +Next the C Service is installed locally. +To install the Docker Engine it is recommended to follow the guides of the Official Documentation +L \ No newline at end of file From 033df5020bced1e4e5445f765fe45b2a13d69fb1 Mon Sep 17 00:00:00 2001 From: Bodo Hugo Barwich Date: Tue, 24 Nov 2020 12:37:31 +0000 Subject: [PATCH 09/18] image build instruction --- etc/docker/README.pod | 46 ++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 45 insertions(+), 1 deletion(-) diff --git a/etc/docker/README.pod b/etc/docker/README.pod index 51075eb..2c29a04 100644 --- a/etc/docker/README.pod +++ b/etc/docker/README.pod @@ -16,9 +16,53 @@ of the Docker Container. =head1 INSTALLATION +=item docker-compose + To run the Docker Container with the C Command the C Package should be installed first. The C Package is provided by most Linux Distributions. +=item Docker Engine + Next the C Service is installed locally. +if you want to use C it is recommended to do this step first because +the C installation can break your Docker Engine installation. To install the Docker Engine it is recommended to follow the guides of the Official Documentation -L \ No newline at end of file +L + +=head1 CONTAINER BUILD + +=item preconditions + +* The Docker Service must be running +* Build User must have access to the Docker Service (perhaps C access is required) +* Current Working Directory must be the Project Root Directory +* The C Build requires a C file which can be created + from the C file + +=item Build with Docker + +The Container Image for the C Web Service was called "I" to difference it +from the Backend Container Image. +So the command to build the docker image is: + + docker build -t perldoc_web . + +=item Build with C + +To build the Container Image with C a C file is required. +It can be created from the C file by copying it. +Within the C file the entry C must be configured to +contain the absolute path to the Project Root Directory on the system. +The C file contains instructions to expose the C Web Service +on Port C<3000> which seems to be the default behaviour for the Application. +If the Application was configured to listen on a different port the file entry C +must be adjusted accordingly. +So the command to build the docker image and launch it is: + + docker-compose up --build + + + + + + From abf9868043e2c73319bbb47c267b34289276cd8e Mon Sep 17 00:00:00 2001 From: Bodo Hugo Barwich Date: Tue, 24 Nov 2020 17:36:20 +0000 Subject: [PATCH 10/18] perl documentation for the container perl version --- Dockerfile | 2 +- etc/docker/README.pod | 11 ++++++++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index c5cf989..e2891bd 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,7 +1,7 @@ FROM debian:buster RUN apt-get update &&\ apt-get -y install apt-utils gcc make openssl &&\ - apt-get -y install cpanminus perl-modules liblocal-lib-perl &&\ + apt-get -y install cpanminus perl-modules perl-doc liblocal-lib-perl &&\ apt-get -y install libdbi-perl libfile-pushd-perl libipc-run3-perl libmodule-runtime-perl libsort-versions-perl libdevel-patchperl-perl libmodule-build-tiny-perl libmodule-pluggable-perl\ libsyntax-keyword-try-perl libcapture-tiny-perl libhttp-tinyish-perl libnet-ssleay-perl\ liburl-encode-perl libextutils-config-perl libextutils-helpers-perl libextutils-installpaths-perl\ diff --git a/etc/docker/README.pod b/etc/docker/README.pod index 2c29a04..0a12858 100644 --- a/etc/docker/README.pod +++ b/etc/docker/README.pod @@ -29,7 +29,7 @@ the C installation can break your Docker Engine installation. To install the Docker Engine it is recommended to follow the guides of the Official Documentation L -=head1 CONTAINER BUILD +=head1 IMAGE BUILD =item preconditions @@ -61,7 +61,16 @@ So the command to build the docker image and launch it is: docker-compose up --build +=head1 IMAGE INITIALISATION +The new built Container Image contains an empty C Installation +To run correctly the Search Backend need to be populated. +So the command to populate the Search Backend is: + + docker run -it -v /absolute/path/to/perldoc_web:/home/perldoc-browser:Z perldoc_web perldoc-browser.pl index all + +This will execute C in the project directory. +The results are stored persistently in the project directory for further container launches. From 31e8c884b174efb7c87c21b675e4fbdfb9dbb73b Mon Sep 17 00:00:00 2001 From: Bodo Hugo Barwich Date: Tue, 24 Nov 2020 19:07:35 +0000 Subject: [PATCH 11/18] image initialisation --- etc/docker/README.pod | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/etc/docker/README.pod b/etc/docker/README.pod index 0a12858..e555bc4 100644 --- a/etc/docker/README.pod +++ b/etc/docker/README.pod @@ -67,10 +67,10 @@ The new built Container Image contains an empty C Installati To run correctly the Search Backend need to be populated. So the command to populate the Search Backend is: - docker run -it -v /absolute/path/to/perldoc_web:/home/perldoc-browser:Z perldoc_web perldoc-browser.pl index all + docker run -it -v /absolute/path/to/project:/home/perldoc-browser:Z perldoc_web perldoc-browser.pl index all -This will execute C in the project directory. -The results are stored persistently in the project directory for further container launches. +This will execute command C in the project directory. +The results will be stored persistently in the project directory for further container launches. From 1b42a83b5fa0e4e2fcdf3edcf1daa37bdb951bf8 Mon Sep 17 00:00:00 2001 From: Bodo Hugo Barwich Date: Sat, 28 Nov 2020 12:50:26 +0000 Subject: [PATCH 12/18] cpanm installation at Build Time --- Dockerfile | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Dockerfile b/Dockerfile index e2891bd..fac0779 100644 --- a/Dockerfile +++ b/Dockerfile @@ -7,6 +7,12 @@ RUN apt-get update &&\ liburl-encode-perl libextutils-config-perl libextutils-helpers-perl libextutils-installpaths-perl\ libclone-choose-perl libhash-merge-perl libtest-deep-perl liburi-nested-perl\ libsql-abstract-perl liburi-db-perl libdbd-sqlite3-perl +RUN mkdir -p /usr/share/perldoc-browser/log +COPY cpanfile cpanfile-cpandoc /usr/share/perldoc-browser/ +RUN cd /usr/share/perldoc-browser/\ + && date +"%s" > log/cpanm_install_$(date +"%F").log\ + ; cpanm -vn --installdeps --with-feature=sqlite . 2>&1 >> log/cpanm_install_$(date +"%F").log\ + ; date +"%s" >> log/cpanm_install_$(date +"%F").log COPY etc/docker/entrypoint.sh /usr/local/bin/ RUN chmod a+x /usr/local/bin/entrypoint.sh\ && ln -s /usr/local/bin/entrypoint.sh /entrypoint.sh # backwards compat From 2683b9fffea224dc79709fbecf15f2cee4fa4590 Mon Sep 17 00:00:00 2001 From: Bodo Hugo Barwich Date: Sat, 28 Nov 2020 16:56:01 +0000 Subject: [PATCH 13/18] Check Dependencies for cpanfile Features --- etc/docker/entrypoint.sh | 125 +++++++++++++++++++++++++++++++++++++-- 1 file changed, 121 insertions(+), 4 deletions(-) diff --git a/etc/docker/entrypoint.sh b/etc/docker/entrypoint.sh index 4816950..ee478aa 100644 --- a/etc/docker/entrypoint.sh +++ b/etc/docker/entrypoint.sh @@ -16,6 +16,10 @@ echo `cat -A /etc/hosts` if [ "$1" = "perldoc-browser.pl" ]; then + sfeatures="" + sfeatoptions="" + icpanm=0 + echo "Command: '$@'" echo "Configuring Local Installation ..." @@ -37,7 +41,10 @@ if [ "$1" = "perldoc-browser.pl" ]; then echo "$mojolicious [Code: '$iresult']" else echo "NONE [Code: '$iresult']" - fi + + #Trigger cpanm Installation + icpanm=1 + fi #if [ -n "$mojolicious" ]; then echo -n "Search Backend: " @@ -54,17 +61,127 @@ if [ "$1" = "perldoc-browser.pl" ]; then echo "$backend" fi #if [ -z "$backend" ]; then - if [ -z "$mojolicious" ]; then + if [ -n "$backend" ]; then + sfeatures="${sfeatures}${backend}" + fi + + case "$backend" in + sqlite) + #Checking Dependencies for SQLite Backend + + echo -n "Mojo::SQLite Version: " + + perl -MMojo::SQLite -e 'print $Mojo::SQLite::VERSION; ' 2>/dev/null 1>log/mojo_sqlite.log ||\ + iresult=$? + + if [ -z "$iresult" ]; then + iresult=0 + fi + + iversion=`cat log/mojo_sqlite.log` + + if [ -n "$iversion" ]; then + echo "$iversion [Code: '$iresult']" + else + echo "NONE [Code: '$iresult']" + + #Trigger cpanm Installation + icpanm=1 + fi #if [ -n "$iversion" ]; then + ;; + + pg) + #Checking Dependencies for PostgreSQL Backend + + echo -n "Mojo::Pg Version: " + + perl -MMojo::Pg -e 'print $Mojo::Pg::VERSION; ' 2>/dev/null 1>log/mojo_postgres.log ||\ + iresult=$? + + if [ -z "$iresult" ]; then + iresult=0 + fi + + iversion=`cat log/mojo_postgres.log` + + if [ -n "$iversion" ]; then + echo "$iversion [Code: '$iresult']" + else + echo "NONE [Code: '$iresult']" + + #Trigger cpanm Installation + icpanm=1 + fi #if [ -n "$iversion" ]; then + ;; + + es) + #Checking Dependencies for Elasticsearch Backend + + echo -n "Search::Elasticsearch Version: " + + perl -MSearch::Elasticsearch -e 'print $Search::Elasticsearch::VERSION; ' 2>/dev/null 1>log/perl_elasticsearch.log ||\ + iresult=$? + + if [ -z "$iresult" ]; then + iresult=0 + fi + + iversion=`cat log/perl_elasticsearch.log` + + if [ -n "$iversion" ]; then + echo "$iversion [Code: '$iresult']" + else + echo "NONE [Code: '$iresult']" + + #Trigger cpanm Installation + icpanm=1 + fi #if [ -n "$iversion" ]; then + ;; + + esac #case "$backend" in + + if [ "$2" = "install" ]; then + #Checking Dependencies for Perl Versions Installation + + #Enabling cpanm Feature + sfeatures="$sfeatures install" + + echo -n "Perl::Build Version: " + + perl -MPerl::Build -e 'print $Perl::Build::VERSION; ' 2>/dev/null 1>log/perl_build.log ||\ + iresult=$? + + if [ -z "$iresult" ]; then + iresult=0 + fi + + iversion=`cat log/perl_build.log` + + if [ -n "$iversion" ]; then + echo "$iversion [Code: '$iresult']" + else + echo "NONE [Code: '$iresult']" + + #Trigger cpanm Installation + icpanm=1 + fi #if [ -n "$iversion" ]; then + fi #if [ "$1" = "install" ]; then + + if [ $icpanm -eq 1 ]; then #Run cpanm Installation echo "Installing Dependencies with cpanm ..." + for feat in "$sfeatures"; do + sfeatoptions+=" --with-feature=$feat" + done + date +"%s" > log/cpanm_install_$(date +"%F").log - cpanm -vn --installdeps --with-feature=$backend . 2>&1 >> log/cpanm_install_$(date +"%F").log + cpanm -vn --installdeps$sfeatoptions . 2>&1 >> log/cpanm_install_$(date +"%F").log cpanmrs=$? date +"%s" >> log/cpanm_install_$(date +"%F").log echo "Installation finished with [$cpanmrs]" - fi #if [ -z "$mojolicious" ]; then + fi #if [ $icpanm -eq 1 ]; then echo "Service '$1': Launching ..." From 173c1c59067e8850903b600698a56e0f48c4e5f8 Mon Sep 17 00:00:00 2001 From: Bodo Hugo Barwich Date: Sat, 28 Nov 2020 17:31:15 +0000 Subject: [PATCH 14/18] README formats --- etc/docker/README | 81 +++++++++++++++++++++++++++++++++++++++++ etc/docker/README.md | 85 +++++++++++++++++++++++++++++++++++++++++++ etc/docker/README.pod | 28 ++++++++++++-- 3 files changed, 191 insertions(+), 3 deletions(-) create mode 100644 etc/docker/README create mode 100644 etc/docker/README.md diff --git a/etc/docker/README b/etc/docker/README new file mode 100644 index 0000000..541f681 --- /dev/null +++ b/etc/docker/README @@ -0,0 +1,81 @@ +NAME + Perldoc Browser - Docker Deployment + +DESCRIPTION + The Objective of the "Docker Deployment" is to be able to run the + "perldoc-browser.pl" Command in a seperate Docker Container. It can be + useful to run "Test::Mojo" Test Suites. + +REQUIREMENTS + To build and run the Docker Container the Minimum Requirement is to have + the "Docker" Service installed. Additionally the "docker-compose" + Command can provide a nice enhancement to ease the Operation of the + Docker Container. + +INSTALLATION + docker-compose + To run the Docker Container with the "docker-compose" Command the + "docker-compose" Package should be installed first. The + "docker-compose" Package is provided by most Linux Distributions. + + Docker Engine + Next the "Docker" Service is installed locally. if you want to use + "docker-compose" it is recommended to do this step first because the + "docker-compose" installation can break your Docker Engine + installation. To install the Docker Engine it is recommended to + follow the guides of the Official Documentation Docker Engine + Installation + +IMAGE BUILD + preconditions + * The Docker Service must be running * Build User must have access + to the Docker Service (perhaps "root" access is required) * Current + Working Directory must be the Project Root Directory * The + "docker-compose" Build requires a "docker-compose.yml" file which + can be created from the "docker-compose.yml.example" file + + Build with Docker + The Container Image for the "Mojolicious" Web Service was called + "*perldoc_web*" to difference it from the Backend Container Image. + So the command to build the docker image is: + + docker build -t perldoc_web . + + Build with "docker-compose" + To build the Container Image with "docker-compose" a + "docker-compose.yml" file is required. It can be created from the + "docker-compose.yml.example" file by copying it. Within the + "docker-compose.yml" file the entry "services.web.volumes" must be + configured to contain the absolute path to the Project Root + Directory on the system. The "docker-compose.yml" file contains + instructions to expose the "Mojolicious" Web Service on Port 3000 + which seems to be the default behaviour for the Application. If the + Application was configured to listen on a different port the file + entry "services.web.ports" must be adjusted accordingly. So the + command to build the docker image and launch it is: + + docker-compose up --build + +IMAGE INITIALISATION + "cpanm" Installation + As discussed in the task issue Docker Deployment Issue + the + installation of the *Perl* Modules for the SQLite Backend from the + "cpanfile" was executed at Image Build Time. So on updates of the + "cpanfile" it is recommendable to rebuild the Container Image as + described above under IMAGE BUILD. Still the Start-Up Script will + detect a different backend configuration or the "perldoc-browser.pl + install" Command and check whether key dependencies are met and run + the "cpanm" Installation accordingly + + populating the search backend + The new built Container Image contains an empty "perldoc-browser.pl" + Installation To run correctly the Search Backend needs to be + populated. So the command to populate the Search Backend is: + + docker run -it -v /absolute/path/to/project:/home/perldoc-browser:Z perldoc_web perldoc-browser.pl index all + + This will execute command "perldoc-browser.pl index all" in the + project directory. The results will be stored persistently in the + project directory for further container launches. + diff --git a/etc/docker/README.md b/etc/docker/README.md new file mode 100644 index 0000000..09307e7 --- /dev/null +++ b/etc/docker/README.md @@ -0,0 +1,85 @@ +# NAME + +Perldoc Browser - Docker Deployment + +# DESCRIPTION + +The Objective of the `Docker Deployment` is to be able to run the `perldoc-browser.pl` Command in +a seperate Docker Container. +It can be useful to run `Test::Mojo` Test Suites. + +# REQUIREMENTS + +To build and run the Docker Container the Minimum Requirement is to have the `Docker` Service installed. +Additionally the `docker-compose` Command can provide a nice enhancement to ease the Operation +of the Docker Container. + +# INSTALLATION + +- docker-compose + + To run the Docker Container with the `docker-compose` Command the `docker-compose` Package should + be installed first. The `docker-compose` Package is provided by most Linux Distributions. + +- Docker Engine + + Next the `Docker` Service is installed locally. + if you want to use `docker-compose` it is recommended to do this step first because + the `docker-compose` installation can break your Docker Engine installation. + To install the Docker Engine it is recommended to follow the guides of the Official Documentation + [Docker Engine Installation](https://docs.docker.com/engine/install/) + +# IMAGE BUILD + +- preconditions + + \* The Docker Service must be running + \* Build User must have access to the Docker Service (perhaps `root` access is required) + \* Current Working Directory must be the Project Root Directory + \* The `docker-compose` Build requires a `docker-compose.yml` file which can be created + from the `docker-compose.yml.example` file + +- Build with Docker + + The Container Image for the `Mojolicious` Web Service was called "_perldoc\_web_" to difference it + from the Backend Container Image. + So the command to build the docker image is: + + docker build -t perldoc_web . + +- Build with `docker-compose` + + To build the Container Image with `docker-compose` a `docker-compose.yml` file is required. + It can be created from the `docker-compose.yml.example` file by copying it. + Within the `docker-compose.yml` file the entry `services.web.volumes` must be configured to + contain the absolute path to the Project Root Directory on the system. + The `docker-compose.yml` file contains instructions to expose the `Mojolicious` Web Service + on Port `3000` which seems to be the default behaviour for the Application. + If the Application was configured to listen on a different port the file entry `services.web.ports` + must be adjusted accordingly. + So the command to build the docker image and launch it is: + + docker-compose up --build + +# IMAGE INITIALISATION + +- `cpanm` Installation + + As discussed in the task issue [Docker Deployment Issue](https://github.com/Grinnz/perldoc-browser/issues/26) the + installation of the _Perl_ Modules for the SQLite Backend from the `cpanfile` was executed at Image Build Time. + So on updates of the `cpanfile` it is recommendable to rebuild the Container Image as described above + under **IMAGE BUILD**. + Still the Start-Up Script will detect a different backend configuration or the + `perldoc-browser.pl install` Command and check whether key dependencies are met and run the + `cpanm` Installation accordingly + +- populating the search backend + + The new built Container Image contains an empty `perldoc-browser.pl` Installation + To run correctly the Search Backend needs to be populated. + So the command to populate the Search Backend is: + + docker run -it -v /absolute/path/to/project:/home/perldoc-browser:Z perldoc_web perldoc-browser.pl index all + + This will execute command `perldoc-browser.pl index all` in the project directory. + The results will be stored persistently in the project directory for further container launches. diff --git a/etc/docker/README.pod b/etc/docker/README.pod index e555bc4..c8a6a1f 100644 --- a/etc/docker/README.pod +++ b/etc/docker/README.pod @@ -16,6 +16,8 @@ of the Docker Container. =head1 INSTALLATION +=over + =item docker-compose To run the Docker Container with the C Command the C Package should @@ -29,8 +31,12 @@ the C installation can break your Docker Engine installation. To install the Docker Engine it is recommended to follow the guides of the Official Documentation L +=back + =head1 IMAGE BUILD +=over + =item preconditions * The Docker Service must be running @@ -61,10 +67,26 @@ So the command to build the docker image and launch it is: docker-compose up --build +=back + =head1 IMAGE INITIALISATION +=over + +=item C Installation + +As discussed in the task issue L the +installation of the I Modules for the SQLite Backend from the C was executed at Image Build Time. +So on updates of the C it is recommendable to rebuild the Container Image as described above +under B. +Still the Start-Up Script will detect a different backend configuration or the +C Command and check whether key dependencies are met and run the +C Installation accordingly + +=item populating the search backend + The new built Container Image contains an empty C Installation -To run correctly the Search Backend need to be populated. +To run correctly the Search Backend needs to be populated. So the command to populate the Search Backend is: docker run -it -v /absolute/path/to/project:/home/perldoc-browser:Z perldoc_web perldoc-browser.pl index all @@ -72,6 +94,6 @@ So the command to populate the Search Backend is: This will execute command C in the project directory. The results will be stored persistently in the project directory for further container launches. +=back - - +=cut From e2400d4f09e464344e02f92d9c4b7a793b0e0057 Mon Sep 17 00:00:00 2001 From: Bodo Hugo Barwich Date: Sat, 28 Nov 2020 22:05:41 +0000 Subject: [PATCH 15/18] correct unsopported bash operator --- etc/docker/entrypoint.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/etc/docker/entrypoint.sh b/etc/docker/entrypoint.sh index ee478aa..b679a69 100644 --- a/etc/docker/entrypoint.sh +++ b/etc/docker/entrypoint.sh @@ -172,7 +172,7 @@ if [ "$1" = "perldoc-browser.pl" ]; then echo "Installing Dependencies with cpanm ..." for feat in "$sfeatures"; do - sfeatoptions+=" --with-feature=$feat" + sfeatoptions="$sfeatoptions --with-feature=$feat" done date +"%s" > log/cpanm_install_$(date +"%F").log From e4e59054b1e45b1ea34ee3cb81f8102ab188b6ed Mon Sep 17 00:00:00 2001 From: Bodo Hugo Barwich Date: Sat, 28 Nov 2020 22:48:36 +0000 Subject: [PATCH 16/18] cpanm installation log location --- etc/docker/README | 59 ++++++++++++++++++++++++++++--------------- etc/docker/README.md | 24 ++++++++++++------ etc/docker/README.pod | 45 +++++++++++++++++++++++---------- 3 files changed, 85 insertions(+), 43 deletions(-) diff --git a/etc/docker/README b/etc/docker/README index 541f681..94dc3b8 100644 --- a/etc/docker/README +++ b/etc/docker/README @@ -19,20 +19,25 @@ INSTALLATION "docker-compose" Package is provided by most Linux Distributions. Docker Engine - Next the "Docker" Service is installed locally. if you want to use - "docker-compose" it is recommended to do this step first because the - "docker-compose" installation can break your Docker Engine - installation. To install the Docker Engine it is recommended to - follow the guides of the Official Documentation Docker Engine + Next the "Docker" Service has to be installed locally. if you want + to use "docker-compose" it is recommended to do this step first + because the "docker-compose" installation can break your Docker + Engine installation. To install the Docker Engine it is recommended + to follow the guides of the Official Documentation Docker Engine Installation IMAGE BUILD - preconditions - * The Docker Service must be running * Build User must have access - to the Docker Service (perhaps "root" access is required) * Current - Working Directory must be the Project Root Directory * The - "docker-compose" Build requires a "docker-compose.yml" file which - can be created from the "docker-compose.yml.example" file + Preconditions + + * The Docker Service must be running + + * Build User must have access to the Docker Service (perhaps "root" + access is required) + + * Current Working Directory must be the Project Root Directory + + * The "docker-compose" Build requires a docker-compose.yml file + which can be created from the docker-compose.yml.example file Build with Docker The Container Image for the "Mojolicious" Web Service was called @@ -43,11 +48,11 @@ IMAGE BUILD Build with "docker-compose" To build the Container Image with "docker-compose" a - "docker-compose.yml" file is required. It can be created from the - "docker-compose.yml.example" file by copying it. Within the - "docker-compose.yml" file the entry "services.web.volumes" must be + docker-compose.yml file is required. It can be created from the + docker-compose.yml.example file by copying it. Within the + docker-compose.yml file the entry "services.web.volumes" must be configured to contain the absolute path to the Project Root - Directory on the system. The "docker-compose.yml" file contains + Directory on the system. The docker-compose.yml file contains instructions to expose the "Mojolicious" Web Service on Port 3000 which seems to be the default behaviour for the Application. If the Application was configured to listen on a different port the file @@ -61,12 +66,24 @@ IMAGE INITIALISATION As discussed in the task issue Docker Deployment Issue the installation of the *Perl* Modules for the SQLite Backend from the - "cpanfile" was executed at Image Build Time. So on updates of the - "cpanfile" it is recommendable to rebuild the Container Image as - described above under IMAGE BUILD. Still the Start-Up Script will - detect a different backend configuration or the "perldoc-browser.pl - install" Command and check whether key dependencies are met and run - the "cpanm" Installation accordingly + cpanfile was executed at Image Build Time. So on updates of the + cpanfile it is recommendable to rebuild the Container Image as + described above under IMAGE BUILD. + + The used cpanfile can be found in /usr/share/perldoc-browser/ within + the Docker Image. Also the "cpanm" Installation Log is found inside + the Image in /usr/share/perldoc-browser/log/. + + To inspect the Docker Image run the command: + + docker run -it -v /absolute/path/to/project:/home/perldoc-browser:Z perldoc_web bash + + This will give a "bash" shell and the file system can be inspected. + + Still the Start-Up Script will detect a different backend + configuration or the "perldoc-browser.pl install" Command and check + whether key dependencies are met and run the "cpanm" Installation + accordingly populating the search backend The new built Container Image contains an empty "perldoc-browser.pl" diff --git a/etc/docker/README.md b/etc/docker/README.md index 09307e7..1aee33c 100644 --- a/etc/docker/README.md +++ b/etc/docker/README.md @@ -23,7 +23,7 @@ of the Docker Container. - Docker Engine - Next the `Docker` Service is installed locally. + Next the `Docker` Service has to be installed locally. if you want to use `docker-compose` it is recommended to do this step first because the `docker-compose` installation can break your Docker Engine installation. To install the Docker Engine it is recommended to follow the guides of the Official Documentation @@ -31,14 +31,12 @@ of the Docker Container. # IMAGE BUILD -- preconditions - - \* The Docker Service must be running - \* Build User must have access to the Docker Service (perhaps `root` access is required) - \* Current Working Directory must be the Project Root Directory - \* The `docker-compose` Build requires a `docker-compose.yml` file which can be created +- Preconditions + - The Docker Service must be running + - Build User must have access to the Docker Service (perhaps `root` access is required) + - Current Working Directory must be the Project Root Directory + - The `docker-compose` Build requires a `docker-compose.yml` file which can be created from the `docker-compose.yml.example` file - - Build with Docker The Container Image for the `Mojolicious` Web Service was called "_perldoc\_web_" to difference it @@ -69,6 +67,16 @@ of the Docker Container. installation of the _Perl_ Modules for the SQLite Backend from the `cpanfile` was executed at Image Build Time. So on updates of the `cpanfile` it is recommendable to rebuild the Container Image as described above under **IMAGE BUILD**. + + The used `cpanfile` can be found in `/usr/share/perldoc-browser/` within the Docker Image. + Also the `cpanm` Installation Log is found inside the Image in `/usr/share/perldoc-browser/log/`. + + To inspect the Docker Image run the command: + + docker run -it -v /absolute/path/to/project:/home/perldoc-browser:Z perldoc_web bash + + This will give a `bash` shell and the file system can be inspected. + Still the Start-Up Script will detect a different backend configuration or the `perldoc-browser.pl install` Command and check whether key dependencies are met and run the `cpanm` Installation accordingly diff --git a/etc/docker/README.pod b/etc/docker/README.pod index c8a6a1f..909798c 100644 --- a/etc/docker/README.pod +++ b/etc/docker/README.pod @@ -25,7 +25,7 @@ be installed first. The C Package is provided by most Linux Dist =item Docker Engine -Next the C Service is installed locally. +Next the C Service has to be installed locally. if you want to use C it is recommended to do this step first because the C installation can break your Docker Engine installation. To install the Docker Engine it is recommended to follow the guides of the Official Documentation @@ -35,15 +35,22 @@ L =head1 IMAGE BUILD -=over +=over 4 + +=item Preconditions + +=over 2 + +=item * The Docker Service must be running + +=item * Build User must have access to the Docker Service (perhaps C access is required) + +=item * Current Working Directory must be the Project Root Directory -=item preconditions +=item * The C Build requires a F file which can be created + from the F file -* The Docker Service must be running -* Build User must have access to the Docker Service (perhaps C access is required) -* Current Working Directory must be the Project Root Directory -* The C Build requires a C file which can be created - from the C file +=back =item Build with Docker @@ -55,11 +62,11 @@ So the command to build the docker image is: =item Build with C -To build the Container Image with C a C file is required. -It can be created from the C file by copying it. -Within the C file the entry C must be configured to +To build the Container Image with C a F file is required. +It can be created from the F file by copying it. +Within the F file the entry C must be configured to contain the absolute path to the Project Root Directory on the system. -The C file contains instructions to expose the C Web Service +The F file contains instructions to expose the C Web Service on Port C<3000> which seems to be the default behaviour for the Application. If the Application was configured to listen on a different port the file entry C must be adjusted accordingly. @@ -76,9 +83,19 @@ So the command to build the docker image and launch it is: =item C Installation As discussed in the task issue L the -installation of the I Modules for the SQLite Backend from the C was executed at Image Build Time. -So on updates of the C it is recommendable to rebuild the Container Image as described above +installation of the I Modules for the SQLite Backend from the F was executed at Image Build Time. +So on updates of the F it is recommendable to rebuild the Container Image as described above under B. + +The used F can be found in F within the Docker Image. +Also the C Installation Log is found inside the Image in F. + +To inspect the Docker Image run the command: + + docker run -it -v /absolute/path/to/project:/home/perldoc-browser:Z perldoc_web bash + +This will give a C shell and the file system can be inspected. + Still the Start-Up Script will detect a different backend configuration or the C Command and check whether key dependencies are met and run the C Installation accordingly From 8a42b07eb952455e5dbfd965f8c20489c39b9902 Mon Sep 17 00:00:00 2001 From: Bodo Hugo Barwich Date: Tue, 13 Apr 2021 20:49:43 +0100 Subject: [PATCH 17/18] removing the .gitignore file from the exclude list --- .gitignore | 1 - 1 file changed, 1 deletion(-) diff --git a/.gitignore b/.gitignore index a835271..377c213 100644 --- a/.gitignore +++ b/.gitignore @@ -8,7 +8,6 @@ perldoc-browser.sqlite* hypnotoad.pid #Project Files -.gitignore .project #Container Runtime Content From 01bee0cb9995b50c8ea8aa0ff70807ac4d716497 Mon Sep 17 00:00:00 2001 From: Bodo Hugo Barwich Date: Tue, 13 Apr 2021 22:42:19 +0100 Subject: [PATCH 18/18] removing rendered README files --- etc/docker/README | 98 -------------------------------------------- etc/docker/README.md | 93 ----------------------------------------- 2 files changed, 191 deletions(-) delete mode 100644 etc/docker/README delete mode 100644 etc/docker/README.md diff --git a/etc/docker/README b/etc/docker/README deleted file mode 100644 index 94dc3b8..0000000 --- a/etc/docker/README +++ /dev/null @@ -1,98 +0,0 @@ -NAME - Perldoc Browser - Docker Deployment - -DESCRIPTION - The Objective of the "Docker Deployment" is to be able to run the - "perldoc-browser.pl" Command in a seperate Docker Container. It can be - useful to run "Test::Mojo" Test Suites. - -REQUIREMENTS - To build and run the Docker Container the Minimum Requirement is to have - the "Docker" Service installed. Additionally the "docker-compose" - Command can provide a nice enhancement to ease the Operation of the - Docker Container. - -INSTALLATION - docker-compose - To run the Docker Container with the "docker-compose" Command the - "docker-compose" Package should be installed first. The - "docker-compose" Package is provided by most Linux Distributions. - - Docker Engine - Next the "Docker" Service has to be installed locally. if you want - to use "docker-compose" it is recommended to do this step first - because the "docker-compose" installation can break your Docker - Engine installation. To install the Docker Engine it is recommended - to follow the guides of the Official Documentation Docker Engine - Installation - -IMAGE BUILD - Preconditions - - * The Docker Service must be running - - * Build User must have access to the Docker Service (perhaps "root" - access is required) - - * Current Working Directory must be the Project Root Directory - - * The "docker-compose" Build requires a docker-compose.yml file - which can be created from the docker-compose.yml.example file - - Build with Docker - The Container Image for the "Mojolicious" Web Service was called - "*perldoc_web*" to difference it from the Backend Container Image. - So the command to build the docker image is: - - docker build -t perldoc_web . - - Build with "docker-compose" - To build the Container Image with "docker-compose" a - docker-compose.yml file is required. It can be created from the - docker-compose.yml.example file by copying it. Within the - docker-compose.yml file the entry "services.web.volumes" must be - configured to contain the absolute path to the Project Root - Directory on the system. The docker-compose.yml file contains - instructions to expose the "Mojolicious" Web Service on Port 3000 - which seems to be the default behaviour for the Application. If the - Application was configured to listen on a different port the file - entry "services.web.ports" must be adjusted accordingly. So the - command to build the docker image and launch it is: - - docker-compose up --build - -IMAGE INITIALISATION - "cpanm" Installation - As discussed in the task issue Docker Deployment Issue - the - installation of the *Perl* Modules for the SQLite Backend from the - cpanfile was executed at Image Build Time. So on updates of the - cpanfile it is recommendable to rebuild the Container Image as - described above under IMAGE BUILD. - - The used cpanfile can be found in /usr/share/perldoc-browser/ within - the Docker Image. Also the "cpanm" Installation Log is found inside - the Image in /usr/share/perldoc-browser/log/. - - To inspect the Docker Image run the command: - - docker run -it -v /absolute/path/to/project:/home/perldoc-browser:Z perldoc_web bash - - This will give a "bash" shell and the file system can be inspected. - - Still the Start-Up Script will detect a different backend - configuration or the "perldoc-browser.pl install" Command and check - whether key dependencies are met and run the "cpanm" Installation - accordingly - - populating the search backend - The new built Container Image contains an empty "perldoc-browser.pl" - Installation To run correctly the Search Backend needs to be - populated. So the command to populate the Search Backend is: - - docker run -it -v /absolute/path/to/project:/home/perldoc-browser:Z perldoc_web perldoc-browser.pl index all - - This will execute command "perldoc-browser.pl index all" in the - project directory. The results will be stored persistently in the - project directory for further container launches. - diff --git a/etc/docker/README.md b/etc/docker/README.md deleted file mode 100644 index 1aee33c..0000000 --- a/etc/docker/README.md +++ /dev/null @@ -1,93 +0,0 @@ -# NAME - -Perldoc Browser - Docker Deployment - -# DESCRIPTION - -The Objective of the `Docker Deployment` is to be able to run the `perldoc-browser.pl` Command in -a seperate Docker Container. -It can be useful to run `Test::Mojo` Test Suites. - -# REQUIREMENTS - -To build and run the Docker Container the Minimum Requirement is to have the `Docker` Service installed. -Additionally the `docker-compose` Command can provide a nice enhancement to ease the Operation -of the Docker Container. - -# INSTALLATION - -- docker-compose - - To run the Docker Container with the `docker-compose` Command the `docker-compose` Package should - be installed first. The `docker-compose` Package is provided by most Linux Distributions. - -- Docker Engine - - Next the `Docker` Service has to be installed locally. - if you want to use `docker-compose` it is recommended to do this step first because - the `docker-compose` installation can break your Docker Engine installation. - To install the Docker Engine it is recommended to follow the guides of the Official Documentation - [Docker Engine Installation](https://docs.docker.com/engine/install/) - -# IMAGE BUILD - -- Preconditions - - The Docker Service must be running - - Build User must have access to the Docker Service (perhaps `root` access is required) - - Current Working Directory must be the Project Root Directory - - The `docker-compose` Build requires a `docker-compose.yml` file which can be created - from the `docker-compose.yml.example` file -- Build with Docker - - The Container Image for the `Mojolicious` Web Service was called "_perldoc\_web_" to difference it - from the Backend Container Image. - So the command to build the docker image is: - - docker build -t perldoc_web . - -- Build with `docker-compose` - - To build the Container Image with `docker-compose` a `docker-compose.yml` file is required. - It can be created from the `docker-compose.yml.example` file by copying it. - Within the `docker-compose.yml` file the entry `services.web.volumes` must be configured to - contain the absolute path to the Project Root Directory on the system. - The `docker-compose.yml` file contains instructions to expose the `Mojolicious` Web Service - on Port `3000` which seems to be the default behaviour for the Application. - If the Application was configured to listen on a different port the file entry `services.web.ports` - must be adjusted accordingly. - So the command to build the docker image and launch it is: - - docker-compose up --build - -# IMAGE INITIALISATION - -- `cpanm` Installation - - As discussed in the task issue [Docker Deployment Issue](https://github.com/Grinnz/perldoc-browser/issues/26) the - installation of the _Perl_ Modules for the SQLite Backend from the `cpanfile` was executed at Image Build Time. - So on updates of the `cpanfile` it is recommendable to rebuild the Container Image as described above - under **IMAGE BUILD**. - - The used `cpanfile` can be found in `/usr/share/perldoc-browser/` within the Docker Image. - Also the `cpanm` Installation Log is found inside the Image in `/usr/share/perldoc-browser/log/`. - - To inspect the Docker Image run the command: - - docker run -it -v /absolute/path/to/project:/home/perldoc-browser:Z perldoc_web bash - - This will give a `bash` shell and the file system can be inspected. - - Still the Start-Up Script will detect a different backend configuration or the - `perldoc-browser.pl install` Command and check whether key dependencies are met and run the - `cpanm` Installation accordingly - -- populating the search backend - - The new built Container Image contains an empty `perldoc-browser.pl` Installation - To run correctly the Search Backend needs to be populated. - So the command to populate the Search Backend is: - - docker run -it -v /absolute/path/to/project:/home/perldoc-browser:Z perldoc_web perldoc-browser.pl index all - - This will execute command `perldoc-browser.pl index all` in the project directory. - The results will be stored persistently in the project directory for further container launches.