Skip to content

Docker: Allow using unix sockets instead of inet ports - #172

Open
lab-at-nohl wants to merge 3 commits into
tine-groupware:mainfrom
lab-at-nohl:docker-prefersockets
Open

Docker: Allow using unix sockets instead of inet ports#172
lab-at-nohl wants to merge 3 commits into
tine-groupware:mainfrom
lab-at-nohl:docker-prefersockets

Conversation

@lab-at-nohl

Copy link
Copy Markdown
Contributor

This PR keeps the existing docker configuration unchanged and treats HOST and PORT as default.

However, setting the env variable TINE20_PREFERSOCKETS=true allows 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 (like docker run -v src:dest ...):

  • /one/mysql.socket:/run/mysql.sock
  • /other/redis.socket:/run/redis.sock (applies for caching, session, action_queue)

In any case if TINE20_PREFERSOCKETS is set the internal communication between nginx and php-fpm will be based on sockets.

Several scripts/configs were adjusted.

TINE20_PREFERSOCKETS needs to be published on docker hub, along with an info regarding the manual mount.

@CLAassistant

CLAassistant commented Dec 15, 2025

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you all sign our Contributor License Agreement before we can accept your contribution.
1 out of 2 committers have signed the CLA.

✅ lab-at-nohl
❌ Johannes Nohl


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.

@lab-at-nohl

Copy link
Copy Markdown
Contributor Author

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.

@pschuele

pschuele commented Jan 14, 2026

Copy link
Copy Markdown
Contributor

hm, strange issue with the CLA ... I would say we just ignore that message.
I think, you used different email-addresses in the commits.

@byteplow byteplow left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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"))}}

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. check for equal "true", not is set. We use strings true and false, and do not want false to be evaluate as true.

  2. remove the (file.Exists "/run/mysql.sock") check.
    The config might be generated before the socket is available. It should include the socket config, if TINE20_PREFERSOCKETS is 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"

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants