-
-
Notifications
You must be signed in to change notification settings - Fork 946
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
Feature: optionally use mysql (but keep postgres as the default) #2130
Feature: optionally use mysql (but keep postgres as the default) #2130
Conversation
To switch between postgres (default) and mysql
@@ -59,10 +59,19 @@ RUN set -eux; \ | |||
|
|||
###> recipes ### | |||
###> doctrine/doctrine-bundle ### | |||
RUN apk add --no-cache --virtual .pgsql-deps postgresql-dev; \ | |||
ARG DATABASE_ENGINE=postgresql |
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.
If I add this to the top of the file, then it's inaccessible at this point. I have no idea why, but it was a pretty frustrating 30 mins of trying to wrangle around it.
- -c | ||
- | | ||
echo 'GRANT ALL on `api_test`.* to `api-platform`@`%`;' > /docker-entrypoint-initdb.d/init.sql; | ||
/usr/local/bin/docker-entrypoint.sh --character-set-server=utf8mb4 --collation-server=utf8mb4_unicode_ci |
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.
This section is so that the api-platform
mysql user can create a test database.
Thanks for the contribution, however we don't plan to merge such feature. It increases the complexity and the maintenance burden. Also, Symfony Flex recipes only support Postgres by default too. |
@dunglas yes, for sure - after working with this for a few days, I agree on the increased complexity - it's better to commit to either one database or the other. I'll open a documentation PR. |
Background: I would like to have the option to have API Platform use mysql instead of postgres. Someone made an entirely new repo just to implement this feature, although it's unmaintained.
This PR adds mysql, but keeps postgres as default. It does this by:
docker-compose.postgres.yml
filedocker-compose.mysql.yml
file.env
file fordocker-compose
to use, which selects postgres by default (but can also be edited to use mysql instead)To use mysql:
.env
file, comment out the postgres lines, and uncomment the following lines:Dockerfile
and changeARG DATABASE_ENGINE=postgresql
toARG DATABASE_ENGINE=mysql
docker-compose build
docker-compose up
Additional notes/concerns
helm/api-platform/values.yaml
but I'm not enough of a Helm/Kubernetes wizard to see what needs to happen. I compared https://github.com/bitnami/charts/blob/master/bitnami/postgresql/values.yaml to https://github.com/bitnami/charts/blob/master/bitnami/mysql/values.yaml and tried to intuit what values would be needed, but this should be rather done by someone invested in running mysql on kubernetes..env
file fordocker-compose
to use, and adds some moreyaml
files - which makes the docker setup less intuitive. However, the big benefit is that it allows for using mysql, while maintaining the current default.CHANGELOG.md
file, but I don't see one.docker-compose
complexity (and not worrying about tests not running on mysql); the downside is that it's some manual setup every time a new person wants to run mysql. I leave it to the maintainers to decide whether this PR should be solely on the docs repo..env
file, but looks abandoned. There's also a question there about moving more environment variables from thedocker-compose.yml
into the.env
file, but I had some issues with that, so would rather first land this PR before digging in that more.