php-school / learn-you-php

πŸ† Learn You PHP! - An introduction to PHP's core features: i/o, http, arrays, exceptions and so on.
http://www.phpschool.io/
MIT License
319 stars 36 forks source link

Persist user state in Docker environment #75

Closed mikeymike closed 7 years ago

mikeymike commented 7 years ago

Added a docker volume to persist the user's home directory inside the container. I've had to do the whole home dir because compose cannot volume single files, at least not cross platform iirc.

However there shouldn't be any issues with this because we mount solutions etc into /phpschool which is outside of the home dir so wouldn't cause any conflicts πŸ‘

codecov-io commented 7 years ago

Codecov Report

Merging #75 into master will not change coverage. The diff coverage is n/a.

Impacted file tree graph

@@          Coverage Diff          @@
##           master    #75   +/-   ##
=====================================
  Coverage     100%   100%           
=====================================
  Files          12     12           
  Lines         350    350           
=====================================
  Hits          350    350

Continue to review full report at Codecov.

Legend - Click here to learn more Ξ” = absolute <relative> (impact), ΓΈ = not affected, ? = missing data Powered by Codecov. Last update b499bf2...989072f. Read the comment docs.

mikeymike commented 7 years ago

Hold off on this, just had a bad thought I need to check in the morning

mikeymike commented 7 years ago

So the concern I have with this is that I'm persisting the whole home dir in a volume... afaik we have to do the whole home dir as single files can't be volumes and the file lives in the root home dir 😞

Issue here is we're then also putting .php-school dir in the volume, so lets say we upgrade learnyouphp and rebuild the docker image so that it has the new version... we then start it up with compose and the volume gets mounted, I pretty sure (not confirmed) that it will overwrite the .php-school dir with the one from the volume, therefore putting the old workshop version back in place πŸ€”

mikeymike commented 7 years ago

Defo going to be the case ^^ ... The only thing I think of is persisting the file on the host instead of within a docker volume πŸ€” ...

mikeymike commented 7 years ago

Egh issue with that is unless I'm being a complete tool (possible) if the file doesn't exist on the host it creates it as a directory πŸ€•

mikeymike commented 7 years ago

@AydinHassan updated this to persist on the host, only downside is we'll probably have to make sure that the file exists with the workshop manager, but we can handle that later as we're not currently advocating this new process until it's solid

Also not 100% sure if ~ will work on Windows, but I have no way to test and Google isn't returning me any info 🀞