Hi everybody!

I’m making a decentralised hosting software, and I often get the question “is there a docker?” from people wanting to try it out. There isn’t so I have tried making one, but I don’t really know how to set it all up…

The soft is split in two:

  • A server that is connected to the internet (both ways, so a port forward is needed)

  • A command line utility

There is also a storage space (in some /data/ folder) and a database (a SQLite one living in some /db/ folder).

Compiling a docker image for the server seems somewhat easy, the user have to provide the two folders and forward the port I guess.

But the command line tool is where I have no idea how to make it not a user experience nightmare in a docker image. Should I publish the soft as a cli or should I try to integrate it into the/a docker image anyways? Security is of importance, so maybe people don’t want to run an “unknown” cli on their PC but would be okay if it’s all docker used.

Thank you all!

  • CameronDev@programming.dev
    link
    fedilink
    arrow-up
    4
    ·
    edit-2
    16 hours ago

    How much CLI is required? Easiest to put it in the container and give instructions to use it via docker exec -it server_container clitool [args] .

    Instructions should include mount points for the DB, so it can be persisted. Providing a docker compose file is usually the best way to do that.

    • Valmond@lemmy.worldOP
      link
      fedilink
      arrow-up
      3
      ·
      edit-2
      14 hours ago

      Thanks! Yup a docker compose is probably the way to go.

      Can the cli load/save files from outside its environment? The cli “inserts” data (day an image), and also saves links locally (in user space). Can that be done? I feel the instructions via your “docker exec…” will be executed only in the docker environment, if that makes any sense?

      Edit: I guess I can provide some sort of intermediate /work/ directory if nothing else.

      • CameronDev@programming.dev
        link
        fedilink
        arrow-up
        1
        ·
        edit-2
        13 hours ago

        Yeah, it runs inside the container, so that won’t have access to the external filesystem’s. And intermediate directory might work, but itll be a bit fiddly.

        Maybe you could supply a script that does something like:

        docker cp $FILE server_container:/tmp/workfile.jpg
        docker exec -it cli_tool /tmp/workfile.jpg
        

        Could do a reverse script as well for download?

        Edit: you can also pipe the files to stdin of the command:

        cat input.jpg | docker exec -it server_container cli_tool upload

        docker exec - it server_container cli_tool download > output.jpg

        • Valmond@lemmy.worldOP
          link
          fedilink
          arrow-up
          2
          ·
          7 hours ago

          Yeah I probably have to build some sort of “pass through” script if I want the cli in a docker, which sort of defies the purpose of ease of use.

          Maybe a simple script (just forwarding things and copying files) would be better “tolerated” as it can be checked more easily for bad code. Or I could just “make it work” so people can have a go at it at least I guess.

          Thanks again!

      • Gonzako@lemmy.world
        link
        fedilink
        arrow-up
        1
        ·
        13 hours ago

        You can define where you want the volumes mounted so you can just have a folder where the cli utility will do it’s work.