Skip to content
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

dokku_service_create: support passing flags #158

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

blockloop
Copy link
Contributor

Some plugins use flags to customize their options. See MySQL. This allows you to pass flags to the dokku_service_create command so that MySQL and others can be customized.

Some plugins use flags to customize their options. [See MySQL](https://github.com/dokku/dokku-mysql#create-a-mysql-service). This allows you to pass flags to the dokku_service_create command so that MySQL and others can be customized.
@ltalirz
Copy link
Member

ltalirz commented Feb 4, 2023

Thanks @blockloop !

I notice one of the examples of dokku_service_create uses the environment field to pass environment variables to the service creation.
Am I understanding correctly that some, but not all of the flags of the mysql service can also be passed in this way?
For some fields (e.g. MYSQL_IMAGE, MYSQL_CUSTOM_ENV) it is explicitly documented; does it also work for the other flags or not?

The reason I'm asking is just that there doesn't appear to be precedent in the ansible-dokku role for passing flags along in the way you suggest (and I guess one could debate over whether the leading -- should be part of the key or not).

@blockloop
Copy link
Contributor Author

blockloop commented Feb 4, 2023

I'm not really sure of a way to pass the password as a flag to the mysql plugin. I've tried MYSQL_PASSWORD=secretpassword and MYSQL_CUSTOM_ENV="USER=myuser;PASSWORD=secretpassword" and neither of them work. I would rather use the environment variables, but I don't know that the plugin exposes it that way.

The only thing that works with the MySQL plugin is the following:

dokku mysql:create tmpdb --user myuser --password secretpassword

@blockloop
Copy link
Contributor Author

Yeah according to this you can't pass in password as an environment variable. You have to use the flags for any of the additional parameters like memory, shm, password, etc.

@ltalirz
Copy link
Member

ltalirz commented Feb 5, 2023

Ok, thanks for checking!

In that case happy to accept the contribution. Please update the README as described in https://github.com/dokku/ansible-dokku/blob/master/CONTRIBUTING.md

I do wonder whether, instead of using separate key-value pairs, it would be easier to just pass the entire set of flags along as a single string [1].
True, it would be less structured, but on the other hand I understand we want a "generic pass-through" that works with all plugins, so we can anyhow not do any meaningful validation of, say, the passed fields at this point.
Maybe some options don't require a value, ...

[1] I see that there are "special" cases like -c where you will want to have quotation marks around the value passed to the option which might get tricky with your current implementation (could probably also be done by default for all options though).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants