#mysql :: Daggerverse

1 messages ยท Page 1 of 1 (latest)

serene patio
worthy crater
#

I can make a new release that include those params - this was originally made for integration testing where username/pass didn't matter

#

I'm going to do that now - i am sure other folks could use that ability

serene patio
#

@worthy crater thank you! please ping me once you've done it, and the correct command to use on the CLI, to install it.

So I can add it into my workshop. I've added a placeholder.

worthy crater
serene patio
#

ty..

I see "Args" as in constructor args like

.mariaDb(arg1, arg2, arg3)

but then I seen this documented example of doing

mariadb().dbPassword()

Question: dbPassword() doesn't look like a function/method call, but only a module constructor argument ..

which is it ? ๐Ÿ™‚

Can you give me a full example of how to call this module, by passing in all the args?

is it...

mariadb(version, 'db_name', 'db_user', 'db_pass')
#

@worthy crater

worthy crater
#

I think this is a bit of a quirk of using an interface.

cc @low trench I think this causes a ton of confusion when we split out the interface args into functions like this

Ill show you an example, which SDK would you be consuming this in?

serene patio
#

@worthy crater PHP SDK, which isn't merged but I can give you the dagger init URL to use, if you really wanna test it out on PHP

#
dagger init --sdk=github.com/dragoonis/dagger/sdk/php@add-php-runtime .

If you go to any existing directory, and run that, then you'll get your files dropped into ./dagger/src/SomeModuleFile.php

worthy crater
#

Here's a full example in python

import dagger
from dagger import dag, function, object_type


@object_type
class DbDebug:
    @function
    def debug(self) -> dagger.Container:
        """Returns a container that echoes whatever string argument is provided"""
        db = dag.mariadb(version="latest", db_name="foo", db_user="bar", db_password="baz").serve()

        return (
            dag.container()
            .from_("mariadb:latest")
            .with_service_binding("db", db)
        )

Then you could call this function like this:

dagger call debug terminal

and then inside of that terminal I can connect to the DB like this

mariab -h db -u bar -p foo --skip-ssl

that'll prompt for a password baz and then you're in business

serene patio
#
        db = dag.mariadb(version="latest", db_name="foo", db_user="bar", db_password="baz").serve()

This, is cool! ๐Ÿ™‚

worthy crater
#

FYI the reason Im doing it this way is that serve() base() and debug() all take the same optinal arguments, so the module is a lot cleaner using the interface this way. But the daggerverse page becomes a lot more confusing IMO ๐Ÿ˜ฆ

#

So feels like we need another iteration on how to make daggerverse page make more sense when using an interface

serene patio
#

makes sense