-
Notifications
You must be signed in to change notification settings - Fork 5
Add support for PostgreSQL #15
Comments
This would be great, but I am not sure I understand, the actual shlink backend supports PostgreSQL but this docker image doesn't? Why is that? Does it just require some non standard setup? |
Well, technically it is supported if you provide the config using a config file through a volume. However, the structure of the config is not documented, and it is not possible using env vars either. I will soon add the docs needed to fully support it. |
Cheers, in the meantime I can try and experiment with the config file / volume approach. |
@jasoniangreen maybe you can try with something like this. {
"entity_manager": {
"connection": {
"driver": "pdo_pgsql",
"user": "my_username",
"password": "my_password",
"dbname": "shlink",
"host": "localhost",
"port": "5432"
}
}
} Change params accordingly, save as Let me know if that helps. |
I assume this means I would need to fork this image and add the driver? |
Or actually, that initial DB code is run on my host machine, so I just need to install that PHP extension? |
Nope, I tell a lie again, it's copied into the docker and run in there. |
Looks like it worked, I'll submit a PR at least with the PG deps added. |
See #34 |
Yes, the image is missing the postgre PHP extension. I knew there was some other reason making it not Postgre compatible. My bad. Regarding your pull request, I remember now that I wanted to carefully check the best approach. If you are not using mysql in production, does not make much sense to bloat the image with mysql dependencies. Same for postgre. For this reason I was considering on releasing two diferent images, one for postgres and one for mysql, but I need some time to work on it. However, this could be a good first approach to support both, allowing to later split the image. I'll need one or two days to get some time to carefully think it. |
@jasoniangreen Both |
@jasoniangreen build finished. |
No problem @acelaya. By the way, can you select the DB schema with the environment variables, or is there another way to do that? |
You should only need to define the database name with the |
Our setup is one main Postgres database with each system getting it's own schema. It was as easy as adding schema property into the database config json file you pointed me to in another message. |
I see. Then for now I'd suggest using the config file. I will add support for this new env var for future versions. |
Hey @jasoniangreen, can I ask how are you providing the schema in the config file? According to the docs of the ORM used by shlink, that's in theory not possible, and my tests are not very satisfactory so far. Would you mind sharing the |
Hey @acelaya sure. This is the file I save to
|
Thanks @jasoniangreen! I must be missing something else, because that's what I tried. I will investigate. |
No description provided.
The text was updated successfully, but these errors were encountered: