docker-library / docker-library/redmine

Set transaction isolation level in config/database.yml

Open
#324 2 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Shell
Stars
237
Forks
171
PR merge metrics
No merged PRs in 30d

Description

If you use MySQL and MariaDB with Redmine 5.1.1 or later, you need to set the transaction isolation level in config/database.yml.
For MySQL version 5.7.20 or older and MariaDB, the setting is tx_isolation instead of transaction_isolation.

https://www.redmine.org/projects/redmine/wiki/MySQL_configuration

So, It might be a good idea to edit docker-entrypoint.sh so that the transaction isolation level can be set in /config/database.yml.

The following is a temporary improvement in my environment.
Since I am using MariaDB, only "tx_isolation" is considered, but it should be possible to switch to "transaction_isolation".

diff --git a/5.1/bookworm/docker-entrypoint.sh b/5.1/bookworm/docker-entrypoint.sh
index ff3f94b..3390268 100755
--- a/5.1/bookworm/docker-entrypoint.sh
+++ b/5.1/bookworm/docker-entrypoint.sh
@@ -75,6 +75,7 @@ if [ -n "$isLikelyRedmine" ]; then
 			file_env 'REDMINE_DB_PASSWORD' "${MYSQL_ENV_MYSQL_PASSWORD:-${MYSQL_ENV_MYSQL_ROOT_PASSWORD:-}}"
 			file_env 'REDMINE_DB_DATABASE' "${MYSQL_ENV_MYSQL_DATABASE:-${MYSQL_ENV_MYSQL_USER:-redmine}}"
 			file_env 'REDMINE_DB_ENCODING' ''
+			file_env 'REDMINE_DB_TX_ISOLATION' 'READ-COMMITTED'
 		elif [ "$REDMINE_DB_POSTGRES" ]; then
 			adapter='postgresql'
 			host="$REDMINE_DB_POSTGRES"
@@ -129,6 +130,10 @@ if [ -n "$isLikelyRedmine" ]; then
 			[ -n "$val" ] || continue
 			echo "  $var: \"$val\"" >> config/database.yml
 		done
+		if [ "$REDMINE_DB_TX_ISOLATION" ]; then
+			echo "  variables:" >> config/database.yml
+			echo "    tx_isolation: \"$REDMINE_DB_TX_ISOLATION\"" >> config/database.yml
+		fi
 	fi
 
 	# install additional gems for Gemfile.local and plugins

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with 5.1/bookworm/docker-entrypoint.sh, especially the database environment handling and config/database.yml generation. Review the linked MySQL configuration guidance and the proposed REDMINE_DB_TX_ISOLATION behavior. Done means the entrypoint can represent the required isolation setting for the stated MySQL and MariaDB versions without breaking generated database configuration.

Written by the indexing model from the issue text.

Assessment

Tech stack
docker, mariadb, mysql, shell
Domain
databases, devops
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.