theia-ide / theia-apps

Theia applications examples - docker images, desktop apps, packagings
Apache License 2.0
1.04k stars 346 forks source link

Question: Persist theia settings and keybindings in a docker volume #345

Closed Christoph-Harms closed 4 years ago

Christoph-Harms commented 4 years ago

I'm running the theiaide/theia image on a digitalocean droplet. I created a docker volume and mounted it to /home/project in the container, so all my project files would survive discarding and rebuilding the container. That worked.

Now I also want my theia settings and keybindings to survive discarding and rebuilding. i found out that theia keeps these things in /home/theia/.theia, so I created another volume and mounted it to that path, expecting it to work just like with the project folder.

That did not work. With /home/theia/.theia being the mountpoint for a docker volume, when I enter a new Keybinding, it doesn't even get saved, let alone survive discarding the container.

How can I achieve settings and keybindings being saved beyond the lifetime of the container?

marcdumais-work commented 4 years ago

Hi @Christoph-Harms ,

I think this should work in principle. Did you notice any errors from the Theia backend? It could potentially be a permission issue. Make sure to open the permissions on the host side for that mounted volume.

Let us know how it goes.

marcdumais-work commented 4 years ago

Please see this related discussion: https://spectrum.chat/theia/general/how-do-i-commit-the-users-theia-preferences-to-docker~f0cc4b0e-5d93-443c-9687-03319dde6796?m=MTU4MzUwMzk1MjEyMA==

Christoph-Harms commented 4 years ago

Hey @marcdumais-work, thank you for responding so fast!

You were right, it was indeed a permission issue. All the volumes get created on the host belonging to root:root. My projects volume was the only one belonging to root:theia, theia being a group I created specifically to have the same GID as the theia group inside the container. I created that a few days back when I was not using docker volumes but binding directories from the host to the container.

I guess I must have fixed the permissions on that one working volume and then forgot about it.

Anyway, I have done chown -R root:theia and chmod -R 775 on all the volumes on the host inside /var/lib/docker/volumes/ and that seems to have done the trick. Feels a bit hacky though, so I think I might be missing something here.

However, this does not look like a theia issue at all. This is either a Docker issue or a UserError issue. ^^

marcdumais-work commented 4 years ago

Hi @Christoph-Harms ,

Awesome!

FYI permission issues are a recurring theme when dealing with docker volumes. For your use-case I think it makes sense to use them, and this should be a one-time setup that just works once figured-out.