From a005bb4f4ee73f31237eb4602e9606772d6fa226 Mon Sep 17 00:00:00 2001 From: Deon George Date: Mon, 24 Apr 2023 15:33:28 +1000 Subject: [PATCH] Updated to alpine, updated to ZnunyLTS 6.0.48 --- Dockerfile | 41 +++++++++++++++++++++++++---------------- init | 12 +++++++----- otrs.conf | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 80 insertions(+), 21 deletions(-) create mode 100644 otrs.conf diff --git a/Dockerfile b/Dockerfile index 82bb259..93c8bc5 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,23 +1,32 @@ -# NAME graytech/otrs -# VERSION 6.0.28 -# BUILD docker build -t="leenooks/otrs" . -# SETUP su otrs -s /bin/bash -c /opt/otrs/bin/otrs.RebuildConfig.pl -# START docker run ... -# ftp://ftp.otrs.org/pub/otrs/packages/FAQ-5.0.3.opm -# ftp://ftp.otrs.org/pub/otrs/packages/iPhoneHandle-4.0.2.opm +# NAME leenooks/otrs +# VERSION latest -FROM registry.leenooks.net/leenooks/base:7 +FROM alpine -RUN yum -y install https://harbottle.gitlab.io/epmel/7/x86_64/epmel-release.rpm \ - && yum clean all && rm -rf /var/tmp/* +# Change to http respositories, so they we can cache the install packages +RUN if [ -n ${HTTP_PROXY} ] ; then sed -ie s'/https/http/' /etc/apk/repositories; fi -RUN yum -y install \ - "perl(Text::CSV_XS)" "perl(YAML::XS)" "perl(Crypt::Eksblowfish::Bcrypt)" "perl(Encode::HanExtra)" "perl(JSON::XS)" "perl(Moo)" "perl(namespace::clean)"\ - "perl(Crypt::Random::Source)" "perl(Exporter::Tiny)" "perl(Math::Random::ISAAC)" "perl(Math::Random::Secure)" "perl(Module::Find)" "perl(Types::TypeTiny)" \ - nginx perl-DBD-MySQL fcgiwrap \ - http://ftp.otrs.org/pub/otrs/RPMS/rhel/7/otrs-6.0.28-01.noarch.rpm \ - && yum clean all && rm -rf /var/tmp/* +RUN apk add shadow && groupadd -g 48 apache && useradd -d /opt/otrs -g apache -c 'OTRS user' otrs +RUN apk add --no-cache nginx curl +RUN usermod nginx -G apache + +RUN apk add --no-cache perl perl-fcgi fcgiwrap +RUN apk add --no-cache perl-dbi perl-dbd-mysql perl-dbd-pg +RUN apk add --no-cache perl-archive-zip perl-crypt-eksblowfish perl-css-minifier-xs perl-date-format \ + perl-datetime perl-encode-hanextra perl-io-socket-ssl perl-javascript-minifier-xs perl-json-xs \ + perl-mail-imapclient perl-authen-sasl perl-authen-ntlm perl-moo perl-net-dns perl-ldap perl-package-stash-xs \ + perl-template-toolkit perl-text-csv_xs perl-yaml-xs perl-xml-libxml perl-xml-libxslt perl-xml-parser +#RUN apk add apache2-mod-perl --repository=http://dl-cdn.alpinelinux.org/alpine/edge/testing/ + +RUN cd /tmp/ && wget https://download.znuny.org/releases/znuny-6.0.48.tar.gz \ + && tar -C /opt -xzf /tmp/znuny-6.0.48.tar.gz && ln -s ./znuny-6.0.48 /opt/otrs \ + && rm /tmp/znuny-6.0.48.tar.gz \ + && mkdir /opt/otrs/Kernel/Files \ + && /opt/otrs/bin/otrs.CheckModules.pl \ + && /opt/otrs/bin/otrs.SetPermissions.pl + +COPY otrs.conf /etc/nginx/http.d/default.conf COPY init /sbin CMD [ "/sbin/init" ] diff --git a/init b/init index e38429f..4783ace 100755 --- a/init +++ b/init @@ -3,16 +3,18 @@ OTRS_SOCK_DIR=/var/run/otrs NGINX_USER=nginx -# Add nging to apache group, since otrs is group owned to apache -usermod nginx -G apache - # Make our CGI socker mkdir ${OTRS_SOCK_DIR} chown ${NGINX_USER} ${OTRS_SOCK_DIR} -su ${NGINX_USER} -s /bin/bash -c "/usr/sbin/fcgiwrap -fs unix:${OTRS_SOCK_DIR}/otrs.cgi.sock" & +su ${NGINX_USER} -s /bin/sh -c "/usr/bin/fcgiwrap -fs unix:${OTRS_SOCK_DIR}/otrs.cgi.sock" & + +ln -s /otrs/Config.pm /opt/otrs/Kernel/Config.pm +ln -s /otrs/Files/ZZZAAuto.pm /opt/otrs/Kernel/Files/ +ln -s /otrs/Files/ZZZACL.pm /opt/otrs/Kernel/Files/ +ln -s /otrs/Files/ZZZProcessManagement.pm /opt/otrs/Kernel/Files/ # Install OTRS Modules -su otrs -lc "bin/otrs.Console.pl Maint::Config::Rebuild; sleep 15; bin/otrs.Console.pl Admin::Package::ReinstallAll" +su otrs -lc "bin/otrs.Console.pl Maint::Config::Rebuild; bin/otrs.Console.pl Admin::Package::ReinstallAll" # Start cron and the OTRS Daemon /usr/sbin/crond diff --git a/otrs.conf b/otrs.conf new file mode 100644 index 0000000..fd1f13d --- /dev/null +++ b/otrs.conf @@ -0,0 +1,48 @@ +server { + listen 80; + listen [::]:80; + +# access_log /var/log/nginx/access.log; + client_max_body_size 10m; +# error_log /var/log/nginx/error.log; + fastcgi_buffers 16 16k; + fastcgi_buffer_size 16k; + index index.html; + root /opt/otrs/var/httpd/htdocs; + server_tokens off; + + location / { + return 301 /otrs/customer.pl; + } + + location /admin { + return 301 /otrs/index.pl; + } + + location /otrs-web { + gzip on; + alias /opt/otrs/var/httpd/htdocs; + } + + location ~ ^/otrs/(.*\.pl)(/.*)?$ { + fastcgi_pass unix:/var/run/otrs/otrs.cgi.sock; + fastcgi_index index.pl; + fastcgi_param SCRIPT_FILENAME /opt/otrs/bin/fcgi-bin/$1; + fastcgi_param QUERY_STRING $query_string; + fastcgi_param REQUEST_METHOD $request_method; + fastcgi_param CONTENT_TYPE $content_type; + fastcgi_param CONTENT_LENGTH $content_length; + fastcgi_param GATEWAY_INTERFACE CGI/1.1; + fastcgi_param SERVER_SOFTWARE nginx; + fastcgi_param SCRIPT_NAME $fastcgi_script_name; + fastcgi_param REQUEST_URI $request_uri; + fastcgi_param DOCUMENT_URI $document_uri; + fastcgi_param DOCUMENT_ROOT $document_root; + fastcgi_param SERVER_PROTOCOL $server_protocol; + fastcgi_param REMOTE_ADDR $remote_addr; + fastcgi_param REMOTE_PORT $remote_port; + fastcgi_param SERVER_ADDR $server_addr; + fastcgi_param SERVER_PORT $server_port; + fastcgi_param SERVER_NAME $server_name; + } +}