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

wait support explicit exec form #864

Open
scottmarlow opened this issue Sep 13, 2017 · 1 comment
Open

wait support explicit exec form #864

scottmarlow opened this issue Sep 13, 2017 · 1 comment

Comments

@scottmarlow
Copy link

Similar to #253, I would like to use the explicit exec form in "wait" to execute the following Docker command after creating a MongoDB container instance:

docker exec some-mongo /bin/sh -c "mongo mongotestdb --eval "db.createUser({ user: 'devuser', pwd: 'changethis', roles: ['dbAdmin'] }); db.auth('devuser', 'changethis'); " "

I need to wait until the MongoDB server has started, before issuing the command, so I would like to do something like:

<wait>
    <time>50000</time>
    <exec>
        <arg>mongo</arg>
        <arg>mongotestdb</arg>
        <arg>-eval </arg>
        <arg>db.createUser({ user: 'devuser', pwd:  'changethis', roles: ['dbAdmin'] }); db.auth('devuser', 'changethis');</arg>
    </exec>
    <tcp>
        <ports>
            <port>27017</port>
        </ports>
    </tcp>
</wait>

One alternative, could be to use a separate "cmd" (that already supports explicit exec form), block on the "wait" completing before running the command.

What do you think?

Currently, [https://github.com/scottmarlow/wildfly-swarm/commits/docker] is not creating a MongoDB user but I would like to change that.

Thanks,
Scott

@rhuss
Copy link
Collaborator

rhuss commented Sep 14, 2017

Doesn't <exec><postStart>... fit your bill ? Couldn't you already put the command as script into your mongodb image ? We could introduce something like a more complex configuration here, shouldn't be hard. The only challenge would be to keep backwards compat. (e.g. to default to the 'shell' form).

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

No branches or pull requests

2 participants