-
Notifications
You must be signed in to change notification settings - Fork 174
Add Microsoft SQL server adapter #100
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
Add Microsoft SQL server adapter #100
Conversation
Changed "gpg" keyserver to improve reliability.
Hmm, that's embarrassing. I'm happy to make any changes that will allow it to pass, but may need some guidance. It appears to be failing because a download tool like I'm guessing this is because I added |
Travis doesn't seem to like the ampersand in my revised gpg command. I have it in quotes, which worked great when using Docker for Windows, but maybe that's not the best way of addressing it in a cross-platform way. |
I'd recommend dropping all GPG-related changes from this PR, especially if you want it accepted. 😉 We haven't been 100% happy with |
3.2/Dockerfile
Outdated
@@ -67,12 +67,15 @@ RUN buildDeps=' \ | |||
libsqlite3-dev \ | |||
make \ | |||
patch \ | |||
libgmp-dev \ | |||
build-essential \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using build-essential
is always a red flag for me -- here's a quote from the package description (https://packages.debian.org/stretch/build-essential):
If you do not plan to build Debian packages, you don't need this package.
There are usually more specific alternatives that are more appropriate. 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've just tested locally, and I don't think any of these package additions are necessary -- the installation works fine for me with just adding sqlserver
to the list of adapters below! 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Understood, I'll yank it, see what fails, and replace it with more specific packages.
3.2/docker-entrypoint.sh
Outdated
|
||
if [ "$MYSQL_PORT_3306_TCP" ] && [ -z "$REDMINE_DB_MYSQL" ]; then | ||
export REDMINE_DB_MYSQL='mysql' | ||
elif [ "$POSTGRES_PORT_5432_TCP" ] && [ -z "$REDMINE_DB_POSTGRES" ]; then | ||
export REDMINE_DB_POSTGRES='postgres' | ||
elif [ "$POSTGRES_PORT_1433_TCP" ] && [ -z "$REDMINE_DB_SQLSERVER" ]; then |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
POSTGRES_PORT_1433_TCP
here should be SQLSERVER_PORT_1433_TCP
instead
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On second thought, I think we should remove this section -- this section is here for backwards compatibility with --link
'd containers, and I don't think we need to support that for SQL Server, so this entire elif
should just go away.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for spotting the copy-pasta there.
3.2/docker-entrypoint.sh
Outdated
file_env 'REDMINE_DB_USERNAME' "${POSTGRES_ENV_SQLSERVER_USER:-administrator}" | ||
file_env 'REDMINE_DB_PASSWORD' "${POSTGRES_ENV_SQLSERVER_PASSWORD}" | ||
file_env 'REDMINE_DB_DATABASE' "${POSTGRES_ENV_SQLSERVER_DB:-${REDMINE_DB_USERNAME:-}}" | ||
file_env 'REDMINE_DB_ENCODING' 'utf8' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The example at https://www.redmine.org/projects/redmine/wiki/redmineinstall#SQL-Server for sqlserver
doesn't include an encoding, so I imagine this should probably default to ''
like MySQL does above, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch -- on it.
3.2/docker-entrypoint.sh
Outdated
file_env 'REDMINE_DB_PORT' '1433' | ||
file_env 'REDMINE_DB_USERNAME' "${POSTGRES_ENV_SQLSERVER_USER:-administrator}" | ||
file_env 'REDMINE_DB_PASSWORD' "${POSTGRES_ENV_SQLSERVER_PASSWORD}" | ||
file_env 'REDMINE_DB_DATABASE' "${POSTGRES_ENV_SQLSERVER_DB:-${REDMINE_DB_USERNAME:-}}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same deal here as above -- these should all simply default to ''
since we don't need to support pulling credentials from a linked container automatically.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm keen to understand this one better. How is this different from the MySQL or PostgreSQL case? If I go with ''
, will it still be possible to pass in these values when creating a Docker container based on this image?
FWIW, I myself am planning on using an external physical SQL server database, but I can see users wanting to be have the option of linking with a SQL Server container in one shot without having to mess with the database.yml
file manually.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Everyone will pass them is as REDMINE_DB_USERNAME
, REDMINE_DB_PASSWORD
, etc (or the respective _FILE
version), and we won't have a fallback to the SQLSERVER_ENV_*
variables that come from the environment variables of a container linked as --link my-sqlserver:sqlserver
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for explaining. So that entire section is just to establish fallbacks/defaults. Right on, I've made everything in that section ''
per @tianon's feedback.
3.2/Dockerfile
Outdated
' \ | ||
&& set -ex \ | ||
&& apt-get update && apt-get install -y $buildDeps --no-install-recommends \ | ||
&& rm -rf /var/lib/apt/lists/* \ | ||
&& bundle install --without development test \ | ||
&& for adapter in mysql2 postgresql sqlite3; do \ | ||
&& for adapter in sqlserver mysql2 postgresql sqlite3; do \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd prefer to keep these in the same order they are in the entrypoint, so sqlserver
should go between postgresql
and sqlite3
. 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No problem.
Hmm, still failing, but I can't really tell what the problem is -- all |
3.2/Dockerfile
Outdated
@@ -26,7 +26,7 @@ RUN set -x \ | |||
&& wget -O /usr/local/bin/tini "https://github.com/krallin/tini/releases/download/$TINI_VERSION/tini-$(dpkg --print-architecture)" \ | |||
&& wget -O /usr/local/bin/tini.asc "https://github.com/krallin/tini/releases/download/$TINI_VERSION/tini-$(dpkg --print-architecture).asc" \ | |||
&& export GNUPGHOME="$(mktemp -d)" \ | |||
&& gpg --keyserver ha.pool.sks-keyservers.net --recv-keys 6380DC428747F6C393FEACA59A84159D7001A4E5 \ | |||
gpg --keyserver ha.pool.sks-keyservers.net --recv-keys 6380DC428747F6C393FEACA59A84159D7001A4E5 \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would say the missing &&
is causing the build failures. 😉
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Derp. Thank you!
3.2/docker-entrypoint.sh
Outdated
|
||
if [ "$MYSQL_PORT_3306_TCP" ] && [ -z "$REDMINE_DB_MYSQL" ]; then | ||
export REDMINE_DB_MYSQL='mysql' | ||
elif [ "$POSTGRES_PORT_5432_TCP" ] && [ -z "$REDMINE_DB_POSTGRES" ]; then | ||
export REDMINE_DB_POSTGRES='postgres' | ||
elif [ "$SQLSERVER_PORT_1433_TCP" ] && [ -z "$REDMINE_DB_SQLSERVER" ]; then | ||
export REDMINE_DB_SQLSERVER='sqlserver' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should also drop these two lines, since they are also about a linked container.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will do. But can you help me to understand how this is bad to include for SQL server, but good to include for PostgreSQL and MySQL?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
They are still there for backwards compatibility to use the presence of environment variables to detect a --link
ed container. Docker docs call links a legacy feature that "may eventually be removed". We should instead point users to an example compose/stack file that sets all of the correct environment variables.
Dockerfile.template
Outdated
@@ -67,12 +67,14 @@ RUN buildDeps=' \ | |||
libsqlite3-dev \ | |||
make \ | |||
patch \ | |||
libgmp-dev \ | |||
libc6-dev \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are you sure these are necessary? I was able to install sqlserver
successfully without them in my testing. 😕
(If they are indeed necessary, this list should stay in sorted order, but I'm not entirely convinced they are -- maybe they're pulled in already by one of the above deps?)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You might be correct. I haven't been able to figure out how to test this locally due to a variety of Docker errors I encountered. I did have to install these packages before attempting to add support for SQL server in order to build the TinyTDS gem. I will try removing these and seeing whether the CI build passes.
…build TinyTDS gem.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! 👍 (and Travis is happy too 🤘)
Hmm, Travis was happy for me in my branch too, and I saw it succeed after your merge, but it looks like there are errors in master for 3.4 only. Hope I didn't cause you guys grief somehow! |
Naw, just a standard flakey test. 👍 ❤️ |
- `cassandra`: add `docker-entrypoint.sh` to PATH (docker-library/cassandra#130) - `ghost`: 1.19.1 - `haproxy`: 1.6.14, 1.7.10 - `nextcloud`: redis-3.1.6, APCu-5.1.9 - `php`: better libs-preserving code (docker-library/php#556) - `redmine`: add `sqlserver` database adapter (docker-library/redmine#100) - `rocket.chat`: 0.60.3 - `wordpress`: remove `-dev` dependencies (docker-library/wordpress#267)
Thanks for merging this, @tianon! You might not read comments on closed PRs, but is there any chance the documentation at https://github.com/docker-library/docs/tree/master/redmine could also be updated so people know that SQL server is now supported and have some examples of how to use it? |
So, Redmine now has proper support for Microsoft SQL Server, which even runs on Linux and Docker now. I attempted to add support for this, and would appreciate feedback. I'm new to this stuff.
While building the Docker images, I had problems with
ha.pool.sks-keyservers.net
being slow and unreliable, so I'm also proposing changes to use the MIT server instead, which worked much more reliably for me.