slurdge/goeland

Docker bind volume ownership/permissions and goeland.db

kriswilk opened this issue · 4 comments

Since you now offer a docker image, I put together a docker-compose.yml file containing:

services:
  app:
    image: slurdge/goeland
    restart: unless-stopped
    volumes:
      - ~/docker/volumes/goeland:/data

Issues I've encountered:

  • Unless I first create ~/docker/volumes/goeland (as user 1000), it gets created by docker as root and config.toml cannot be written to it. Shouldn't it be created automatically by docker as the container user (1000?) and just work?
  • Even when config.toml is created/edited, successfully, a "permission denied" error occurs when creating goeland.db.

I admit that I'm pretty new to docker (and to goeland!), so perhaps this is all expected behaviour and I'm "doing it wrong". Either way, I'm hoping for guidance.

P.S. is there a way to default the container to start with the --run-at-startup flag?

* Unless I first create `~/docker/volumes/goeland` (as user 1000), it gets created by docker as root and `config.toml` cannot be written to it. Shouldn't it be created automatically by docker as the container user (1000?) and just work?

Yes it should, I would have to look at it. Probably something to do with running as root or not.

* Even when `config.toml` is created/edited, successfully, a "permission denied" error occurs when creating `goeland.db`.

This should work too. Docker image are quite new, so there needs to have more tests. I'll look into it.

I admit that I'm pretty new to docker (and to goeland!), so perhaps this is all expected behaviour and I'm "doing it wrong". Either way, I'm hoping for guidance.

My goal is to have an example docker-compose.yml file.

P.S. is there a way to default the container to start with the --run-at-startup flag?

Yes, all command line args should be mirrored with environment variables. So if you set GOELAND_RUN_AT_STARTUP=true it should do as you wish.

My goal is to have an example docker-compose.yml file.

That's a good idea. A minimalist example could be similar to mine but with an even simpler persistent volume alongside the docker-compose.yml file:

services:
  app:
    image: slurdge/goeland
    restart: unless-stopped
    volumes:
      - ./goeland:/data

Yes, all command line args should be mirrored with environment variables. So if you set GOELAND_RUN_AT_STARTUP=true it should do as you wish.

Hmm. I just tried this by augmenting my docker-compose.yml:

services:
  app:
    image: slurdge/goeland
    restart: unless-stopped
    environment:
      - GOELAND_RUN_AT_STARTUP=true
    volumes:
      - ~/docker/volumes/goeland:/data

But it didn't have any effect. Where is this implemented in the code? I can't seem to see where it's pulled from an env variable. Or did you mean that this is a planned feature?

The binding is here:

viper.AutomaticEnv()

But I realize I may need to explicitly create a configuration variable bound to the command line for it to work.

Should be ok now. Sorry for the delay.