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

Accessory Data: Directories vs Volumes #453

Closed
leonvogt opened this issue Sep 11, 2023 · 1 comment · Fixed by #507
Closed

Accessory Data: Directories vs Volumes #453

leonvogt opened this issue Sep 11, 2023 · 1 comment · Fixed by #507

Comments

@leonvogt
Copy link
Contributor

I would like to store my accessories data in a dedicated /var/ directory.

The are two options to mount accessories data: Volumes and Directories. The main difference is that directories creates the directory on the host before mounting the volume.
directories seems to be the right choice for me since I don't want to create the directories manually.

The issue I'm facing is that directories are scoped to the user's home directory. When I set directories to /var/lib/redis:/data, the directory $PWD/my-appname-redis//var/lib/redis is created on the host.

I could create the directories manually and use the volumes key, but I would like to avoid that.

I'm not sure if this behavior is intended or not. If my deploy user has the permission to create directories in the /var/lib directory, I see no reason why Kamal should not allow me to do so.


Additional Information:

Volumes approach:

redis:
  volumes:
    - /var/lib/redis:/data

Output

# kamal accessory boot redis
Running docker run [...] --volume /var/lib/redis:/data

Directories approach:

redis:
  directories:
    - /var/lib/redis:/data

Output

# kamal accessory boot redis
Running docker run [...] --volume $PWD/my-appname-redis//var/lib/redis:/data

If there are options to change this behavior, I'll be happy to explore them and contribute to resolving this issue.

@dhh
Copy link
Member

dhh commented Sep 16, 2023

I'd be happy to see a patch where directories declared with a leading / don't add PWD but still create the directory 👍

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 a pull request may close this issue.

2 participants