juanluisbaptiste / docker-otrs

The unofficial Znuny/OTRS Ticketing System docker image
https://www.juanbaptiste.tech/category/otrs
GNU Lesser General Public License v3.0
172 stars 101 forks source link

container takes a very long to start when having many articles #91

Closed rdxmb closed 4 years ago

rdxmb commented 4 years ago

We just migrated from a native otrs-instance to this docker image.

As we have been using otrs for some years, the instance has grown up ....

So it takes a very long time for container-start because the chown on startup: https://github.com/juanluisbaptiste/docker-otrs/blob/master/otrs/run.sh#L67

Just for this issue I ran it with chown

[root@app-0 otrs]# time chown -R otrs:apache .
real    9m30.022s
user    0m7.772s
sys     0m47.320s
[root@app-0 otrs]# pwd
/opt/otrs

Here is my suggestions for a solution: Make https://github.com/juanluisbaptiste/docker-otrs/blob/master/otrs/run.sh#L67 customizable , either within the Dockerfile or - even better - on runtime. See https://fossies.org/linux/otrs/bin/otrs.SetPermissions.pl - line 49 , for example.

Something like

OTRS_SET_PERMISSIONS=all
OTRS_SET_PERMISSIONS=none
OTRS_SET_PERMISSIONS=skip-article-dir

would be great. What do you think?

**Image and OTRS versions**
juanluisbaptiste/otrs:6.0.28
juanluisbaptiste commented 4 years ago

@rdxmb done, please test.

juanluisbaptiste commented 4 years ago

Values are, yes, no and skip-article-dir .

rdxmb commented 4 years ago

@rdxmb done, please test.

ok, give me some days, please

rdxmb commented 4 years ago

is this already in juanluisbaptiste/otrs:latest ?

# k -n otrs-staging logs app-0 | grep -i PERMISSION
OTRS_SET_PERMISSIONS=no
++ OTRS_SET_PERMISSIONS=no
OTRS_SET_PERMISSIONS=no
+ /opt/otrs/bin/otrs.SetPermissions.pl --otrs-user=otrs --web-group=apache /opt/otrs/
Setting permissions on /opt/otrs

Or can you push that to a separate tag ?

rdxmb commented 4 years ago
# k -n otrs-staging logs app-0 | grep -i PERMISSION
OTRS_SET_PERMISSIONS=skip-article-dir
++ OTRS_SET_PERMISSIONS=skip-article-dir
OTRS_SET_PERMISSIONS=skip-article-dir
+ /opt/otrs/bin/otrs.SetPermissions.pl --otrs-user=otrs --web-group=apache /opt/otrs/
Setting permissions on /opt/otrs
juanluisbaptiste commented 4 years ago

Yes:

grep PERMISSIONS *.sh
functions.sh:OTRS_SET_PERMISSIONS="${OTRS_SET_PERMISSIONS:-yes}"
run.sh:  # Only adjust permissions if OTRS_SET_PERMISSIONS == yes
run.sh:  if [ "${OTRS_SET_PERMISSIONS}" == "yes" ]; then
run.sh:  elif [ "${OTRS_SET_PERMISSIONS}" == "skip-article-dir" ]; then
run.sh:    # Adjust permissions but skip articles directory if OTRS_SET_PERMISSIONS == skip-article-dir
run.sh:    print_info "OTRS_SET_PERMISSIONS set to \e[${OTRS_ASCII_COLOR_RED}mno\e[0m, Skipping setting permissions"
rdxmb commented 4 years ago

oh, I have found what's the "problem" here:

Using OTRS_INSTALL=yes will ignore this and run
/opt/otrs/bin/otrs.SetPermissions.pl --otrs-user=otrs --web-group=apache /opt/otrs/

I have not found this in your run-script so it seems this is defined within the application.

With OTRS_INSTALL=no everything is working fine.

juanluisbaptiste commented 4 years ago

OTRS_INSTALL=yes is only uised if you want to run the OTRS installer, but its an option that I have not tested in many years, I even do not know if it works as expected and I'm planning on removing it as soon as I have some time. Please do not use it and use the default of no or restore if restoring a backup.

rdxmb commented 4 years ago

I see. I just wanted to ask what parameters are depending OTRS_INSTALL=yes or are affected from that. This is not clear in the README.

rdxmb commented 4 years ago

You could remove OTRS_INSTALL=yes in the README.md first and then in the code later ;)

juanluisbaptiste commented 4 years ago

You could remove OTRS_INSTALL=yes in the README.md first and then in the code later ;)

Is not that simple as if I do it then it could cause more confusion as to why OTRS_INSTALL=no isthe default and what works.

Maybe a note to OTRS_INSTALL=yes saying that it is an unsupported option these days would make more sense for now.

juanluisbaptiste commented 4 years ago

Maybe a note to OTRS_INSTALL=yes saying that it is an unsupported option these days would make more sense for now.

Done.