Docker: Allow using unix sockets instead of inet ports - #172
Conversation
|
Johannes Nohl seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account. You have signed the CLA already but the status is still pending? Let us recheck it. |
|
I have no clue why my email isn't linked to the commit? I did everything like the times before. As you know, I already signed the CLA. |
Missing S in ar
|
hm, strange issue with the CLA ... I would say we just ignore that message. |
byteplow
left a comment
There was a problem hiding this comment.
you need to modify /home/mmertens/workspace/gitlab.metaways.net/tine20/tine/etc/tine20/config.inc.php.mpl instead of ci/dockerimage/gomplate/templates/config.inc.php.tmpl. It gets copied to the correct location by the docker build.
| 'tmpdir' => '{{getenv "TINE20_TMPDIR" "/var/lib/tine20/tmp"}}', | ||
|
|
||
| 'database' => array( | ||
| {{if (and (ne (getenv "TINE20_PREFERSOCKETS" "") "") (file.Exists "/run/mysql.sock"))}} |
There was a problem hiding this comment.
-
check for equal "true", not is set. We use strings true and false, and do not want false to be evaluate as true.
-
remove the
(file.Exists "/run/mysql.sock")check.
The config might be generated before the socket is available. It should include the socket config, ifTINE20_PREFERSOCKETSis set.
| test "$TINE20_CACHING_BACKEND" = Redis && mandatory_vars="$mandatory_vars TINE20_CACHING_REDIS_HOST" | ||
| test "$TINE20_SESSION_BACKEND" = Redis && mandatory_vars="$mandatory_vars TINE20_SESSION_HOST" | ||
| if [ -n "$TINE20_PREFERSOCKETS" ]; then | ||
| mandatory_vars="TINE20_DATABASE_DBNAME TINE20_DATABASE_USERNAME TINE20_DATABASE_PASSWORD" |
There was a problem hiding this comment.
overwriting mandatory_vars, requires changes to be done in to places.
i would suggest this instead:
mandatory_vars="TINE20_DATABASE_DBNAME TINE20_DATABASE_USERNAME TINE20_DATABASE_PASSWORD"
if [ "$TINE20_PREFERSOCKETS" != "true" ]; then
mandatory_vars="$mandatory_vars TINE20_DATABASE_HOST"
test "$TINE20_CACHING_BACKEND" = Redis && mandatory_vars="$mandatory_vars TINE20_CACHING_REDIS_HOST"
test "$TINE20_SESSION_BACKEND" = Redis && mandatory_vars="$mandatory_vars TINE20_SESSION_HOST"
fi
This PR keeps the existing docker configuration unchanged and treats HOST and PORT as default.
However, setting the env variable
TINE20_PREFERSOCKETS=trueallows to use unix sockets. These are files and are only used if they indeed exist inside the container. Thus, sockets need to be mounted from host in (likedocker run -v src:dest ...):In any case if
TINE20_PREFERSOCKETSis set the internal communication between nginx and php-fpm will be based on sockets.Several scripts/configs were adjusted.
TINE20_PREFERSOCKETSneeds to be published on docker hub, along with an info regarding the manual mount.