Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions generators/docker/templates/docker/config/mysql/my.cnf
Original file line number Diff line number Diff line change
Expand Up @@ -44,14 +44,12 @@ innodb_data_file_path = ibdata1:10M:autoextend
innodb_buffer_pool_size = 16M
#innodb_additional_mem_pool_size = 2M
# Set .._log_file_size to 25 % of buffer pool size
innodb_log_file_size = 5M
innodb_log_buffer_size = 8M
innodb_flush_log_at_trx_commit = 1
innodb_lock_wait_timeout = 50

symbolic-links=0
innodb_buffer_pool_size=5M
innodb_log_buffer_size=256K
max_connections=20
key_buffer_size=8
thread_cache_size=0
Expand Down
2 changes: 1 addition & 1 deletion generators/server/resources/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ LABEL ALIAS=postgresql
FROM quay.io/keycloak/keycloak:26.4.2
LABEL ALIAS=keycloak

FROM mysql:9.2.0
FROM mysql:9.5.0

FROM mariadb:12.0.2

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -601,6 +601,9 @@ exports[`generator - sql gateway-jwt-mysql-reactive(false)-maven-enableTranslati
"src/test/java/tech/jhipster/repository/timezone/DateTimeWrapperRepository.java": {
"stateCleared": "modified",
},
"src/test/resources/conf/mysql/my.cnf": {
"stateCleared": "modified",
},
"src/test/resources/config/application-testdev.yml": {
"stateCleared": "modified",
},
Expand Down Expand Up @@ -804,6 +807,9 @@ exports[`generator - sql gateway-jwt-mysql-reactive(true)-gradle-enableTranslati
"src/test/java/com/mycompany/domain/AssertUtils.java": {
"stateCleared": "modified",
},
"src/test/resources/conf/mysql/my.cnf": {
"stateCleared": "modified",
},
"src/test/resources/config/application-testdev.yml": {
"stateCleared": "modified",
},
Expand Down Expand Up @@ -3181,6 +3187,9 @@ exports[`generator - sql gateway-oauth2-mysql-reactive(true)-gradle-enableTransl
"src/test/java/com/mycompany/domain/AuthorityTestSamples.java": {
"stateCleared": "modified",
},
"src/test/resources/conf/mysql/my.cnf": {
"stateCleared": "modified",
},
"src/test/resources/config/application-testdev.yml": {
"stateCleared": "modified",
},
Expand Down Expand Up @@ -4483,6 +4492,9 @@ exports[`generator - sql microservice-jwt-mysql-reactive(false)-maven-enableTran
"src/test/java/tech/jhipster/repository/timezone/DateTimeWrapperRepository.java": {
"stateCleared": "modified",
},
"src/test/resources/conf/mysql/my.cnf": {
"stateCleared": "modified",
},
"src/test/resources/config/application-testdev.yml": {
"stateCleared": "modified",
},
Expand Down Expand Up @@ -4719,6 +4731,9 @@ exports[`generator - sql microservice-jwt-mysql-reactive(true)-gradle-enableTran
"src/test/java/com/mycompany/domain/AssertUtils.java": {
"stateCleared": "modified",
},
"src/test/resources/conf/mysql/my.cnf": {
"stateCleared": "modified",
},
"src/test/resources/config/application-testdev.yml": {
"stateCleared": "modified",
},
Expand Down Expand Up @@ -6790,6 +6805,9 @@ exports[`generator - sql microservice-oauth2-mysql-reactive(true)-gradle-enableT
"src/test/java/com/mycompany/domain/AssertUtils.java": {
"stateCleared": "modified",
},
"src/test/resources/conf/mysql/my.cnf": {
"stateCleared": "modified",
},
"src/test/resources/config/application-testdev.yml": {
"stateCleared": "modified",
},
Expand Down Expand Up @@ -8567,6 +8585,9 @@ exports[`generator - sql monolith-jwt-mysql-reactive(false)-maven-enableTranslat
"src/test/java/tech/jhipster/repository/timezone/DateTimeWrapperRepository.java": {
"stateCleared": "modified",
},
"src/test/resources/conf/mysql/my.cnf": {
"stateCleared": "modified",
},
"src/test/resources/config/application-testdev.yml": {
"stateCleared": "modified",
},
Expand Down Expand Up @@ -8803,6 +8824,9 @@ exports[`generator - sql monolith-jwt-mysql-reactive(true)-gradle-enableTranslat
"src/test/java/com/mycompany/domain/AssertUtils.java": {
"stateCleared": "modified",
},
"src/test/resources/conf/mysql/my.cnf": {
"stateCleared": "modified",
},
"src/test/resources/config/application-testdev.yml": {
"stateCleared": "modified",
},
Expand Down Expand Up @@ -10904,6 +10928,9 @@ exports[`generator - sql monolith-oauth2-mysql-reactive(false)-maven-enableTrans
"src/test/java/tech/jhipster/repository/timezone/DateTimeWrapperRepository.java": {
"stateCleared": "modified",
},
"src/test/resources/conf/mysql/my.cnf": {
"stateCleared": "modified",
},
"src/test/resources/config/application-testdev.yml": {
"stateCleared": "modified",
},
Expand Down Expand Up @@ -11107,6 +11134,9 @@ exports[`generator - sql monolith-oauth2-mysql-reactive(true)-gradle-enableTrans
"src/test/java/com/mycompany/domain/AssertUtils.java": {
"stateCleared": "modified",
},
"src/test/resources/conf/mysql/my.cnf": {
"stateCleared": "modified",
},
"src/test/resources/config/application-testdev.yml": {
"stateCleared": "modified",
},
Expand Down Expand Up @@ -13391,6 +13421,9 @@ exports[`generator - sql monolith-session-mysql-reactive(false)-maven-enableTran
"src/test/java/tech/jhipster/repository/timezone/DateTimeWrapperRepository.java": {
"stateCleared": "modified",
},
"src/test/resources/conf/mysql/my.cnf": {
"stateCleared": "modified",
},
"src/test/resources/config/application-testdev.yml": {
"stateCleared": "modified",
},
Expand Down Expand Up @@ -13630,6 +13663,9 @@ exports[`generator - sql monolith-session-mysql-reactive(true)-gradle-enableTran
"src/test/java/com/mycompany/domain/AssertUtils.java": {
"stateCleared": "modified",
},
"src/test/resources/conf/mysql/my.cnf": {
"stateCleared": "modified",
},
"src/test/resources/config/application-testdev.yml": {
"stateCleared": "modified",
},
Expand Down
4 changes: 4 additions & 0 deletions generators/spring-data-relational/files.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,10 @@ export const mysqlFiles = asWriteFilesSection<Application>({
...javaTestPackageTemplatesBlock(),
templates: ['config/MysqlTestContainer.java'],
},
{
...javaTestResourceTemplatesBlock(),
templates: ['conf/mysql/my.cnf'],
},
],
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@ public class MysqlTestContainer implements SqlTestContainer {
.withDatabaseName("<%= baseName %>")
.withTmpFs(Collections.singletonMap("/testtmpfs", "rw"))
.withLogConsumer(new Slf4jLogConsumer(LOG))
.withReuse(true);
.withReuse(true)
.withConfigurationOverride("conf/mysql");
}
if (!mysqlContainer.isRunning()) {
mysqlContainer.start();
Expand Down
Copy link
Member

Choose a reason for hiding this comment

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

Testcontainer configuration file should be implemented in spring-data-relational generator.
This is a testcontainer configuration correct?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

my.cnf is a MySQL config file. We need to have the same in src/main/docker/config/mysql/my.cnf and in src/test/resources/conf/my.cnf

Copy link
Member

@mshima mshima Oct 27, 2025

Choose a reason for hiding this comment

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

Yes I understand, but this generator generates docker compose files only.
It’s not related to testcontainers.
JHipster Node/Dotnet will have src/test/resources files generated too.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ok I do that, thanks @mshima

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
# For advice on how to change settings please see
# http://dev.mysql.com/doc/refman/5.7/en/server-configuration-defaults.html
[mysqld]
user = mysql
datadir = /var/lib/mysql
port = 3306
#socket = /tmp/mysql.sock
skip-external-locking
key_buffer_size = 16K
max_allowed_packet = 1M
table_open_cache = 4
sort_buffer_size = 64K
read_buffer_size = 256K
read_rnd_buffer_size = 256K
net_buffer_length = 2K
skip-name-resolve

# Don't listen on a TCP/IP port at all. This can be a security enhancement,
# if all processes that need to connect to mysqld run on the same host.
# All interaction with mysqld must be made via Unix sockets or named pipes.
# Note that using this option without enabling named pipes on Windows
# (using the "enable-named-pipe" option) will render mysqld useless!
#
#skip-networking
#server-id = 1

# Uncomment the following if you want to log updates
#log-bin=mysql-bin

# binary logging format - mixed recommended
#binlog_format=mixed

# Causes updates to non-transactional engines using statement format to be
# written directly to binary log. Before using this option make sure that
# there are no dependencies between transactional and non-transactional
# tables such as in the statement INSERT INTO t_myisam SELECT * FROM
# t_innodb; otherwise, slaves may diverge from the master.
#binlog_direct_non_transactional_updates=TRUE

# Uncomment the following if you are using InnoDB tables
innodb_data_file_path = ibdata1:10M:autoextend
# You can set .._buffer_pool_size up to 50 - 80 %
# of RAM but beware of setting memory usage too high
innodb_buffer_pool_size = 16M
#innodb_additional_mem_pool_size = 2M
# Set .._log_file_size to 25 % of buffer pool size
innodb_redo_log_capacity = 64M
innodb_log_buffer_size = 8M
innodb_flush_log_at_trx_commit = 1
innodb_lock_wait_timeout = 50

symbolic-links=0
innodb_buffer_pool_size=5M
innodb_log_buffer_size=256K
max_connections=20
key_buffer_size=8
thread_cache_size=0
host_cache_size=0
innodb_ft_cache_size=1600000
innodb_ft_total_cache_size=32000000
#### These optimize the memory use of MySQL
#### http://www.tocker.ca/2014/03/10/configuring-mysql-to-use-minimal-memory.html

# per thread or per operation settings
#thread_stack=131072
sort_buffer_size=32K
read_buffer_size=8200
read_rnd_buffer_size=8200
max_heap_table_size=16K
tmp_table_size=1K
bulk_insert_buffer_size=0
join_buffer_size=128
net_buffer_length=1K
innodb_sort_buffer_size=64K

#settings that relate to the binary log (if enabled)
binlog_cache_size=4K
binlog_stmt_cache_size=4K

performance_schema = off
character-set-server = utf8mb4
Loading