-
Notifications
You must be signed in to change notification settings - Fork 174
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Environment set REDMINE_DB_PORT doenst work #342
Comments
That's odd -- Anything interesting in your logs? Does the entrypoint-generated |
Nothing interesting in my logs, just that the specified database (redmine_db) was not found. I even tried connecting to the container and telnetting to the database, but it only works if it is on port 3306. Even if I start separate containers for redmine and the database, I can only access the database container if it is on port 3306. At another time I tried with the |
I found https://www.redmine.org/projects/redmine/wiki/RedmineInstall#Step-3-Database-connection-configuration which verifies that the way we're setting The only thing I can think of is that we're setting |
Oh, when you use Unless you actually need external access to that database, I'd definitely recommend keeping that tight and only allowing access to it inside the Docker network (ie, removing |
Yes, we keep the doors open to use phpmyadmin and also so that we can use some integrations with other systems. |
If you change I believe you could accomplish that with something like |
I've already tried using the hostname itself, which is The problem isn't with MySQL, because we're using it normally with phpMyAdmin. During a test, we used it on port 3307 and pointed it to phpMyAdmin, which worked normally. We also validated the connection through MySQL Workbench on port 3307. The problem is in the Redmine container. I made the changes today to use the |
Your MySQL instance is running (inside the container) on port 3306 in all these configurations. The So when you specify that you want Redmine itself to connect to |
To make it less confusing, you could use: redmine_db:
ports:
- '${MYSQL_HOST_PORT}'
environment:
MYSQL_TCP_PORT: ${MYSQL_HOST_PORT}
This would keep the port consistent inside and outside of the container space. |
Thank you for your attempts to help, I have tried the alternatives of both @LaurentGoderre and @tianon but without success yet. I just want to use MySQL on a port other than the default 3306 |
Your problem is because you are trying to use both env var and a config file and they are conflicting. This block here doesn't have the port https://github.com/nillander/Redmine/blob/main/Docker/pma/config.inc.php#L37 Adding this makes it work $cfg['Servers'][$i]['port'] = 3307; I also made a mistake for the port section, it should be redmine_db:
ports:
- '${MYSQL_HOST_PORT}:${MYSQL_HOST_PORT}' |
I'm sorry for the question, but have you tested your suggestion?
If you can help, I'd appreciate it. This issue of Redmine not recognizing another non-standard MySQL port seems far from over. Try cloning the repository and making the changes |
I have tried all of the different combination and they all work. If all you want is to expose the db externally with a different port, you don't need to set the |
If you want the Redmine container to access MySQL at a specific port, then MySQL must be instructed to listen at that port. The services:
redmine:
image: redmine:5
environment:
REDMINE_DB_MYSQL: ${MYSQL_HOST_NAME}
REDMINE_DB_PORT: ${MYSQL_CONTAINER_PORT}
# etc ...
redmine_db:
image: mysql:8.0
ports:
- '${MYSQL_HOST_PORT}:${MYSQL_CONTAINER_PORT}'
command:
- -P
- '${MYSQL_CONTAINER_PORT}' #...
MYSQL_HOST_NAME=redmine_db
MYSQL_HOST_PORT=3307
MYSQL_CONTAINER_PORT=9999 In this partial example, MySQL would be listening on port 9999 and Redmine would access at 9999. To an external party or accessing it via one of the hosts IP addresses, MySQL would be at 3307 (e.g., |
When defining a database connection port in the environment variables of the redmine container, using the redmine:5.1.3 image (latest), it is possible to define in the environment variables the values REDMINE_DB_MYSQL, REDMINE_DB_DATABASE, REDMINE_DB_USERNAME, REDMINE_DB_PASSWORD but it is not possible to successfully define the REDMINE_DB_PORT variable, where I want to specify a port other than the default (3306) when using the MySQL database
The text was updated successfully, but these errors were encountered: