Updated to use NGINX

This commit is contained in:
Deon George 2019-03-30 10:54:00 +11:00
parent 436a92bc63
commit edc62ba200
4 changed files with 39 additions and 18 deletions

View File

@ -7,25 +7,22 @@ stages:
variables:
VERSION: latest
CACHETAG: build
DOCKER_REGISTRY: registry.leenooks.net
DOCKER_IMAGE: ${DOCKER_REGISTRY}/graytech/otrs
DOCKER_HOST: tcp://${DOCKER_REGISTRY}-leenooks-ci-docker:2375
DOCKER_HOST: tcp://docker:2375
services:
- ${DOCKER_REGISTRY}/leenooks/ci-docker:dind
- docker:dind
before_script:
- docker info
- docker version
- docker login -u gitlab-ci-token -p $CI_BUILD_TOKEN ${DOCKER_REGISTRY}
- echo "CI_PROJECT_PATH ${CI_PROJECT_PATH} CI_COMMIT_TAG ${CI_COMMIT_TAG} CI_COMMIT_REF_NAME ${CI_COMMIT_REF_NAME}"
- echo "$CI_JOB_TOKEN" | docker login -u "$CI_REGISTRY_USER" "$CI_REGISTRY" --password-stdin
test:
stage: test
script:
- cat /etc/hosts
- env|sort
- docker build -t ${DOCKER_IMAGE}:${VERSION} .
- docker build -t ${CI_REGISTRY_IMAGE}:${VERSION} .
- docker images
only:
- debug
@ -33,11 +30,13 @@ test:
build:
stage: build
script:
- docker pull ${DOCKER_IMAGE}:${CACHETAG}
- docker build --cache-from ${DOCKER_IMAGE}:${CACHETAG} -t ${DOCKER_IMAGE}:${VERSION} -t ${DOCKER_IMAGE}:${CACHETAG} .
- docker push ${DOCKER_IMAGE}:${VERSION}
- docker push ${DOCKER_IMAGE}:${CACHETAG}
- if [ -f init ]; then chmod 500 init; fi
- docker pull ${CI_REGISTRY_IMAGE}:${CACHETAG} || true
- docker build --cache-from ${CI_REGISTRY_IMAGE}:${CACHETAG} -t ${CI_REGISTRY_IMAGE}:${VERSION} -t ${CI_REGISTRY_IMAGE}:${CACHETAG} .
- docker push ${CI_REGISTRY_IMAGE}:${VERSION}
- docker push ${CI_REGISTRY_IMAGE}:${CACHETAG}
tags:
- docker
- x86_64
only:
- master

View File

@ -1,15 +1,19 @@
# NAME graytech/otrs
# VERSION 5.0.12
# VERSION 5.0.21
# 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
FROM registry.leenooks.net/leenooks/lamps:php70
FROM registry.leenooks.net/leenooks/base:7
RUN yum -y install \
"perl(Text::CSV_XS)" "perl(YAML::XS)" "perl(Crypt::Eksblowfish::Bcrypt)" "perl(Encode::HanExtra)" "perl(JSON::XS)" \
nginx perl-DBD-MySQL fcgiwrap \
http://ftp.otrs.org/pub/otrs/RPMS/rhel/7/otrs-5.0.21-02.noarch.rpm \
&& yum clean all && rm -rf /var/tmp/*
COPY firststart.sh /usr/local/sbin
COPY init /sbin
CMD [ "/sbin/init" ]

View File

@ -1,4 +0,0 @@
#!/bin/sh
su otrs -lc "bin/otrs.Console.pl Maint::Config::Rebuild; sleep 15; bin/otrs.Console.pl Admin::Package::ReinstallAll"
/usr/sbin/crond
/opt/otrs/bin/Cron.sh start otrs

22
init Executable file
View File

@ -0,0 +1,22 @@
#!/bin/sh
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" &
# Install OTRS Modules
su otrs -lc "bin/otrs.Console.pl Maint::Config::Rebuild; sleep 15; bin/otrs.Console.pl Admin::Package::ReinstallAll"
# Start cron and the OTRS Daemon
/usr/sbin/crond
/opt/otrs/bin/Cron.sh start otrs
# Finally start NGINX
exec /usr/sbin/nginx "-g daemon off;"