From 08f6ba39f3f25b9e3f5e418754767d8aa1d7d0d8 Mon Sep 17 00:00:00 2001 From: hyung-hwan Date: Tue, 7 Sep 2021 09:36:56 +0000 Subject: [PATCH] modifying docker procedure for rocky8 --- codepot/docker/Dockerfile.rocky84 | 13 ++++++++++ codepot/docker/build-rocky84.sh | 42 ++++++------------------------- codepot/docker/build-ubnt2004.sh | 10 -------- codepot/docker/httpd-fg.sh | 24 +++++++++++++++--- codepot/src/config.php.in | 2 +- 5 files changed, 42 insertions(+), 49 deletions(-) diff --git a/codepot/docker/Dockerfile.rocky84 b/codepot/docker/Dockerfile.rocky84 index e8733a13..7f5bed3f 100644 --- a/codepot/docker/Dockerfile.rocky84 +++ b/codepot/docker/Dockerfile.rocky84 @@ -1,5 +1,18 @@ FROM rockylinux/rockylinux:latest + +## epel-release for mod_perl +RUN dnf install -y epel-release + +RUN dnf install -y \ + subversion subversion-perl \ + httpd php php-mysqli php-gd php-pdo \ + perl-Digest-SHA \ + perl-DBD-MySQL perl-DBD-SQLite perl-LDAP \ + mod_dav_svn mod_perl diffutils sqlite3 + +RUN dnf install -y php-devel subversion-devel perl-devel make + COPY build-rocky84.sh /tmp RUN /tmp/build-rocky84.sh && rm -rf /tmp/* diff --git a/codepot/docker/build-rocky84.sh b/codepot/docker/build-rocky84.sh index 1bff4527..314ab559 100755 --- a/codepot/docker/build-rocky84.sh +++ b/codepot/docker/build-rocky84.sh @@ -1,21 +1,5 @@ cd /tmp -## epel-release for mod_perl -dnf install -y epel-release - -dnf install -y \ - subversion subversion-perl \ - mariadb-server mariadb httpd \ - php php-mysqli php-gd \ - perl-Digest-SHA \ - perl-DBD-MySQL perl-DBD-SQLite perl-LDAP \ - mod_dav_svn mod_perl diffutils - -dnf install -y \ - php-devel subversion-devel perl-devel make - -dnf remove -y mariadb-gssapi-server mariadb-backup - svn co http://code.miflux.com/svn/codepot/trunk/codepot && \ touch -r * */* */*/* */*/*/* */*/*/*/* && \ cd codepot && \ @@ -30,27 +14,15 @@ cd codepot && \ --with-cachedir=/var/cache/codepot \ --with-phpextdir=`php-config --extension-dir` \ make && make install && \ -mkdir -p /var/lib/codepot/svnrepo /var/lib/codepot/files && \ -mkdir -p /var/cache/codepot /var/log/codepot && \ -chown -R apache:apache /var/lib/codepot /var/cache/codepot /var/log/codepot && \ -mysql_install_db --user=mysql --ldata=/var/lib/mysql && \ -(/usr/bin/mysqld_safe --datadir=/var/lib/mysql &) && sleep 5 && \ -mysql -e 'create database codepot' && \ -mysql -e 'source /etc/codepot/codepot.mysql' codepot && \ -mysql -e 'create user "codepot"@"localhost" identified by "codepot"' && \ -mysql -e 'grant all privileges on codepot.* to "codepot"@"localhost"' && \ -sed -ri -e 's|^database_hostname[[:space:]]*=[[:space:]]*""$|database_hostname = "localhost"|g' \ - -e 's|^database_username[[:space:]]*=[[:space:]]*""$|database_username = "codepot"|g' \ - -e 's|^database_password[[:space:]]*=[[:space:]]*""$|database_password = "codepot"|g' \ - -e 's|^database_name[[:space:]]*=[[:space:]]*""$|database_name = "codepot"|g' \ - -e 's|^database_driver[[:space:]]*=[[:space:]]*""$|database_driver = "mysqli"|g' /etc/codepot/codepot.ini && \ +install -m 0755 -D -t /usr/sbin docker/httpd-fg.sh && \ +cd ../.. && \ +rm -rf /var/lib/codepot/* && \ +sed -ri -e 's|^database_hostname[[:space:]]*=[[:space:]]*"localhost"$|database_hostname = "/var/lib/codepot/codepot.db"|g' \ + -e 's|^database_driver[[:space:]]*=[[:space:]]*""$|database_driver = "sqlite"|g' \ + -e 's|^database_use_pdo[[:space:]]*=[[:space:]]*"no"$|database_use_pdo = "yes"|g' /etc/codepot/codepot.ini && \ sed -ri -e 's|Digest::SHA1|Digest::SHA|g' /usr/sbin/codepot-user && \ sed -ri -e 's|Digest::SHA1|Digest::SHA|g' /etc/codepot/perl/Codepot/AccessHandler.pm && \ -mkdir -p /run/php-fpm && -install -m 0755 -D -t /usr/sbin docker/httpd-fg.sh && \ -cd .. && \ -cd .. && \ -\ +mkdir -p /run/php-fpm && \ cp -pf /etc/codepot/codepot.httpd /etc/httpd/conf.d/codepot.conf && \ echo "PerlSwitches -Mlib=/etc/codepot/perl" >> /etc/httpd/conf.d/perl.conf diff --git a/codepot/docker/build-ubnt2004.sh b/codepot/docker/build-ubnt2004.sh index 133abf24..738b143f 100755 --- a/codepot/docker/build-ubnt2004.sh +++ b/codepot/docker/build-ubnt2004.sh @@ -1,15 +1,5 @@ cd /tmp -#apt update && -#DEBIAN_FRONTEND=noninteractive apt install -y --no-install-recommends \ -# subversion apache2 \ -# php libapache2-mod-php php-gd php-sqlite3 \ -# libapache2-mod-perl2 libapache2-mod-svn \ -# libswitch-perl libconfig-simple-perl libdigest-sha-perl \ -# libdbd-sqlite3-perl libnet-ldap-perl libsvn-perl libmail-sendmail-perl \ -# sqlite3 php-dev libsvn-dev make vim - - svn co http://code.miflux.com/svn/codepot/trunk/codepot && \ cd codepot && \ ./configure \ diff --git a/codepot/docker/httpd-fg.sh b/codepot/docker/httpd-fg.sh index 8e90b364..97426c3a 100755 --- a/codepot/docker/httpd-fg.sh +++ b/codepot/docker/httpd-fg.sh @@ -37,8 +37,26 @@ for e in "${!APACHE_@}"; do fi done -# start the mysql service and run the httpd server in the foreground -/usr/bin/mysqld_safe --datadir='/var/lib/mysql' & + +[ ! -d /var/lib/codepot/attachments ] && mkdir -p /var/lib/codepot/attachments +[ ! -d /var/lib/codepot/files ] && mkdir -p /var/lib/codepot/files +[ ! -d /var/lib/codepot/issuefiles ] && mkdir -p /var/lib/codepot/issuefiles +[ ! -d /var/lib/codepot/svnrepo ] && mkdir -p /var/lib/codepot/svnrepo +[ ! -d /var/lib/codepot/usericons ] && mkdir -p /var/lib/codepot/usericons +[ ! -f /var/lib/codepot/codepot.db ] && sqlite3 -init /etc/codepot/codepot.sqlite /var/lib/codepot/codepot.db "" + +mkdir -p /var/cache/codepot /var/log/codepot +chown -R apache:apache /var/lib/codepot /var/cache/codepot /var/log/codepot + +[ ! -f /var/lib/codepot/codepot.ini ] && cp -pf /etc/codepot/codepot.ini /var/lib/codepot/codepot.ini + +#grep -F -q '' /etc/httpd/conf-enabled/codepot.conf || { +# cat <> /etc/httpd/conf-enabled/codepot.conf +# +# SetEnv CODEPOT_CONFIG_FILE /var/lib/codepot/codepot.ini +# +#EOF +#} + php-fpm -sleep 2 exec httpd -DFOREGROUND "$@" diff --git a/codepot/src/config.php.in b/codepot/src/config.php.in index 0aed68dc..334f5212 100644 --- a/codepot/src/config.php.in +++ b/codepot/src/config.php.in @@ -192,7 +192,7 @@ function load_ini ($file) } $codepot_ini_file = CODEPOT_CFG_DIR.'/codepot.ini'; -if (function_exists('apached_getenv')) +if (function_exists('apache_getenv')) { $tmp = apache_getenv('CODEPOT_CONFIG_FILE'); if ($tmp != '') $codepot_ini_file = $tmp;